Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
coding-topic
Adding/removing group permission from specific forum
Avatar
Melanie Nelson
Member
Free Members
sp_UserOfflineSmall Offline
Feb 27, 2013 - 12:46 pm

Summary:

I'm trying to sort out of using sp_activate_auth()/sp_deactivate_auth() are the functions I'm looking for to activate/deactivate a group permission on a button click, instead of going to the forum admin and adding/removing permission sets from forums.

TL:DR;

The site I'm working on has administrators (like me) that want to handle everything on the site, but we will have Editors that we want to keep out of the forum settings.  But at the same time, they HAVE to have access to a particular set of forum settings.  I've written a function that pulls in assigned forums to the profile page for these users.  The idea is, they can turn forum access off and on by checking a box and updating their profile.

So far, I have this working great *except* I need to figure out what function will add/remove a group permission from a forum.  So, the process would be:

User edits profile, checks a box relating to the forum they want to turn on, updates profile, and now the group has access to the specific forum.

What happens behind the scene is that my function takes the checkbox value (which contains the usergroup ID) and applies that usergroup to the forum in question. I.e. the same process as going to the back end, clicking "Forums > Add Forum Permissions" and adding (or removing) that usergroup to the forum.

would sp_activate_auth()/sp_deactivate_auth() be what I'm looking for?

 

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 27, 2013 - 1:43 pm

No - those are not right. They are used to create an individual 'auth' or permission - usually called from a plugin that is adding new ones.

I reckon what you need is the routine called:

spa_add_permission_data($forum_id, $usergroup_id, $permission_id)

However - this is only disclosed on the Admin side of things so you would need to 'include' the code file. Take a look at it. You will find it in the plugin /admin/panel-forums/support/spa-forums-save.php.

Will this do it for you?
(Steve - am I right here?)

andy-signature.png
YELLOW
SWORDFISH
Avatar
Melanie Nelson
Member
Free Members
sp_UserOfflineSmall Offline
Feb 27, 2013 - 2:16 pm

Thanks! I'll give it a shot :)

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 27, 2013 - 3:33 pm

Let us know...

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17361
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625