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.
[FIXED] Following Plug-In, not showing friends pictures
Anyone else have this issue? When I follow someone, it adds them as a friend and I can view the count in my profile. However, is the friend I'm following has an avatar, then is just shows a corrupted img file.
Seems to be missing the correct link to the image. This plugin also does not show the gravitar (from gravitar plug-in). Anyone else having this same issue?
Seems to be missing the correct link to the image. This plugin also does not show the gravitar (from gravitar plug-in). Anyone else having this same issue?
1
This discussion has been closed.
Comments
If you have found a fix, please let me know. It's a bit annoying to see broken images on a smooth forum... sticks out like a sore thumb!
Any ideas on a fix?
In plugins/Following/class.followingmodule.php, change:
<img src="<?php echo Url('uploads'.DS.'n'.$User['Photo'], TRUE); ?>" />
to
<img src="<?php echo Url($User['Photo'], TRUE); ?>" />
...which removes the "uploads/n" portion of the image url.
It occurs twice, at lines 62 and 83. I'm not experienced in Vanilla plugin development, but it looks like the plugin expects a relative url based in the uploads folder, but it's actually getting an absolute url from $User['Photo'].
here is my solution:
After the foreach in line 58 and 79 add
$pieces = explode("/", $User['Photo']);
And replace the
<img src="<?php echo Url('uploads'.DS.'n'.$User['Photo'], TRUE); ?>" />
with:
<img src="<?php echo 'uploads'.DS.$pieces[0].DS.'n'.$pieces[1] ?>" />
So it will look like something like this:
foreach ($Followees as $User) { $pieces = explode("/", $User['Photo']); ?> <div> <a title="<?php echo $User['Name']; ?>" href="<?php echo Url("profile/{$User['UserID']}/{$User['Name']}", TRUE); ?>"> <img src="<?php echo 'uploads'.DS.$pieces[0].DS.'n'.$pieces[1] ?>" /> </a> </div>
Don't forget to repeat step for the second foreach in the code.
PS. There could be better code out there than mine :P
After a small dig...
In plugins/Following/class.followingmodule.php, replace:
<img src="<?php echo Url('uploads'.DS.'n'.$User['Photo'], TRUE); ?>" />
with:
<img src="<?php echo 'uploads'.DS.ChangeBasename($User['Photo'], 'n%s'); ?>" />
There are two occurrences in the file.
<img src="<?php echo Url('uploads/' . ChangeBasename($User['Photo'], 't%s')); ?>" />
The function ChangeBasename is how applications/dashboard/controllers/class.profilecontroller.php does it