verdeandrea Posted November 26, 2014 Share Posted November 26, 2014 Hi again guys! Is there a way to set edit permissions for a role on multiple templates simultaneously? Thanks as always Link to comment Share on other sites More sharing options...
adrian Posted November 26, 2014 Share Posted November 26, 2014 API to the rescue foreach(array("basic-page","home") as $tn) { //list your required templates out in the array $t = $templates->get($tn); $t->editRoles = array(1043); // where number is the ID of the role you want to assign $t->save(); } 6 Link to comment Share on other sites More sharing options...
verdeandrea Posted November 27, 2014 Author Share Posted November 27, 2014 Thanks, as always, adrian. Just a suggestion for the future versions of PW: it could be helpful to manage this from admin panel. Link to comment Share on other sites More sharing options...
adrian Posted November 28, 2014 Share Posted November 28, 2014 (edited) How about this little process module You can choose the templates, access permissions, roles, and whether you want to add or remove these roles from the selected templates/access permissions. Test carefully, but I think it should observe all other permission rules etc. For example, it won't let you add Create if Edit is not checked, or already assigned in the current settings. Also, if you choose to remove Edit, it will automatically remove Create even if you don't select it. These are to adhere to PW's access rules. Not sure if this is worthy of being added to the PW modules directory or not - what do you guys think - would people actually use this? Edited November 29, 2014 by adrian Attached module removed - newer version posted below. 7 Link to comment Share on other sites More sharing options...
Soma Posted November 28, 2014 Share Posted November 28, 2014 Too bare to be that useful for a official module. IF I had time Id do a full featured template batch editing. Access is only minorit. .. but other settings are often more needed. Link to comment Share on other sites More sharing options...
einsteinsboi Posted November 28, 2014 Share Posted November 28, 2014 Nice work Adrian, I can see this coming handy, and as a good foundation to add on to Will do some testing later today Link to comment Share on other sites More sharing options...
Soma Posted November 28, 2014 Share Posted November 28, 2014 Yeah super cool something like this should be in core just more complete and with fields too. Monster 1 Link to comment Share on other sites More sharing options...
adrian Posted November 29, 2014 Share Posted November 29, 2014 I am sure lots of very cool things could be done, all of which will require a little more than the 5 mins of planning and 20 mins of coding I put into this one Here is a revised version (with a new name) with about an extra 15 mins of coding that adds support for batch adding/removing of fields from templates. I think I might actually make use of this version quite a bit. EDIT: I don't think "Template Setup Batcher" is the right name - not really about setting up templates from scratch. Oh well - maybe change again if a newer version ever happens ProcessTemplateSetupBatcher.module 6 Link to comment Share on other sites More sharing options...
verdeandrea Posted December 3, 2014 Author Share Posted December 3, 2014 Adrian, great, thanks! This is exactly what i needed. I'm going to test it deeper tomorrow. Guys, i've never found a community so caring, i wish i could be more helpful in the future. 1 Link to comment Share on other sites More sharing options...
netcarver Posted May 10, 2016 Share Posted May 10, 2016 @adrian Any chance of adding this (and any other non-repo'd modules) to the module repo? Would make them easier to find. 2 Link to comment Share on other sites More sharing options...
adrian Posted May 10, 2016 Share Posted May 10, 2016 @adrian Any chance of adding this (and any other non-repo'd modules) to the module repo? Would make them easier to find. I guess I have always been hesitant to put anything into the modules directory that is put together this quickly / still in alpha / or has limited use. That said, I do agree it can be hard to find these - some of which can still be very useful. I feel like it would be more appealing if the modules directory had a pre-alpha tag, or some other way to indicate that a module is not of a certain quality. The other problem with being the directory is that it will get picked up my the Upgrades module and if substantial upgrades are made, a module may have the potential to break someone's site. This is something I would consider very carefully with an officially released module, whereas posting one like this, I feel like this is less of a concern because I can notify users more easily in the thread and they need to manually update. I think the modules directory (and the upgrades module) really needs the ability to specify a "breaking changes" warning, along with the ability to display a list of the commit notes from the currently installed version to the latest available one. Do you have any thoughts on this idea? Link to comment Share on other sites More sharing options...
netcarver Posted May 10, 2016 Share Posted May 10, 2016 Actually, we could just start a thread (and pin it) in the modules forum that collects all known "non-repo'd" modules shown up by a google search of the forum and github. Might be more appropriate. 1 Link to comment Share on other sites More sharing options...
adrian Posted November 30, 2016 Share Posted November 30, 2016 @netcarver and others, just wanted to let you know that the functionality of this module is now available as an action in my new Admin Actions module: 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now