Skip to:
Content
Pages
Categories
Search
Top
Bottom

creating an email token for the recipients profile url


  • nella1980
    Participant

    @nella1980

    Hi guys,
    After trying different options, I’m wondering if this is even possible. I would like the recipient’s name and avatar in (new private message received) emails to be a link to their own profile page. I’m not sure if this is not working because it’s fired off in the header of the email template or if I’m not creating the token correctly. Can anyone please guide me in the right direction? The code below is not working. Any help or guidance would be immensely appreciated, I’m at my wits end…

    do_action( 'bp_before_email_recipient' );
    
    if ( bp_is_email_customizer() ) {
        $user_id = '{{recipient.userid}}'; // Placeholder for user ID token
    
        // Generate the user's profile URL based on the user ID
        $user_profile_url = bp_core_get_user_domain( $user_id );
    
        // Display the clickable link with user's name
        echo '<a href="' . esc_url( $user_profile_url ) . '">{{recipient.name}}</a>';
    
        // Display the user's avatar
        echo '<img src="' . apply_filters( 'bp_email_customizer_default_avatar', bb_attachments_get_default_profile_group_avatar_image( array( 'object' => 'user' ) ) ) . '" width="34" height="34" style="border: 1px solid #b9babc; border-radius: 50%; margin-left: 12px; vertical-align: middle;" />';
    } else {
        bp_email_the_salutation( $settings );
    }
  • You must be logged in to reply to this topic.
Skip to toolbar