Skip to:
Content
Pages
Categories
Search
Top
Bottom

Member avatar for blog – code, please ?


  • patg221
    Participant

    @patg221

    Hello, all,

    I’ve been through the forum, and have found many posts concerning member avatars, blog avatars etc.

    I understand that changing the blog avatar is not possible yet…

    What I would need to achieve (urgently?!) is the following:

    – in the blogs directory, I would need each blog to show the members avatar (the author – I only have one author per blog) , and in, say, the standard size of 150×150 px. (or larger if at all possible?)

    It seems that this would entail adding an additional query in the blogs loop… Could someone kindly post the necessary code for this ? I’m sure this would be helpful to MANY of us.

    I’m building a network of blogs for artists… and, as we wait for a solution to the blog avatars issue, this is the workaround that I’m trying to implement.

    Of course, if any other soution is readily available, please let me know…

    And, if I’ve missed something, please forgive me… and point me in the right direction.

    With many thanks,

    Pat

Viewing 5 replies - 1 through 5 (of 5 total)
  • The bit you’d want to change is /[membertheme]/directories/blogs/blogs-loop.php line 16, the call to bp_the_site_blog_avatar_thumb().

    I’m too tired to figure out how to get the author/owner ID from the blog ID. If we could figure that out, you’d just change that bp_the_site_blog_avatar_thumb() function call appropriately and it would be easy, though you would be changing a core file (making future BP upgrades a PITA).

    That’s the quick way. A better way would be to make use of the filter called ‘bp_get_blogs_blog_avatar_thumb_BLOGID’. In something like bpcustom.php, you would somehow get WPMU to return an array of all the blog IDs on the site. You’d then be able to write one function and call it via add_filter and then do exactly the same as in the “quick way” above.

    Hopefully someone else can dig in and suggest how to get the author ID from the blog ID, then you can decide which to go for. I’d recommend the latter solution – though more complicated to do, saves time later.


    patg221
    Participant

    @patg221

    Many thanks, DJPaul !

    You wrote : “I’m too tired to figure out how to get the author/owner ID from the blog ID. ” … funny, that’s exactly the point where I started feeling really tired too, and got stuck !!! :-D

    Yes, hopefully someone can pitch in with a suggestion ?

    Many thanks again for your answer, and kind regards,

    Pat


    Burt Adsit
    Participant

    @burtadsit

    You need to get the owner of the blog, then get the avatar for the owner. Something like:

    $blog = new BP_Blogs_Blog($blog_id);

    $av = bp_core_get_avatar($blog->user_id);

    bp_core_get_avatar() has lots of options. Or $user = new BP_Core_User($blog->user_id) for even more stuff related to the user who owns the blog.


    peterverkooijen
    Participant

    @peterverkooijen

    Where would you put the code Burt Adsit suggested? Could that go straight into blogs-loop.php? Or a custom function somewhere?


    4274483
    Inactive

    Wondering the same as Peterverkooijen…

    Where does the code from Burt Adsit goes?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Member avatar for blog – code, please ?’ is closed to new replies.
Skip to toolbar