Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to remove bp_member_latest_update from the member’s page


  • tackleb0x
    Participant

    @tackleb0x

    Hello,

    I would like to modify the default Member’s page to remove the “bp_member_latest_update”. Currently the page shows the list of members, not including the “Admins”. I achieved this by adding the following function to the functions.php page:

    add_filter( 'bp_after_has_members_parse_args', 'buddydev_exclude_users_by_role' );
     
    function buddydev_exclude_users_by_role( $args ) {
        //do not exclude in admin
        if( is_admin() && ! defined( 'DOING_AJAX' ) ) {
            return $args;
        }
    
        $excluded = isset( $args['exclude'] )? $args['exclude'] : array();
    
        if( !is_array( $excluded ) ) {
            $excluded = explode(',', $excluded );
        }
    
        $role = 'administrator';//change to the role to be excluded
        $user_ids =  get_users( array( 'role' => $role ,'fields'=>'ID') );
    
        $excluded = array_merge( $excluded, $user_ids );
    
        $args['exclude'] = $excluded;
    
        return $args;
    }

    The page shows the default behavior: Avatar, Name, Latest Activity (with a link that reads “view”), and the last active time.

    I would like to remove/hide the latest activity (including the word “view”) from the list altogether. Any ideas on how I could achieve this? Perhaps with a snippet to add to the functions.php file?

    I have the following installed:
    BuddyPress – 2.9.1
    WordPress – 4.8.2
    Theme – Buddy (child)

    I appreciate any help in advance!

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

  • shanebp
    Moderator

    @shanebp

    Create a template overload of this file:
    buddypress\bp-templates\bp-legacy\buddypress\members\members-loop.php

    And then remove this code from the overload:

    <?php if ( bp_get_member_latest_update() ) : ?>
    
    	<span class="update"> <?php bp_member_latest_update(); ?></span>
    
    <?php endif; ?>

    tackleb0x
    Participant

    @tackleb0x

    OK. That sounds easy enough! I would assume (you know what happens when you assume), that I could do something like that on the actual member’s profile page? Right underneath the name, and photo, the same latest update appears. What file would I work on for that one?

    Thanks for the help!


    shanebp
    Moderator

    @shanebp

    Did you look in the single template files?
    buddypress\bp-templates\bp-legacy\buddypress\members\single\


    tackleb0x
    Participant

    @tackleb0x

    Thanks. Yes, it was in members\single folder. I forget the exact file, but it had something to do with the words “member header”. I didn’t actually perform the change, my friend did. I appreciate the help. This ticket can be closed.

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