From inside of the group, to check if the logged in user is the group admin,
if ( bp_group_is_admin() )
Elsewhere:
if ( groups_is_user_admin( $user_id, $group_id ) )
“the function where by if your are member it just displays the group or if you are the admin of the group it displays the group setting and so on”
That’s how it is already set up actually. If I didn’t get what you meant though, you can also use https://wordpress.org/extend/plugins/buddypress-restrict-group-creation/ or check source code for more info.
edit – too slow mercime
@boonebgorges @mercime Think this would work?
http://pastebin.com/ZZv97ATa
ps: current_user_on_level( $level_id ) is a built in function
I don’t really get what you’re trying to do with that code. Those admin pages are blocked from regular group members by default. You shouldn’t need any additional code to do that.
@boonebgorges Im using a membership plugin that assigns a level to a user based on if he has paid yet, with this level value he can now create a group ( sorted restricting this already ), if he stops paying, he’s level is demoted and can’t continue updating/editing his group.
So when he pays, he gets level ‘1’, he cant afford it any more so he gets he’s lvl taken away and cant update the group untill he has paid again, ( got he’s level back )
So I need to restrict editing/updating a group to admins and based on he’s user lvl?
Hope thats clearer
current_user_on_level( $level_id )
When someone gets to the level in question, why not just make them the admin of the group? groups_promote_member( $user_id, $group_id, ‘admin’ ). Then groups_demote_member when they lose their level. Fewer checks to the database that way too – no need to load user level on each group page load.
its a bit complicated with recurring billing and other member levels, If I could just restrict admin privileges of a group, specific to the admin of the group based on the assigned level, I would be happy.
@boonebgorges thinking about it and your way makes sense. Thanks