BuddyDev

Search

Replies

  • Participant
    Level: Initiated
    Posts: 3
    Naveen on #36108

    Thank you Brajesh. This works perfectly fine. Thanks for the excellent support. I would like to buy one of your plugins (Friend Suggestion Pro) and may be request you for some custom development. I will PM you.

  • Participant
    Level: Initiated
    Posts: 3
    Naveen on #35410

    Thank you Brajesh. Yes, I am wrapping it in a div and adding custom class. It is working but image filed is showing up only on the Profile’s Activity Stream but not on Site wide Activity Stream. In fact, it is only outputting the wrapped div element and the class. But the image field output is not echoed at all. The outputted html that I could grab from the browser is as follows:

    
     <div class="activity-avatar item-avatar">
                <a href="https://anvay.online/members/anvay/">
                    <img loading="lazy" src="//www.gravatar.com/avatar/1c7825a86f453ea56735a31959bbd4b0?s=150&r=g&d=mm" class="avatar user-1-avatar avatar-150 photo" width="150" height="150" alt="Profile picture of anvay">                
                    <div class="activity-child-photo"></div>
                </a>
     </div>
    
    

    As you have noticed <div class="activity-child-photo"></div> does not have any img element inside it. However, on Member’s page if I go to the Activity tab, then the img element is getting outputted as follows:

    
            <div class="activity-avatar item-avatar">
                <a href="https://anvay.online/members/anvay/">
                    <img loading="lazy" src="//www.gravatar.com/avatar/1c7825a86f453ea56735a31959bbd4b0?s=150&r=g&d=mm" class="avatar user-1-avatar avatar-150 photo" width="150" height="150" alt="Profile picture of anvay">
                    <div class="activity-child-photo"><img src="https://anvay.online/wp-content/uploads/bpxcftr-profile-uploads/1/image/2.png" alt="" class="bpxcftr-image"></div>
                </a>
            </div>
    
    

    My code is as follows in the file: wp-content/themes/buddyx-child/buddypress/activity/entry.php

    
    <div class="activity-avatar item-avatar">
                <a href="<?php bp_activity_user_link(); ?>">
                    <?php bp_activity_avatar( array( 'type' => 'full' ) ); ?>
                    <div class="activity-child-photo"><?php  echo xprofile_get_field_data( 'Child Profile Photo' , bp_get_member_user_id() ); ?></div>
                </a>
    </div>
    

    Where am I going wrong? How do I get same result in site wide Activity and individual activity page?

    thanks,
    Naveen

  • Participant
    Level: Initiated
    Posts: 3
    Naveen on #35325

    Thank you Brajesh for such a quick response. I found your advise to be very useful. I am able to get the desired output using the following code:

    echo xprofile_get_field_data( 'Child Profile Photo' , bp_get_member_user_id() );

    And then I am using this in nouveau template placing next to avatar image:

    	<div class="item-avatar">
    					<a href="<?php bp_member_permalink(); ?>">
    					    <?php bp_member_avatar( bp_nouveau_avatar_args() ); ?>
    					    <?php  echo xprofile_get_field_data( 'Child Profile Photo' , bp_get_member_user_id() ); ?>
    					    <?php buddyx_user_status( bp_get_member_user_id() ); ?></a>
    				</div>

    And then using CSS code, I am able to position it as overlay on the main profile photo of the user. I am able to achieve this using the class that the field provides (bpxcftr-image). something like this:

    /*childimage*/
    div.item-avatar .bpxcftr-image {
        width: 50px;
        position: absolute;
        bottom: 1px;
        right: 9px;
        border-radius: 50%;
    }

    Is there a possibility to specify our own class to a specific field in the function while rendering? For example, can I specify a class in this function:
    xprofile_get_field_data( 'Child Profile Photo' , bp_get_member_user_id(), 'EXAMPLE-CLASSNAME' )

    This will be useful if I have to use this function in different templates as each template has its own avatar sizes and I need to adjust them accordingly.