Skip to:
Content
Pages
Categories
Search
Top
Bottom

SHOW GROUPS ADMINS


  • diegomiguel05
    Participant

    @diegomiguel05

    Hello, I hope someone could help me, please.

    I need that any user of my site could contact the administrators of others groups directly (even others private groups which the users don’t belong to). So, is it possible in the groups directory of BuddyPress to show the administrators of each group next to groups titles and its details?

    Thanks in advance.

Viewing 4 replies - 1 through 4 (of 4 total)

  • shanebp
    Moderator

    @shanebp

    You can use this hook: do_action( 'bp_directory_groups_item' );

    For example, this will display a link to the first admin for each group:

    function diego_add_group_admin_info() {
    
    	$group_id = bp_get_group_id();
    	$group_admins = groups_get_group_admins( $group_id );
    
    	$admin_id = $group_admins[0]->user_id; 
    		
    	echo bp_core_get_userlink( $admin_id );
    
    }
    add_action( 'bp_directory_groups_item', 'diego_add_group_admin_info' );

    diegomiguel05
    Participant

    @diegomiguel05

    thank you very much, you have helped me so much.
    it works correctly, however has appeared in editors page (when I add the code that you wrote and after I click on update) the next error text.

    “Something went wrong. Your change can not be saved. Please try again. You may also have to fix it manually and upload the file via http://FTP.”

    so thank you very much!


    shanebp
    Moderator

    @shanebp

    WP no longer allows you to add code in the editor unless it can test the code first – otherwise it throws that error.

    You should not be adding the code in that location.

    You should add it to bp-custom.php or to the functions.php file in your theme or child theme.


    diegomiguel05
    Participant

    @diegomiguel05

    hello, I’ve just tried adding the code on functions.php, but when i’ve opened it, the code has apeared in the section custom functions (where I added it before, using the wordpress theme editor). That’s why I don’t inderstand the error…and your hook also works perfectly, in spite of that error. Anyway I’ve done what you said, and have added it on function.php

    thank you again.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar