Skip to:
Content
Pages
Categories
Search
Top
Bottom

Show location for “New Members” entries in activity stream


  • pixieblitz
    Participant

    @pixieblitz

    Hi!

    I have “City” and “State” as required additional profile fields. What would be the best way to change things so that in the activity stream, instead of showing “Jane became a registered member 42 minutes ago” it shows “Jane from City in State became a registered member 42 minutes ago”? I would prefer to modify a template or add a new function rather than installing an additional 3rd party plugin.

    Thanks!

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

  • shanebp
    Moderator

    @shanebp

    Use this filter hook and write a function:
    apply_filters( 'bp_members_format_activity_action_new_member', $action, $activity );
    Found in : ...plugins\buddypress\bp-members\bp-members-activity.php

    For example, untested:

    function pixie_new_member_activity( $action, $activity ) {
    
        $user_id = $activity->user_id;
    
        // assuming the field names are State and City
        $state = xprofile_get_field_data(  'State',  $user_id,  'comma' ); 
        $city = xprofile_get_field_data(  'City',  $user_id,  'comma' ); 
    
        $userlink = bp_core_get_userlink( $user_id );
        $action   = sprintf( __( '%s from %s in %s became a registered member', 'buddypress' ), $userlink, $city, $state );
    
        return $action;
    }
    add_filter( 'bp_members_format_activity_action_new_member', 'pixie_new_member_activity', 10, 2 );

    pixieblitz
    Participant

    @pixieblitz

    That was perfect, THANK YOU SO MUCH!!!

    Activity

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