Skip to:
Content
Pages
Categories
Search
Top
Bottom

Email Token to Display a Members Avatar – Error occured


  • vuture
    Participant

    @vuture

    Hello,

    I want to create an email-token to display a member avatar in a bp-custom-mail.

    I tried to implement snippets from this tutorial, but maybe I don’t understand everything correctly.

    1) I created a single-bp-email.php with custom html content which works fine.
    There I can add the output whereever I want the avatar to be displayed <?php bp_email_avatar(); ?>, right?

    2) To my bp-custom.php I added this function:

    function bp_email_avatar() {
      $token = '{{recipient.avatar}}';
      printf( '<img src="%s">', $token );
    }

    Have a look at my bp-custom.php:
    https://1drv.ms/u/s!AikSNhBAk4teugLf_yT-8610eUDC

    $formatted_tokens['recipient.avatar'] = bp_core_fetch_avatar(
      array(
        'object'  => 'user',
        'item_id' => $formatted_tokens['initiator.id'],
        'html'    => false,
      )
    );

    => The last snippet results in a php-error.

    Could you help me to make this work?

    Thanks in advance,
    Chris

Viewing 1 replies (of 1 total)

  • vuture
    Participant

    @vuture

    Hey guys,

    I can’t imagine that this topic “how to get and avatar into bp mails” isn’t interesting for most people using buddypress.

    Isn’t there anyone who can see what I did wrong and how to fix this issue?

    Best regards,
    Chris

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