Skip to:
Content
Pages
Categories
Search
Top
Bottom

Finding the admin of the group which the user belongs to.


  • nikhilnaik
    Participant

    @nikhilnaik

    Hello to all!

    I am looking for a code snippet which can help the user identify the admin of the group to which he belongs to. The reason being, we have implemented a mentor-mentee system. So, when the mentee logs in, would require the name of the mentor to display on the dashboard. The mentor is the admin of the group and the mentee is the part of that group.

    Every mentor is the admin of only one group and every mentee is a part of only one group. So,I wanted to take the following approach : Firstly, using code snippet, identify the name of the group to which the mentee belongs and then identify the admin of that group. Kindly help.

    Thanks in advance

Viewing 1 replies (of 1 total)

  • nikhilnaik
    Participant

    @nikhilnaik

    I got this code snippet which gives the names of the groups to which the user belongs to –

    <?php 
    $group_ids = groups_get_user_groups(bp_displayed_user_id());
    foreach($group_ids["groups"] as $group_id) { 
    	echo(groups_get_group(array( 'group_id' => $group_id )) -> name . (end($group_ids["groups"]) == $group_id ? '' : ', ' ) ); 
    	}
    ?>

    Now, just need to get the link for the group and find the admin for the same.

Viewing 1 replies (of 1 total)
  • The topic ‘Finding the admin of the group which the user belongs to.’ is closed to new replies.
Skip to toolbar