× Joomla Facebook Connect support forum

Topic-icon HOW DO I TRIGGER AN OPENGRAPH ACTION?

Support Specialist
11 years 11 months ago #23444 by alzander
Nope, it's working. Clear your browser cache. I just tested after refreshing the Javascript file and it looks right now.

Not sure about the email issue. Try with the new Javascript change which will request the right permissions (including email). Then, if you're still having the email issue, please start a new thread since that's unrelated to this one.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
11 years 11 months ago #23445 by Ivan
ALex,

'You then implement it on your site somewhere and publish it to your Timeline. You can check your history in your Activity Log on your profile.

How do i publish it to timeline?

As for the Javascript bug would this be causing @unknown emails to appear? I have noticed this on my site recently ive been getting these emails when users register?
The topic has been locked.
Support Specialist
11 years 11 months ago #23448 by alzander
This post (from earlier in the thread) describes how we posted to timeline in our testing:
www.sourcecoast.com/forums/jfbconnect/jf...ph-action?p=1#p23235

Yes, if you're using the custom_login() function, it wouldn't request the email permission, which could cause that problem. We just realized the issue when investigating Tadas' issue. We'll likely be releasing an update for JFBConnect later this week. Until then, don't use the custom_login() function (use the standard {JFBCLogin} tag) or update the code as mentioned.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
11 years 11 months ago #23450 by fb_546164587
It appears that permissions are now requested - thanks Alex!

However, now I'm getting a new error:
Facebook API Error: (#3503) "/index.php?option=com_community&view=events&task=viewevent&eventid=4801&groupid=1479&Itemid=238" is an invalid value for property "event" with type "Reference"

I've currently set to publish actions to Timeline on event page visit.

Thanks.
The topic has been locked.
Active Subscriptions:

None
11 years 11 months ago #23463 by fb_546164587
It works!

The problem was caused by the link being incomplete (without domain name):

I fixed the problem by changing the code from:
$args['event'] = 'http://demo.eventhread.com/index.php?option=com_community&view=events&task=viewevent&eventid=4703&groupid=1464&Itemid=238'; 
$fbLibrary->api('me/eventhread:attend', $args);

to:
$args['event'] = 'http://' . $_SERVER['SERVER_NAME'] . '/index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id . '&groupid=' . $event->contentid;
$jfbcLibrary->api('me/eventhread:attend', $args);

Alex, thank you so much for your help!
The topic has been locked.
Support Specialist
11 years 11 months ago #23471 by alzander
Tadas,
How awesome is that!? Glad to hear you got it going, and good sleuthing on finding the full URL problem. I knew that was required, but from your message of the error, I actually just thought you left off the URL to hide it ;)

Either way, Very glad to hear you got it going. The only recommendation I have for your link generation is to use JRoute on the link so that the SEF URL is used (if enabled in your system:
$args['event'] = 'http://' . $_SERVER['SERVER_NAME'] . JRoute::_('/index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id . '&groupid=' . $event->contentid);
Honestly not sure why using the $_SERVER variable is required instead of hard-coding it (I'm assuming they'd be the same), but whatever works works :)

Let us know if you run into anything else or come up with something neat to share!

Finally, if you haven't already, please consider leaving a rating and review on the Joomla Extension Directory for JFBConnect, or our support. It's certainly not required, but very appreciated!
extensions.joomla.org/extensions/social-...ook-integration/7215

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
11 years 10 months ago #23473 by learnthrusong
Hi All,

@alzander 1 consideration/query...

In your last post, you mentioned using JRoute and I wonder, is this the methos JFBC uses for generating links in comment/open graph tags and so on?

The only reason I ask is, I understand from reading the dev docs on FB that once an object url reaches x number of uses, it's canonical url cannot be changed. If there is need to change the Url, it can only be achieved by redirecting. Therefore, I wonder, would it be best to send facebook the raw joomla url (un-sef'd) so that if there are any updates of SEF config, they will not result in having to add manual redirects in for every object?

Best regards,

Gez
The topic has been locked.
Support Specialist
11 years 10 months ago #23477 by alzander
Gez,
That's an excellent point. There's advantages and disadvantages to the raw URL, and it's something we debate a lot about. The SEF is good because it shows up in a Facebook post 'cleanly'. Additionally, it really shouldn't change since that will affect a lot of other things (like Search Engine Rankings, obviously).

A non-SEF URL is also good, since, like you mention, it usually doesn't change at all. However, some SEF extensions will redirect from the non-SEF url to the SEF one. Also, if you have SEF URLs enabled, we might as well use them.

As for your question of how we do it, we use the following call which will attempt to build up the URL from scratch for the 'best' SEF URL. That's not always the URL for the page the user is on, but that's the point.. try to make a canonical, re-creatable one. Our function also strips some extra query string parameters which can commonly be added from various things which can cause duplicate URLs. If you want to use get the same URL for the current page that JFBConnect would create, simply use the following code:
$url = SCSocialUtilities::getStrippedUrl();

Hope that helps, and good luck,
Alex
The topic has been locked.
Active Subscriptions:

None
11 years 10 months ago #23709 by Ivan
Hi Alex,

I have tried to create an action this way in my code:
           	$uri	= 'index.php?option=com_community&view=videos&task=video&userid='.$my->id.'&videoid='.$vid_id;

            $args = array(); 
            $args['video.other'] = 'http://'.$_SERVER['SERVER_NAME'].'/'.$uri; 
            $fbClient->api('me/my_app:upload', $args);  


in my video page i used:
 echo "{JFBCGraph type=video.other}";
 echo '{JFBCGraph url=https://mysite.com/list/videos/video/'.$vid_creator.'/'.$vid_id.'}';
 echo "{JFBCGraph title=".$vid_title."}";
 echo '{JFBCGraph image=http://mysite.com/'.$vid_thumb.'}';
 echo "{JFBCGraph description=".$vid_description."}";


And I get this error:

Error Facebook API Error: The action you're trying to publish is invalid because it does not specify any reference objects. At least one of the following properties must be specified: other.



In my facebook/developers i have

action type - upload
connected object type - video
properties - other - reference - required

the code for videos object type is
 
   
   
   
   
   
   

And this is the code on the videos page that renders the OG tags

 echo "{JFBCGraph type=video.other}";
 echo '{JFBCGraph url=https://mysite.com/list/videos/video/'.$vid_creator.'/'.$vid_id.'}';
 echo "{JFBCGraph title=".$vid_title."}";
 echo '{JFBCGraph image=http://mysite.com/'.$vid_thumb.'}';
 echo "{JFBCGraph description=".$vid_description."}";
The topic has been locked.
Support Specialist
11 years 10 months ago #23725 by alzander
Ivan,
I just tried to create a similar Open Graph object in my app. When I use the "Get Code" button next to the Upload action, it looks like the argument for the video:other property should just be 'other'. So, can you try the following code:
$args = array(); 
            $args['other'] = 'http://'.$_SERVER['SERVER_NAME'].'/'.$uri; 
            $fbClient->api('me/my_app:upload', $args);
Let me know if that helps things. Hopefully that gets you going!

Alex
The topic has been locked.