By Bob Garbett on Friday, 26 June 2015
Posted in Technical Issues
Replies 11
Likes 0
Views 792
Votes 0
Hi,

Is there a way to make available the OpenGraph Image on a blog post only viewable by registered users ?

I see that the title and the description already are available but not the image
Hi Bob Garbett,

Unfortunately we do not have setting for this.

But you can modify on this file -> JoomlaFolder\administrator\components\com_easyblog\includes\facebook\facebook.php

// LINE 77 under this function
public function addOpenGraphTags(EasyBlogPost &$post)


I see that the title and the description already are available but not the image

I suspect that was cached from Facebook when first time crawler, perhaps you can try copy one of your blog post URL and paste in Facebook debugger tool and see how it goes?
https://developers.facebook.com/tools/debug/
- Make sure your Gzip compression is turn off from your backend > system > global configuration > server
·
Saturday, 27 June 2015 01:08
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for your reply, Well I looked into the source and the to meta tag for title and description are there when I'm on the login prompt to access the item (Maybe another components is creating those tag).

I don't have the path you gave me for the facebook folder but found it in /components/com_easyblog/classes/facebook.php (Maybe a version difference)

Also this method is only applying the OpenGraph tag to the page, so I think I'll have to call this method on the display process right ?
·
Monday, 29 June 2015 18:28
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Bob,

I am sorry for the delay of this reply.

Correct me if I'm wrong. Do you mean that do you want to hide the opengraph tag for non-registered user on your site? If that so you can add the checking where the current user is actually logged in or not by using the following code,
$user = JFactory::getUser();

// Only proceed if user is not guest
if (!$user->guest) {
// show the opengraph tag here
}


If I'm wrong can you elaborate more on your inquiry because to be honest I am not quite understand what do you mean here. Please advise.
·
Tuesday, 30 June 2015 13:18
·
0 Likes
·
0 Votes
·
0 Comments
·
No I do want the open graph data for an article even if the user is not logged in, So what I need is to have the Open Graph tag to display on the page even if for a public user the only thing I'll have will be the login prompt.

So the article are in Registered users only and that cause the login prompt to appear, but I'd still like to have the OpenGraph data on this page
·
Tuesday, 30 June 2015 17:48
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Bob Garbett,

Sorry for late reply to this,

I don't have the path you gave me for the facebook folder but found it in /components/com_easyblog/classes/facebook.php (Maybe a version difference)

Yes, I think your current Easyblog site is using 3.9 version right? If yes, that was the correct file.
Check my screenshot : http://screen.stackideas.com/2015-06-30_2209.png
Do you mean this kind of meta data ?
If yes, you can download my attachment file and replace in JoomlaFolder\components\com_easyblog\classes\facebook.php , so the OpenGraph Image on a blog post only viewable by registered users.
·
Tuesday, 30 June 2015 22:18
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for your answer but I just realised that my question was not correct, in fact I do want the meatadata to be viewable by everyone so that when I crawl this page :
http://www.conciergepro.network/index.php?option=com_easyblog&view=entry&id=6

Even if I have the login prompt it will have the open graph data ready to be crawled
·
Tuesday, 30 June 2015 22:43
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Bob Garbett,

You're welcome,

Oh, I'm really sorry for that because I just got your meaning now, i checked my locally, it shouldn't show the open graph data because it redirect to login page, can you provide us with your Joomla backend and FTP access so we can help you check on this?
·
Tuesday, 30 June 2015 23:03
·
0 Likes
·
0 Votes
·
0 Comments
·
I can provide you a backend access unfortunately we don't have any ftp access

EDIT : I think I got it working for the image with this code in the entry veiw php file :


if($checkIsPrivate)
{
$privacy = $blog->isAccessible();

if( !$privacy->allowed )
{
echo $privacy->error;
if( $config->get( 'main_facebook_opengraph' ) )
{
// Facebook Like integrations
require_once( EBLOG_CLASSES . DIRECTORY_SEPARATOR . 'facebook.php' );
$rawIntroText = $blog->intro;
EasyBlogFacebookLikes::addOpenGraphTags( $blog , $rawIntroText );
}
return;
}
}


Unfortunately looks like the og:title tag is still being ovveriden to another value, not the actual entry title
·
Wednesday, 01 July 2015 17:45
·
0 Likes
·
0 Votes
·
0 Comments
·
hi Bob Garbett,

Sorry for late reply to this,

Do you mean that when the non-logged in user access this page -> http://www.conciergepro.network/index.php?option=com_easyblog&view=entry&id=6 then it show wrong og:title right?

if yes, can you provide us with your Joomla backend and FTP access so we can take a look of this?
If can provide us with your FTP access that would be good because we can open the file and troubleshoot on this.

Also, may i know you only hack for this file right currently? -> JoomlaFolder\components\com_easyblog\views\entry\view.html.php
·
Wednesday, 01 July 2015 19:24
·
0 Likes
·
0 Votes
·
0 Comments
·
Yes the file I modified was components\com_easyblog\views\entry\view.html.php

Let me arrange something for the FTP access and I'll get back to you when it's done
·
Thursday, 02 July 2015 16:54
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Bob,

Okay, keep us updated then.
·
Thursday, 02 July 2015 22:51
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post