Skip to:
Content
Pages
Categories
Search
Top
Bottom

How To: Add default BP avatar to customized wordpress theme


  • TheOfficialSeoGURU
    Participant

    @theofficialseoguru

    Hello,

    The wordpress version I am using is 4.0.1
    The BuddyPress version I am using is 2.1.1

    I am trying to display the user avatar that is being displayed by the BuddyPress plugin for EVERYTHING else except for what I need to use it for LOL.

    The problem is the theme I’m using does not recognize the the BuddyPress call to the avatar. The code the theme is using is:

    <?php echo get_avatar(CustomUser::$data['user']['ID'], 200); ?>

    I keep trying to add bp_ in front of get_avatar but then it doesn’t display anything. I have also removed the info between the ()

    I do not understand php that well and do not understand calling functions and getting them to display that well, but I have been known to copy and paste my way to glory sometimes.

    I have found the “get avatar” functions in some of the function files of BuddyPress and tried to paste them into my functions file but I always get errors.

    Please keep in mind I am a total php newb and will need a little guidance on where and how to apply the code. for example I found this one post that might have helped a couple days ago that said something like just paste get_function_shmitty_avatar, then the OP was like GREAT AWESOME OMG this worked so wonderful… and I still have no clue where to paste or how to correctly paste the php code, that was also for integrating the BB forum pics too. So anyways…

    Thank you in advance for your time and assistance in helping me with this.

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

  • danbp
    Moderator

    @danbp

    Hi @theofficialseoguru,

    titling a support topic with Help please – How to…. is gentle, but ouf of need on a help forum. And for sure not a waranty to get help.

    As you have an understanding problem of php, and a supposed theme issue, it would be very helpfull to give its name and some details where to show the avatar.

    Apparently your theme use a custom function à la WordPress to get avatars. And this should work, in theory.

    Have you synced wp users with bp in bp’s settings ?
    Have you tested with one of wp’s default twenty theme ?

    Depending where to show a user avatar, BuddyPress use different code. You can see this on most of the template files stored in /bp-templates/bp-legacy/buddypress/

    On the member header for example; you have bp_displayed_user_avatar( 'type=full' );
    There is also a filter: bp_get_member_avatar;
    So it really depends where and how you want your avatar… In a loop, outside of a loop, etc

    Ah, and when you give a topic example, don’t forget to mention the link.


    TheOfficialSeoGURU
    Participant

    @theofficialseoguru

    Hello, and thank you for your quick response.

    First I definitely agree Help Please – How To: in a how to topic of a help forum may be a little redundant but the reason I did that is because I wanted an individual that knew how to fix this to not over look the post because they thought I was informing others on how to add an avatar as there are tons of people asking similar questions, but each person needs it for a different use, for example forums or what not.

    Also as far as the php and avatar issue, once again you are correct. There are so far two areas I have found that I will need to display a user avatar. the user header and the search page for members of the site

    I was currently working on trying to get the user avatar inside the individual member header of the user that is viewing their own profile.

    I do know that I will need to also do the same thing for the user to view another individuals profile but I figured if I was given the exact php function for the bp_get_avatar and told where to put it in the default themes function I am using I would know what to look for when doing it for the other peoples profile avatar. I found the php code for grabbing and displaying avatars but I dont know what to do with it, or even if it is the right code.

    But there are multiple variations of the code in different function files found through out BP so I dont know what to paste where 🙂

    Sync Profiles: Yes I have synced the profiles in the bp settings
    Testing with twentytwelve: I have just added the following code

    <?php do_action( 'bp_before_member_header' ); ?>
    
    <div id="item-header-avatar">
    	<a href="<?php bp_displayed_user_link(); ?>">
    
    		<?php bp_displayed_user_avatar( 'type=full' ); ?>
    
    	</a>
    </div><!-- #item-header-avatar -->

    I added this code to the header.php and also single.php file and nothing was displayed

    the two codes you added are the two codes that I am looking to find out how to display where ever I need through out my theme 🙂 !!!

    For example the 1st one you provided is the main persons header and the second one is to display the “members” page where they show who is all online.

    So my question to you is, what code do I add to my functions page in order to paste those codes you provided anywhere I need to through out my theme?

    Thank you for your time!


    TheOfficialSeoGURU
    Participant

    @theofficialseoguru

    @danbp if you can help me resolve this I will pay you for your time… thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How To: Add default BP avatar to customized wordpress theme’ is closed to new replies.
Skip to toolbar