By Brent Williams on Thursday, 11 June 2015
Posted in General Issues
Replies 3
Likes 0
Views 523
Votes 0
I realize that this might not be covered in the forums, but I was hoping you might help.... In EasyBlog, if there is no image in the blog, I was hoping to use the user's avatar as the default image for og:image. I tried altering the classes/facebook.php with this:

$source = $this->fetch( 'blog.avatar.php' , array( 'row' => $row ) );


That didn't seem to work. Is there a way to call the avatar for that particular blog?

Thanks!
Hello Brent,

Try the following code instead and see how it goes.
// Default image using author avatar
$authorId = $blog->author->id;
$author = EasyBlogHelper::getTable( 'Profile' );
$author->load($authorId);
$avatarImage = $author->getAvatar();
$source = $avatarImage;
·
Thursday, 11 June 2015 14:18
·
0 Likes
·
0 Votes
·
0 Comments
·
That's awesome! Thanks!

For anyone else who is interested in this solution, I am currently using JomSocial (although moving to EasySocial in the future), and I wanted to show the full avatar, not the thumb, so I slightly modified Ezrul's code:

		$authorId = $blog->author->id;
$author = EasyBlogHelper::getTable( 'Profile' );
$author->load($authorId);
$avatarImage = $author->getAvatar();
$source = str_replace("thumb_","",$avatarImage);
·
Thursday, 11 June 2015 22:27
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Brent,

Thanks for sharing. Glad that your issue has been resolved now.
·
Friday, 12 June 2015 11:07
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post