Skip to:
Content
Pages
Categories
Search
Top
Bottom

Social 0.1.8 by Utkarsh Kukreti


  • bbrian017
    Participant

    @bbrian017

    I see that one of my members is using a theme named Social 0.1.8 by Utkarsh Kukreti.

    When people comment it continues to grab here picture and not the commentators.

    Any suggestions to why this is happening?

    In her admin cp it’s showing the users avatar but on her blog the avatars are all hers.

    Thanks,

    brian

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

  • Tynan Beatty
    Participant

    @junsuijin

    i had a similar problem when filtering bp avatar fetcher.

    Brian,

    Could you post a link to the site or message me?


    bbrian017
    Participant

    @bbrian017

    Hi Utkarsh Kukreti I have never seen your reply I will message you now.


    paulhastings0
    Participant

    @paulhastings0

    This is a core BP problem, so it’s not the theme. This will be fixed for 1.2.2. It only occurs on sub blogs, not the root blog.


    paulhastings0
    Participant

    @paulhastings0

    Well actually I’ve gone through all of my themes and edited the comments.php file. I found all the code like this:

    <?php foreach ($comments as $comment) : ?>

    <li class="comment <?php echo $oddcomment; ?>" id="comment-<?php comment_ID();$ix++; ?>"> ">#

    <?= $ix; ?>

    <!-- display avatars -->

    <?php if (function_exists('get_avatar')) { ?>

    <?php echo get_avatar(get_comment_author_email(), '32'); ?>

    <?php } ?>

      

    <?php comment_author_link() ?>

    Says:

    <?php if ($comment->comment_approved == '0') : ?>

    <?php _e('Your comment is awaiting moderation.');?>

    <?php endif; ?>

    <small class="commentmetadata">" title="">

    <?php comment_date('F jS, Y') ?> <?php _e('at');?> <?php comment_time() ?>

    <?php edit_comment_link('e','',''); ?>

    </small>

    <?php comment_text() ?>

    <?php /* Changes every other comment to a different class */

    if ('alt' == $oddcomment) $oddcomment = '';

    else $oddcomment = 'alt';

    ?>

    <?php endforeach; /* end for each comment */ ?>

    and replaced it with code the following code:

    <?php wp_list_comments(); ?>

    Then I went through my css files and changed them accordingly. Big pain but it worked for now.

    I found a solution for my version of the problem and learned a few things along the way that might help with your BuddyPress avatar problems.

    Full text at: http://luke.gedeon.name/buddypress-wrong-avatar-fix.html

    What I found:

    In the file /wp-content/plugins/buddypress/bp-core/bp-core-avatars.php, lines 344 and following contain the following code:

    global $authordata;

    if ( is_object( $user ) )

    $id = $user->user_id;

    else if ( is_numeric( $user ) )

    $id = $user;

    else

    $id = $authordata->ID;

    if ( empty( $id ) )

    return $avatar;

    I think that last “if statement” may be there to catch cases where the commenter does not have a BuddyPress account (which is the majority on my site at this point). However, if you look closely at the block just above the “if ( empty( $id))” you will notice $id is never going to be empty at this point.

    That suggests two possible solutions.

    Solution 1:

    I have not tested this, but it makes sense that you could move the last “if statement” above the first “if statement.” That way you can check for “empty( $id )” before it gets set to”$authordata->ID”

    Solution 2:

    I found it works quite well to add these lines just under the last “if statement.”

    if ( is_string( $user ) )

    return $avatar;

    This will catch any case where an email is sent as input, which is what all (most) non-buddypress themes send. Cases where numbers or objects are sent (the BuddyPress method) will be handled normally.

    Maybe I can get this added into the next release of BuddyPress.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Social 0.1.8 by Utkarsh Kukreti’ is closed to new replies.
Skip to toolbar