-
Posts
11,258 -
Joined
-
Last visited
-
Days Won
374
Everything posted by adrian
-
Hey Martijn - this sounds very interesting - when you have time, it would be cool to see your code - this sounds like a module waiting to happen
- 28 replies
-
- 6
-
-
- ajaxProgressiveSearch
- custom search
-
(and 1 more)
Tagged with:
-
Without knowing what redirects are needed, it's hard to now the best way to help you out here. You might be better off with a modrewrite rule if it's a standard pattern that you could match so you can rewrite all links with one rule, or a collection of rules that handle your different scenarios. Otherwise, you might be able to write a small script to batch create redirect entries for this module based on a regex.
-
Super cool new feature just added - well at least I think it's cool You can now automatically backup your entire site's database and templates directory during the import process. Backups are archived so you can go back to any previously created version whenever you want. If something goes wrong during the import phase of the migration, or you simply imported the wrong json file, or you changed your mind, you can restore everything with the click of a button! This database part of this functionality relies on Processwire's brand new WireDatabaseBackup class that Ryan committed today, so to use this functionality, go grab the latest dev version of PW and the latest version of this module. Please let me know how it goes for you!
- 315 replies
-
- 15
-
-
Unfortunately I think apeisa's module behaves the same way - it also stores the ID of the page that is being redirected to:
-
Sorry, my mistake - I was running an older version of the module - looks like apeisa added that functionality back in April: https://github.com/apeisa/ProcessRedirects/commit/59c9504defde15a2080cc24e9ac7504739926167 So really nothing needs to be done. He could have automatically had the module create that permission, but not really that important. Anyway you should have no problem now allowing users access to create redirects.
-
What about Directory Opus (http://www.gpsoft.com.au/).
-
Akismet is fairly useless in my experience and captchas are a horrible user experience and need to die. It's easy to use a honeypot (regular or reverse) with PW. There is even one built in to the comments module (https://processwire.com/talk/topic/960-comment-spam-filtering-alternatives/). As I said, form builder may suit your needs, but that post on creating a front end form from scratch might be your best option - it was missing from the original version of my post, but has been added now.
-
Btw, I just made one small change to the module - I had it creating the page without a title, which is fixed now. Up to you, but something else to think about here - you are opening up the possibility for someone to write a script to generate potentially millions of pages on your site just by hitting URLs with the two letter / two number path in the url. If you then give them the ability to comment and upload images with any checks that they are a real users, rather than a bot, you could be creating a real mess and security issue for yourself. Typically I would ensure any page created by a user was set to unpublished until they have somehow verified their status as a human being - an email activation check, etc. I am guessing that won't fit well with how you want things to work, but thought I should mention it so you can consider the possible implications. Obviously this is not a problem specific to PW. Not sure your best option, and maybe the regex that limits the page to two letters/two numbers is enough to prevent any issues?
-
Yes, what I just wrote is a module that can be installed directly so long as you tweak those few things I mentioned to suit your needs. Well, you can easily install the comments module (http://processwire.com/api/fieldtypes/comments/) - it's in the core, just not installed by default. Adding the comments field to the template for the newly added pages and including the appropriate code in the template's php file as per the instructions in that link will get your comments set up automatically. As for images - not sure the best approach here. You might be able to extend the comments fieldtype, but it might be better to go with a completely custom front end form. Here is the seminal thread on the matter of creating front end forms (https://processwire.com/talk/topic/2089-create-simple-forms-using-api/) - it is fairly simple, but you will have to get your hands dirty. You might be able to use Ryan's pro Form Builder module (http://processwire.com/api/modules/form-builder/) which does include the ability to upload images. I haven't really ever used it though, so not sure exactly what would be involved in submitting the form and having it populate the same page again, especially if multiple users will be contributing content to the same page. I think a custom front end form is probably the best option in the end and I have used these many time for user submitted images. I am sure others will chime in with additional ideas on this front though.
-
Hi yabapolido and welcome to the forums. This should do it, although you'll need to tweak the preg_match because I wasn't sure whether you wanted exactly 2 numbers and two letters, or just a minimum of each. Currently it is set to just two of each. Also, this currently only works if you are talking about a page added to the root of your site, but this can be easily tweaked. The other thing you'll want to adjust is the template being assigned to the new page - currently I set it to basic-page. <?php /** * ProcessWire Auto Create Page * by Adrian Jones * * Automatically creates a page if it doesn't exist * * ProcessWire 2.x * Copyright (C) 2011 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://www.processwire.com * http://www.ryancramer.com * */ class AutoCreatePage extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Auto Create Page', 'summary' => 'Automatically creates a page if it does not exist', 'version' => 1, 'autoload' => true, 'singular' => true ); } /** * Populate the default config data * */ public function __construct() { // determine the URL that wasn't found $url = $_SERVER['REQUEST_URI']; // if installed in a subdirectory, make $url relative to the directory ProcessWire is installed in if($this->config->urls->root != '/') { $url = substr($url, strlen($this->config->urls->root)-1); } $last_slash = strrpos('/', $url); $this->last = str_replace("/","",substr($url, $last_slash)); } public function init() { if (preg_match( '/^(?=.*[a-zA-Z].*[a-zA-Z])(?=.*\d.*\d).{4}$/', $this->last)) { $this->addHookAfter('ProcessPageView::pageNotFound', $this, 'createPage'); } } public function createPage($event) { if(!$this->pages->get("parent=1,name={$this->last}")->id){ $np = new Page(); $np->parent = $this->pages->get("/"); $np->template = 'basic-page'; $np->title = $this->last; $np->of(false); $np->save(); $this->session->redirect($np->url); } } }
-
This is incredibly rough, but throw this at the end of your main.php/main.inc/foot.inc or whatever you are using: if($user->isSuperuser()){ $fieldinfo = '<hr /><p>Field details for ' . $page->template . ' template</p>'; $fieldinfo .= '<table><th>Name</th><th>Label</th><th>Type</th>'; foreach($page->fields as $field){ $fieldinfo .= '<tr><td><a href="'.$config->urls->admin.'setup/field/edit?id='.$field->id.'" target="_blank">'.$field->name.'</a></td><td>'.$field->label.'</td><td>'.$field->type.'</td></tr>'; } $fieldinfo .= '</table>'; echo $fieldinfo; } This will give you a table of fields for the current template including name, label, and type. The name cell links to the edit page for the field if you need more info. I am actually thinking it make be nice to add the popup of field settings the way soma did it in https://github.com/somatonic/HelperFieldLinks which is a module you should definitely install by the way
-
It is definitely possible to set up a permission for modules. Actually, that might be a nice addition to the Redirects module. It's simply a matter of setting the permission required in the module config and then giving a role that permission. I was just going to suggest the batcher module. Here is how it is implemented: https://github.com/wanze/ProcessBatcher/blob/master/ProcessBatcher.module#L58 Then typically the module adds that permission when it installs. EDIT Perhaps you should make those changes to Redirects and submit a Pull Request!
-
Hey davo - nice work! I am curious - I think I might be missing something - what advantage does this have over apeisa's Redirects module? http://modules.processwire.com/modules/process-redirects/
-
You could set up a page field with a PageListSelectMultiple Inputfield Type - the user could choose the pages from anywhere in the page tree and sort as desired. Is that what you are wanting to do?
-
Well the first thing is to make sure that isGuest() is working, so do something simply inside it like: echo "true". When you used isLoggedin() did you get the case correct? Then if that works you know it's an issue with your cookie code. It seems strange to me to use a date format as the cookie name and then isset for a cookie named "pageid". Is that all intentional?
-
https://processwire.com/talk/topic/4680-block-access-to-settings-delete-and-view-tabs-for-page/
-
Should be working again in the latest PW dev version: https://github.com/ryancramerdesign/ProcessWire/commit/52ac6b7a647c212afbc07446847743d21b862164 Thanks Ryan!
-
https://processwire.com/talk/index.php?app=core&module=usercp&tab=core&area=notifications You should be able to configure what you are looking for in the first item?
-
Yep - same field names including "date". Hopefully Ryan can help you debug this one.
-
No issues here - perhaps it might be best to post this question in the VIP board for pro fields for Ryan to investigate. Do you have the same issue with other table fields? Does it make a difference if the table rows are created via the admin or via the API?
-
No stupid questions here Andrea - we are all learning Enjoy your PW discovery - it's a whole new world!
-
Hi @a.masca and welcome to the forums. Don't mess around with Hanna for videos: http://modules.processwire.com/modules/textformatter-video-embed/ And this for google maps: http://modules.processwire.com/modules/textformatter-google-maps/
-
Looks great - thanks! Also check out this solution from diogo: https://processwire.com/talk/topic/6196-easy-search-on-pw-forums-with-google/
-
Just wanted to note that this module won't work on recent dev versions of PW due to the inability to upload SVGs anymore. I have filed an issue here: https://github.com/ryancramerdesign/ProcessWire/issues/597
-
Oh I see - if I understand correctly I think module might help you out: http://modules.processwire.com/modules/page-edit-field-permission/