Skip to:
Content
Pages
Categories
Search
Top
Bottom

is_admin for group admin, can’t find it?

  • @nit3watch

    Participant

    I’m trying to restrict modifying/editing of groups by on a group admins with a if else statement ( bases on a user lvl ( current_user_on_level( $level_id ) ) ) but I can’t find 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?

Viewing 9 replies - 1 through 9 (of 9 total)
  • @boonebgorges

    Keymaster

    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 ) )

    @mercime

    Participant

    “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

    @nit3watch

    Participant

    @boonebgorges @mercime Think this would work?

    http://pastebin.com/ZZv97ATa

    ps: current_user_on_level( $level_id ) is a built in function

    @nit3watch

    Participant

    nope didn’t work

    @boonebgorges

    Keymaster

    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.

    @nit3watch

    Participant

    @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 )

    @boonebgorges

    Keymaster

    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.

    @nit3watch

    Participant

    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.

    @nit3watch

    Participant

    @boonebgorges thinking about it and your way makes sense. Thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘is_admin for group admin, can’t find it?’ is closed to new replies.
Skip to toolbar