Jump to content

Recommended Posts

Posted

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();
}
  • Like 6
Posted (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?

post-985-0-71553100-1417191089_thumb.png

Edited by adrian
Attached module removed - newer version posted below.
  • Like 7
Posted

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.

Posted

Yeah super cool something like this should be in core just more complete and with fields too. Monster ;)

  • Like 1
Posted

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 :)

post-985-0-97051400-1417296619_thumb.png

ProcessTemplateSetupBatcher.module

  • Like 6
Posted

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.

  • Like 1
  • 1 year later...
Posted

@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?

Posted

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.

  • Like 1
  • 6 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...