This topic has 4 replies, 2 voices, and was last updated 8 years by ianll.

  • Author
  • #70597
     ianll
    Participant

    Hello,
    I’m trying to change the member-loop so I can render the member avatar image as a background image. Below is the code I’m trying and have tried so many different codes to no avail. The image url slashes keep getting stripped out or the <img src html is rendered which wont work.

    Any suggestions to the code?

    COPY CODE
    <?php while ( bp_members() ) : bp_the_member(); ?>
    
            <div class="item-avatar" style="background: url("<?php $userid = bp_get_member_user_id(); $avatarurl = bp_core_fetch_avatar(array('item_id' => $userid, 'type' => 'full', 'html' =>false)); echo $avatarurl;?>") center center no-repeat">

    Thank you!!

    #70615
     sharmstr
    Moderator

    Wouldnt the returning just the url be better? bp_core_fetch_avatar_url

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #70616
     ianll
    Participant

    tried that as well and still get the slashes stripped out…

    #70622
     sharmstr
    Moderator

    This works for me

    COPY CODE
    
    style="background-image:url(<?php echo bp_core_fetch_avatar( array( 'item_id' => bp_get_member_user_id(), 'html' => false, 'type' => 'full' ) ); ?>); background-size:cover;"
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #70827
     ianll
    Participant

    Wonderfull! Thanks @sharmstr!

Viewing 5 posts - 1 through 5 (of 5 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?