Jump to content

adrian

PW-Moderators
  • Posts

    11,185
  • Joined

  • Last visited

  • Days Won

    372

Everything posted by adrian

  1. Sorry Jon - just realized I didn't answer the last part of your question. To read more about ready.php, take a look here: https://processwire.com/blog/posts/processwire-2.6.7-core-updates-and-more/ I think it is much easier than setting up a module for custom tweaks like this and I don't think there are any disadvantages. Actually, for admin specific stuff (assuming you aren't saving your pages via the API), you might actually want to put that code in /templates/admin.php so it is only called on the backend.
  2. You can click the Download Zip button on this page: https://github.com/ryancramerdesign/ProcessWire/tree/devns Or use the Upgrade module: https://github.com/ryancramerdesign/ProcessWireUpgrade to get it.
  3. There is a little info on SaveReady here: https://github.com/ryancramerdesign/ProcessWire/blob/dev/wire/core/Pages.php#L2293 With save you need to be careful you don't end up going recursive which can happen when hooking after save because your hook function then needs to call save again, which triggers the hook again Maybe hookbefore save would be ok - I don't actually recall - I just tend to default to saveReady because it usually suits my needs!
  4. I haven't come across this - I wonder if it's the fingerprint config setting - try setting that to false and see how it goes.
  5. Try something like this in your ready.php: $this->pages->addHookAfter('saveReady', null, 'buildName'); function buildName($event) { $page = $event->arguments[0]; if($page->template != 'cruise') return; $page->title = '$page->parent->title . '-' . $page->date . '-' . $page->boat_name'; $page->name = wire('sanitizer')->pageName($page->title,true); } EDIT: You may also want to make use of the Name Format for Children option so that the page title/name initial dialog is not needed. You could have this set to create a dummy name since the code above will rename after anyway.
  6. Actually I just realized I might have been a bit confused by what you want - I thought what I wrote answered the first sentence in your question, but the second sentence suggests you want to hide the pub/unpub action buttons, in which case try this in your ready.php $this->addHookAfter('ProcessPageListActions::getExtraActions', null, 'hookGetExtraActions'); function hookGetExtraActions($event) { $page = $event->arguments[0]; $extras = $event->return; if($page->template->name == "basic-page" && $page->hasStatus(Page::statusUnpublished)) { unset($extras["pub"]); } $event->return = $extras; } You can remove the page status check for unpublished and also add: unset($extras["unpub"]); if you want to remove that as well.
  7. I think you should be able to achieve what you want by hooking into Page::editable I think this should do what you are looking for - just edit the template you want to match. Keep in mind that in this form it will even prevent superusers from editing the page, so you might want to check that before adding the hook $this->addHookAfter('Page::editable', null, 'hookPageEditable'); function hookPageEditable($event) { $p = $event->object; // in case there is already a defined exclusion for this user's role for this page if(!$event->return) return; if($p->template->name == "basic-page" && $p->hasStatus(Page::statusUnpublished)) { $event->return = false; } else { $event->return = true; } }
  8. Thanks Adam - no problem at all - it's for a request for my AdminRestrictBranch module. I'll take a look when I get a chance to see how might be the best way to implement it.
  9. Hey Adam, Did you ever get a working solution for this? I haven't tried to code anything up yet, but thought I'd be lazy and see if you had anything to share first
  10. Thanks @tpr - I did think about the breadcrumbs issue, but wasn't actually sure if it should be modified or not - perhaps it is actually useful for editors to know where their branch fits in the site (even though they don't have access to the rest of it). Perhaps this could be an optional change? I am curious about your comment about setting up the roles and permissions being a huge amount of work - do you feel like it was extra work because of this module, or juts because of the way PW roles and permissions work? In my experience with this module so far, it actually reduces the complexity of the setup, because I can actually all roles full editing privileges inherited down from the "home" template, knowing that they can't actually mess with any pages that aren't in their restricted branch, but I can see situations where you still might want restrict what they can do within templates within the branch, but for that I am finding the new " Additional edit permissions and overrides" setting in the template access tab incredibly useful.
  11. Back to @elabx's question - if you want to tackle this, have a read of these two threads: https://processwire.com/talk/topic/4253-modal-pop-up-for-page-editing-problem-with-dynamically-generated-page-tree/ https://processwire.com/talk/topic/2380-fancy-admin-mode/
  12. I never noticed that - thanks for the head's up - I'll see if I can fix it in the next couple of days. @tpr - sorry for hijacking your thread!
  13. The title changes immediately for me - as soon as the modal is closed. The name however doesn't change until the parent page is reloaded. This is actually on my list of things to do, although it's been there for quite some time - maybe I need to make it a higher priority.
  14. This could actually probable be done quite easily using CustomAdminFiles to apply the "pw-modal" class to the edit action button. Sorry, no time for an example, but you could probably steal from PageTable's edit trigger. Otherwise, you could alway use Batch Child Editor - the edit icons trigger a modal for editing:
  15. You can always edit your module in the modules directory - simply open the edit mode and save - it will query Github and update the version number which will then make it available via the Upgrade module instantly.
  16. Awesome - would love to see more of these. Please let us know your experience with it - maybe some day soon there will be enough PW devs in my part of the world to do host one.
  17. Glad that helped, but I think I will defer to one of the multi-language experts for the other part of your question - it's not something I use, so I am not very familiar with it.
  18. Hi @Karl_T I think this screenshot should get you going - the "Name Format for Children" option allows skipping the manual naming of the page:
  19. I can confirm that adding the ProcessWire namespace to a module and trying to run it on PW 2.x results in an error.
  20. Have you tried again recently - that looks like it might simply be an access to Github error. The feed is certainly running right now so I would try again and if you still get the error, please check the URL directly to see if there is a problem at your end: https://api.github.com/repos/ryancramerdesign/Processwire/branches
  21. Restrict site editors to just one branch of the page tree: http://mods.pw/Aq

  22. Ok, here you go: http://modules.processwire.com/authors/mikerockett/ I am pretty sure you just have those two modules, correct? I have deleted the account author except for "mike", just in case it wasn't you.
  23. Beta release is now available via the modules directory: http://modules.processwire.com/modules/admin-restrict-branch/ Contains a few bug fixes, adherence to Add New permissions, and the ability to restrict the name matching to the restricted branch to a master parent to reduce potential for incorrect matches and also improve matching selector efficiency. Despite it being released, please still carefully check that your affected users have the permissions and access that you expect and let me know if you have any problems!
  24. There is really only the roadmap: https://processwire.com/about/roadmap/ I have asked Ryan for this functionality outside of the forum and his response was positive, but you won't see it mentioned anywhere official.
  25. Hey Mike - looks like you have a lot of aliases in the modules directory. Are all these you? What do you want them all merged to?
×
×
  • Create New...