Support Forum
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?
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?)
YELLOW
SWORDFISH
|
1 Guest(s)