-
Posts
11,266 -
Joined
-
Last visited
-
Days Won
374
Everything posted by adrian
-
Hi Soma, Just taking a first look at this as I think it could be quite useful for a particular purpose. I have a wireCache that caches a query that takes several minutes to run. I have it set to never expire - the content driving this query only gets changed once a year, but when it is being changed, it takes many edits to many different pages, so I don't want the cache to be cleared by any rules. I just want to clear it once after all the data has been changed. I thought your module might be a nice way to do this, rather than manually deleting the row from the caches table, but you have this: As found in the wire cache DB table except those that never expire. Is there any reason you are not listing those caches that never expire? I assume it is to protect the content? Could this be optional? I may end up going with a different approach because I think this module is too complex for client use anyway - of course awesome for devs which I assume is your target anyway. Still I thought I would ask because it still might be safer for me to be the one that clears that cache when it is time and your module would be a simple way to do this.
-
Hey kongondo, I have noticed an issue when using unpublished or hidden pages. Here is my scenario. I am using this custom php code as the row selector: return $pages->find("parent=/report-cards/{$page->parent->parent->name}/years/, sort=sort, include=all"); The "include=all" ensures that even though the latest year is unpublished (we are currently adding data and it's not ready to be live yet), we still see that year as a row in the matrix table. The problem is this line: https://github.com/kongondo/FieldtypeMatrix/blob/master/InputfieldMatrix.module#L439 //remove matrix-rows that are no longer needed i.e. 'unpublished', 'hidden', 'deleted' or 'trashed' if(!$rp || $rp->is(Page::statusUnpublished) || $rp->isHidden() || $rp->isTrash()) continue; Even though data is saved to the db, that line prevents it from being displayed in the matrix table - you enter and save, but it appears blank. For my needs I have commented this line and it seems to be working fine. I am not sure of the best fix - perhaps this line is simply not necessary or maybe it needs to be an option? The same issue occurs with columns as well. Please let me know if I haven't explained properly or if you have any other questions. Thanks!
-
Better support for unpublished users in admin
adrian replied to Robin S's topic in Wishlist & Roadmap
Nice one. I also employed a little trickery in my EmailNewUser module, although I took a slightly different approach. $this->addHookBefore('InputfieldPassword::processInput', $this, 'removeRequired'); public function removeRequired(HookEvent $event) { $event->object->required = false; //hack to remove required status so that automatically generated password can be added on save } -
Did you see the Issue at the end of that thread: https://github.com/ryancramerdesign/ProcessWire/issues/378 - this was supposed to be fixed Feb 2014. Are you using a really old version of PW? If not, it might be worth adding a comment to that issue to say that there are still issues.
- 15 replies
-
- navigation
- menu
-
(and 1 more)
Tagged with:
-
Just make sure you run Modules > Refresh after renaming and they will work again. The reason I think it's important is so that you can use the Upgrades module to upgrade all your modules to new versions easily. And in future if you install using the ClassName or the zip (via URL or upload), then you won't ever have to deal with the "-master".
-
I just committed a new version - it now ignores pages under admin and trash. Before it just excluded pages with the "admin" template. I think this should take care of the problem with WireQueue. I also fixed a bug with images being blank in RTEs when you haven't manually specified the max number of images for the images field that is used.
-
Front end publish/unpublish/hide/trash/delete link
adrian replied to arturg's topic in API & Templates
First question - how are you going to handle the editing? The pub/unpub/trash are easy, but if editing you need to figure out if they will get a modal popup for editing there, or if they will be redirected to the admin for this. You might want to take a look at these modules: http://modules.processwire.com/modules/front-end-edit-lightbox/ http://modules.processwire.com/modules/fredi/ As for the pub/unpub/trash - there are a few ways to tackle this - I think the first thing you need to decide on is whether you want it done via ajax, or whether a page reload is acceptable. If the latter, then you can simply have a link like: http://mysite.com/change-status/?pid=1001&change=trash The template file for the change-status page would contain something like this: if($user->hasRole("required-role")) { $p = $pages->get((int) $input->get->pid); if($p->id) { if($input->get->change == 'trash') { $p->trash(); } else { if($input->get->change == 'unpublish') { $p->addStatus(Page::statusUnpublished); } elseif($input->get->change == 'publish') { $p->removeStatus(Page::statusUnpublished); } $p->save(); } } } Then you'd want to redirect back to the main dashboard page using $session->redirect() Personally I'd prefer an AJAX approach. I would make use of jquery for this and call the above page via: $('#trash').click(function(){ $.get( '/change-status', function( data ) { //code to update status in dashboard Of course there is more to it than that, but maybe you already know your way around jquery and ajax so I'll leave you to figure that bit out. -
Front end publish/unpublish/hide/trash/delete link
adrian replied to arturg's topic in API & Templates
Sorry, it just occurred to me that that was a rather useless answer You'll probably want to make use of the API and do something like this: $p = $pages->get("page to alter"); $p->addStatus(Page::statusUnpublished); $p->save(); You could put this inside a conditional that checks that the user has the correct role/permission. You may also want to do it based on the passing of a get or post variable so it can be part of your existing template file. Hopefully that will get you started but let us know if you have any specific implementation questions. -
$session and $input variables in templates in v3++
adrian replied to joshuag's topic in API & Templates
It sounds like you are assuming that the file compiler works like a cache converting the values of these variables into hard values at the time of compilation? As LK and ryan mention, this is not the case - the file compiler is really just for dealing with Namespace issues (although it can be used for other things like tags compiling). The key thing is that the resulting file is still all php with variables intact. -
@shamus - sorry for the delay in getting back to you - I have made a start on investigating this and improving the importing in general - stay tuned! @Robin S - I posted about this here: https://processwire.com/talk/topic/10517-frontend-password-reset/?p=119386 - it's a bug in the Password Reset module, but I have implemented a check in BCE that will prevent the error - instructions on how to implement are also in that thread.
-
The unknown template error is due to a bug in the settings for the password-reset template. 67 password-reset 121 0 0 {"childTemplates":[120] There is no template with an id of 120 in my system. 120 refers to the fieldgroup for the password-reset-request template, rather than the id of that template itself. This is the culprit: https://github.com/plauclair/PasswordReset/blob/master/PasswordReset.module#L279 That said, I have added an additional check to BatchChildEditor so the error won't occur. I am currently working on some other changes to BCE so I won't commit this fix just yet, but you can do it yourself by changing: https://github.com/adrianbj/BatchChildEditor/blob/master/BatchChildEditor.module#L711 if(!$this->isAllowedTemplateAdd($templateId, $pp)) continue; to: if(!$t->id || !$this->isAllowedTemplateAdd($t, $pp)) continue;
-
Did you test AdminRestrictBranch with 2.4 or are you just basing it on what it says in the modules directory? If you did test and got an error, could you post for me - maybe it will be an easy fix - no promises - I don't want to spend a lot of time making it work with such an old version of PW, but if I can help, I will.
-
Front end publish/unpublish/hide/trash/delete link
adrian replied to arturg's topic in API & Templates
Take a look at the links for the action buttons in the admin. To unpublish for example, looks like: http://pw.dev/processwire/page/?action=unpub&id=1005 Presumably the users with access to these links will be logged in and their role will have permission to perform these actions? -
The setTimeout method wasn't added to WireHttp until PW 2.5: https://github.com/ryancramerdesign/ProcessWire/commit/c06209b4e03036cf0026b57c6015192dc61c936d#diff-1972780faf7a13076c1284fbb478144a so I believe Ryan mistakenly added 2.3 and 2.4 to the list of compatible versions. But why not upgrade to 2.7 - 2.4 is very old now - so many amazing new features to make use of.
-
If you already have HannaCode installed, you can use that to run code in the backend easily using the Test option. If not, then you can place it into an existing template file. If it's a live site then maybe wrap it in: if($user->isSuperuser()) { so that it only happens once when you visit the page with the template. I would also recommend testing that code of mine on a dev/testing site first. I adapted it quickly from https://processwire.com/talk/topic/6654-convert-repeater-to-pagetable/ - I think it should be fine - looks good, but always worth a double check before running something like this on a live site.
-
$rf = "repeater_field"; //repeater field name $pt = "basic-page"; //page template name foreach($p->$rf as $r){ $np = new Page(); $np->of(false); $np->template = $pt; $np->parent = $page; foreach($r->fields as $f){ $np->$f = $r->$f; } $np->save(); }
-
That make sense, but here's another scenario for you. What if the dev sets the maxFiles to 3 and the Which Images to All Available. And it is attached to a textarea field where they can enter multiple videos - what images get kept, and which ones get deleted when additional video links are added? Obviously it would be a silly combination to set up, but you never know. At least the way it is now if you want just one video per page you can use a text field (not textarea) and choose First Available. That way you'll only ever get one image - the only caveat is that you need to do $page->images->first(). If you want the manual upload override you can have a separate field, or you could tell the site editors to simply order the images field so that their manually uploaded one is in first position. Or, the template logic could look for the presence of an image without the "video-" prefix and use that if it exists? I am still not convinced I am right, so I would still like to hear from other users of this module! Thanks for your continued thoughts on this!
-
I think you are looking for getForPage(): https://github.com/ryancramerdesign/ProcessWire/blob/7e8c7c6836282b6b64de81263f5aaa8112fd51ae/wire/modules/Fieldtype/FieldtypeRepeater/RepeaterPage.php#L46
-
Hey Steve - thanks for your interest in this module and thanks for figuring out the issues with WireQueue - as you mention it will probably happen with others too so I need a way to exclude as necessary, or maybe it can be automatically dealt with - I'll take a look. The one main issue still remaining with this module is the slowdown when a template includes page fields - at the moment the module generates content for all fields from the templates of these page fields - this can take some time. I need to figure out a better way to do this. Connected to this is the delay from calling the http://loripsum.net API. Even though I make use of Faker locally for most things, the RTE fields still use http://loripsum.net because of their random text/image options. I would like to recreate this functionality directly with the Faker API as it would make it much quicker. Otherwise I think it is working well, although I would still like to add support for Profields etc.
-
Thanks - yeah, it is certainly doable, but the problem I see is that if the dev sets the max to 1 and doesn't prevent users from manually uploading an image, and this modules works like PW in that a single image is replaced if the max is one, then manually uploaded image will be lost. So it doesn't work for the scenario where you want the user to be able to override the default image from Youtube/Vimeo. I think it's better in that scenario to have a dedicated "manual override" image field - at least that is my current thinking. Is there anyone else there with any thoughts on this? I'd like to get a consensus before I go making anymore changes.
-
Image field in User template not behaving normally
adrian replied to Robin S's topic in General Support
https://github.com/ryancramerdesign/ProcessWire/issues/1803 Will see what Ryan has to say. -
Try looking at the Network tab (make sure it is open before you upload the image). You should end up with a line that has an error - that will be the PHP error that will give you the info to figure out what is wrong. The error you are seeing in the console is a syntax error because the ajax call is returning the real error. My initial guess would be file/folder permissions, but if you let us know the error, we should be able to figure things out.
-
Take a look at this post by soma: https://processwire.com/talk/topic/4530-how-to-get-a-list-of-all-pages-recursiv-without-admin-pages/?p=44508
-
Just added a new "Core Classes" section to the debug panel - so now you have really quick access to the new 3.x API ref docs for all the core classes.
-
You might find wireSendFile with the forceDownload option useful: https://github.com/ryancramerdesign/ProcessWire/blob/7e8c7c6836282b6b64de81263f5aaa8112fd51ae/wire/core/Functions.php#L521