Theme Permissions
PermalinkUsing the Domain Mapping Addon I am attempting to setup a service that allows for the creation of Landing Pages. So far everything is working perfect except that I cannot find a way to restrict what Themes a user can access.
Thanks.
bummer :(
EDIT: Never mind I found it. Just removed the Admin check from the their permissions.
There you can check and uncheck what people are allowed to do.
Best way to do this is create a user account and test the impact of your changes to be sure they are what you want.
1. Create an user_attribute available_themes it's a multi select dropdown.
2. enable advanced permissions to restrict page_types User-/Groupbased or generally
3. copy the concrete/elements/collection_theme.php to elements/collection_theme.php
4. In line 142 and following you need to wrap the themes list into a conditional. here's an example:http://pastie.org/1079362
Idk if it's bugfree but this gives you the idea on howto restrict themes on a user basis.
I hope this + a nice Backend interface to add remove available themes from a user's account is soon available.
http://pastie.org/1079477
Just replace Lines 142-155 with the above code and it works.
One thing I found odd is that there is anew line character in the Theme name value for some reason. Trim() fixed that though. Not sure if this is the best way to handle it but it works.
Thanks a ton Fernandos for pointing me in the right direction and helping with the code.
So here is the fix.
http://pastie.org/1079536
<?php $u = new User(); Loader::model('user_attributes'); if ($u->isRegistered() && $u->getUserID() != 1) { $u_attrkey = UserAttributeKey::getByHandle('available_themes'); $ui = UserInfo::getByID($u->getUserID()); $u_attr = $ui->getAttribute($u_attrkey); foreach ($u_attr as $available_theme) { $at[$available_theme->ID] = $available_theme->value; } if(count($at)==1){ unset($at); $at[$u_attr->ID] = $u_attr->value; } foreach ($tArray as $t) {
You can either allow them to assign themes or disallow them to access the themes.