Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Avatars and recent discussion WordPress widget

mhk1058mhk1058 New
edited November 2012 in Vanilla 2.0 - 2.8

Just wondering if anyone else with Vanilla embedded in Wordpress has looked into trying to get Avatars to show against the recent discussions/activity pulled into Wordpress by any of the widgets that comes with the WP plugin?

...or if anyone has any idea how to go about it... the plain links look a bit, well, plain!

Tagged:

Comments

  • just tried it myself yesterday. what exactly do you mean with plain? upload en picture if you can

  • mhk1058mhk1058 New
    edited November 2012

    If you use the widget in WordPress to show forum recent activity, it shows a text link with the discussion title. I doesn't have the poster's or recent commenter's avatar next to it... which I would like to do.! Avatars are set and showing in the forum and elsewhere

  • mhk1058mhk1058 New
    edited November 2012

    Thanks, I did try that but it appeared to break my discussions view and no avatars appeared in the widget. The path is OK because if I use the recently active users widget the Avatars show up just fine. The recent Activity widget obviously is not set up to display avatars but I would like it to. So I think the answer lies in modifying the widget but I can't locate the right file.

  • I figured this one out, on line 384 of function.php in the plugin I changed
    $PhotoUrl = ($IsFullPath) ? $User->Photo : vf_combine_paths(array($Url, 'uploads/'.vf_change_basename($User->Photo, 'n%s')), '/');
    to
    $PhotoUrl = ($IsFullPath) ? $User->Photo : vf_combine_paths(array('http://[your_domain]/[vanilla_forum]/uploads/'.vf_change_basename($User->Photo, 'n%s')), '/');

    this makes the image src ignore the option to force the widget to use the embeded url

    I am sure there is a smarter way to accomplish this but it works

  • AaronWebsteyAaronWebstey Headband Afficionado Cole Harbour, NS ✭✭✭

    Old thread I know, but I wanted to show avatars on my recent discussions widget too. I did not have to change functions.php, I only had to change widgets.php. If you go to

    http://YourWordPressSite.com/wp-admin/plugin-editor.php?file=vanilla-forums/widgets.php&a=te&scrollto=1264

    And change this:

    echo '<li>'.vf_user_photo($User, $link_url).' '.'<a href="'.vf_combine_paths(array($link_url, 'discussion/'.$Discussion->DiscussionID.'/'.vf_format_url($Discussion->Name)), '/').'">'.$Discussion->Name.'</a></li>';

    to this:

                $User = (object)array();
                $User->IconWidth = $width;
                $User->Photo = $Discussion->LastPhoto;
                $User->UserID = $Discussion->LastUserID;
                $User->Name = $Discussion->LastName;
                echo '<li>'.vf_user_photo($User, $link_url).' '.'<a href="'.vf_combine_paths(array($link_url, 'discussion/'.$Discussion->DiscussionID.'/'.vf_format_url($Discussion->Name)), '/').'">'.$Discussion->Name.'</a></li>';
    

    It seems to work for me.

  • edited October 2015

    Thank you @AaronWebstey ... It's working fine...
    but avatars of the users who registered with facebook are not loading..

    I fixed it by modifying the function vf_user_photo on plugin's functions.php (line 417) like this..

    if (strpos($User->Photo,'graph.facebook.com') !== false) {
    $PhotoUrl = $User->Photo;
    } else {
    $PhotoUrl = ($IsFullPath) ? $User->Photo : vf_combine_paths(array($Url, 'uploads/'.vf_change_basename($User->Photo, 'n%s')), '/');
    }

Sign In or Register to comment.