Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=2930)
This mod will allow you to create custom permissions. Custom permissions can be used when one is scripting to include or exclude member groups from doing certain actions or viewing certain pages.
Usage:
Permissions are used in conjunction with the allowedTo() function. Which will return either true or false depending on whether the permission is set for that member group or not. As an example, if you create a permission named view_this then it can be used as such:
if (allowedTo('view_this'))
echo 'Yes, you can see this.';
else
echo 'Nope, say goodbye';
Great mod :).
Great mod. It wouldn't be me if I hadn't a request though: I desperately search for something like that for SMF 1.1.13 (our production forum) - would you possibly be able to implement something like this mod also for the V1 version ???
Thanks Joker. :)
mgrmgr, it will install for both versions.
Quote from: Kays on April 07, 2011, 07:24:11 PM
...
mgrmgr, it will install for both versions.
Thanks for the answer.
Just a tip: mentioning that in the modification description could be a good way to promote this fabulous mod even more :)
Just saw - you already did so :)
Great mod Kays,
Now all I need to do is work out how to add a permission to just one board.
Create a new permission profile and assign it to a board as a first step
Thanks. This mod is only for user permissions and not board permissions.
Plus, if you do create a permission, It does nothing unless you code it in.
If allowedTo() is called on a board, it first attempts to check the related permission in the board.
Yes, but this mod doesn't add to the board permission list. So the board id would need to be checked as well.
Great MOD but I have a little problem.
I've installed it in SMF 2.0 but the permissions are only shown in an own group (custom_permissions) in the classic mode, in simple mode they are not shown in an own group (custom_permissions) but they are added to the basic functionality group.
edit:
Another problem.
When I try to edit the permission description I get an errormessage the permission name can't be the same as an existing permission.
I hope this thread isn't dead. Kays: great mod. Very useful.
But I have the same problem as CapadY, the [Edit] function won't allow an edit to be saved. Unless you modify the permission name, which in effect creates a new permission. Also, I would expect an edit function to allow editing the description. The description field value isn't included in the "edit".
Thank you again for a great mod.
Not dead, just kinda forgotten about. And thanks. :)
Quote from: CapadY on June 25, 2011, 07:25:27 AM
Great MOD but I have a little problem.
I've installed it in SMF 2.0 but the permissions are only shown in an own group (custom_permissions) in the classic mode, in simple mode they are not shown in an own group (custom_permissions) but they are added to the basic functionality group.
This has something to do with how SMF handles permissions added by a mod and from what I've can tell there's no way around it.
Quote from: DanCarroll on March 16, 2012, 06:39:23 AM
Also, I would expect an edit function to allow editing the description. The description field value isn't included in the "edit".
This might be difficult to do since the focus can only be on one field. (I think). Plus if one is to edit a current description I figured it's best to start with an empty field. :)
I did fix the bug when trying to edit a permission and uploaded an updated version.
Hi! again Kays, I wanted to let you know that I just installed your custom permissions mod on my test pc that I have SMF 2.0.2 installed. And I been getting some errors from your mod. and one of the errors I can't remove from the logs. It says.
http://www.toppersbbs.info/smf/index.php?action=admin;area=logs;sa=errorlog;desc=
8: Undefined index: custom_permissions
File: C:/www/vhosts/_static/toppers/smf/Sources/Admin.php
Line: 327
So far this is the only error I'm getting and the one I can't remove
Thanks for that, but I can't reproduce it. And I can't see why it's happening. ???
The problem appears to be a missing $txt string.
'custom' => array($txt['custom_permissions'], 'admin_forum'),
So check Modifications.english.php to see if it is there. But it should be as the other $txt strings added appear to be there
Well I check the installer for your mod, and I guess you do have some thing wrong. That part to show me goes into the Admin.php file. Below is from your installer.
<id>Kays:CustomPermissions</id> <version>1.1.0</version> -<file name="$sourcedir/Admin.php"> -<operation> -<search position="before">
<![CDATA['profiles' => array($txt['permissions_profiles'], 'manage_permissions'), 'postmod' => array($txt['permissions_post_moderation'], 'manage_permissions', 'enabled' => $modSettings['postmod_active']),]]>
</search> -<add>
<![CDATA[ 'custom' => array($txt['custom_permissions'], 'admin_forum'),]]>
</add> </operation> </file>
Could the reason why I'm getting this error is because I'm using it my mod. ?
It could have something to do with your mod. ???
What to do is to add the following to your Admin language file.
$txt['custom_permissions'] = 'Custom Permissions';
Ok, well This got rid of the error. So I don't know. Thanks
Hello,
first of all thanks for the great mod
I now have but one question:
In my SMF version 2.0.4 I've created a few new profile fields manually. These work quite well. Now I wanted to with this mod make it so that only certain groups can fill out these fields and can see.
How do I connect this mod for example in the Profiles-Modify.php with this one:
function tmMap($memID)
{
global $context, $user_profile, $user_info, $txt, $modSettings;
loadThemeOptions($memID);
if (allowedTo(array('profile_extra_own', 'profile_extra_any')))
loadCustomFields($memID, 'tmmap');
$context['sub_template'] = 'edit_options';
$context['page_desc'] = $txt['tmMap_info'];
setupProfileContext(
array(
'pf_design_der_map', ... 'pf_css_a_link_color',
)
);
}
It just does not work as I would like.
Hi, if you only want people with that permission to enter that page. Add the allowedTo() check for that permission before the call to that function.
Or after the globals are defined:
if (!allowedTo('seeThis'))
return;
Thanks for this mod, It is really helpful !
Do you think it can be possible to set specific subgroup ?
I want to create permissions in a new group called "website" and i don't want them to stay under the "Custom Permissions" group.
Thanks !
Hi, permissions apply to which ever group they are assigned to. If you have a problem with inherent permissions, then use deny.
Hi Kays!
This mod is really useful for specific permissions. I want to create permission(s) for Profile view. This permission includes track IP/user and all subactions. In default installation, I can grant IP viewing option by Moderate forum members permission but it comes with extra rights. I want only IP viewing option with subactions.
Thanks in advance
I think what you might need to do is to look for everywhere that the original permission is used and then change it in the appropriate spots to the new permission.
Hi Kays,
Sorry to wake an old topic but I'd like to use this mod on 2.0.15.
It installs but the CUSTOM PERMISSIONS does not show, so I cannot add the permission I want, which is to remove the ability to send emails to any member that allows it for a specific post count group.
The standard permissions allows an ADMIN to turn off PM's but not emails. So a group may have restricted PM access but unrestricted email system access. An alternative would be to restrict the number of emails a certain group can send.
I assumed I could do that with this mod and would be obliged if you could kindly,
a. update the mod to work with 2.0.15 and above.
b. advise how to use the mod to achieve my goal.
Very much obliged for any help you - or indeed anyone else - can offer.
Thanks
Chas