Topic-icon Questions about Open Graph Custom Actions & Objects with JFBConnect

Active Subscriptions:

None
Hello... Thanks for the fantastic components and plugins... I have learned a lot about the open graph after going through all your docs and tutorials. I do, however, have a few questions!... Maybe they will help others implementing jfbconnect as well?... Or perhaps I just missed something?!... Anyway:

So my first question is related to this page of your docs:
www.sourcecoast.com/jfbconnect/docs/face...ph-actions-in-joomla

"For actions that aren't automatic, like Joining a Group or Uploading an Image, you can use the Activity Log in the Open Graph area of JFBConnect to see what actions have been posted."

How can I trigger a custom action like that? In the example you have... the read article action is set to trigger on page load... I have a custom MANUAL action... So it doesn't just trigger on page load.... I would really like a button that triggers the action if possible? Can you explain how to do this? I am guessing that I need to use something like this

{SCOpenGraph... }

within the article /item ... But I cannot figure it out?... It would be really helpful (my 2 cents) if you took the documentation just a step further and explained how you can trigger/test a custom action within an article... or in my case k2!

Thanks again for helping!
Ryan
The topic has been locked.
Support Specialist
Ryan,
First off, great to hear you're learning. Facebook integration is incredibly in-depth, and we hope we've made it at least approachable. Before I go off and answer your questions in more depth, if there's any feedback you have on documentation, configuration, prettier icons, or anything else we might be able to do clarify or ease configuration and setup of Facebook for your Joomla site, we'd love to know it. We're always listening and trying to add powerful, yet easy to use, features.

As to your question. There's a few answers. For the 2 actions you mention (joining a group and uploading a photo), we were specifically talking about JomSocial. OurOpen Graph plugins right now have some defined actions for each extension (joining a group/uploading a photo for JomSocial; commenting/voting for K2; leaving a review in jReviews; etc). For those, you just need to configure the action that's already been defined and associate it to the corresponding object from the same plugin. When you set it as a "Manual" action (as you should), it will be triggered 'manually' whenever the user 'does' that action. Hope that makes sense...

Now, more in-depth, and what I think you're looking for even more, is adding your own action that may not already be defined by our plugins. Well, this is more difficult right now, but still possible.. depending on what you want to do. If you want an action to post when a user 'does' something in another extension, you may need to either create (or modify) an open graph plugin to add that action or implement it in the extension itself.

If you're looking to add a button to a page that a user can click to post an action, that's much simpler, though not implemented as easy as an {SCOpenGraph ...} tag.. yet. That's in the works. Going along with a cooking recipe, here's how you'd add 2 buttons for "I'm Preparing" and "I'm cooking" so that a user could read the recipe and click those buttons at different stages of the process:
* FB APP: In your FB App, create the actions of "preparing" and "cooking"
* FB APP: Create an object of "recipe" (or article or whatever you want to call it on your site) and associate those actions to it
* JFBConnect: Create the Object type of article or recipe for a Joomla article (assuming you're putting the recipes in a standard article)
* JFBConnect: Create a "New Custom Action" for "cooking" and "preparing". Set them to "manual" and associate each with the object you created above.
* JFBConnect: Take note of the 'id' of the Action(s) in the right-most column of the Actions list.

Now, you're object/actions are setup, you just need to trigger them. To do so, add the following HTML to a custom HTML module, your template, or wherever else you'd want to display a button/text link that the user can click:
<a href="#" onclick="jfbc.opengraph.triggerAction('234','http://yoursite.com/link-to-page');">I cooked this!</a>
234 = The Action ID
You can replace the "I cooked this!" with an image or anything else you want there.

With that, once clicked, the same popup that we use for read actions will appear for the user. The biggest issue (and a reason we need an {SCOpenGraph ..} tag) is that the button won't change when clicked.. so there's no (easy) way to have an "Congratulations!" button that is displayed after the user clicks "I cooked".

That code above isn't directly tested and may have an issue, but if you make it that far.. post (or Private Message) a URL and we can help debug from there.

Hope that all makes sense. In the first stage of Open Graph Actions for Joomla, we were shooting more for the defined actions for extensions. The next steps (after a few more issues are ironed out) is to flush out the more 'custom' actions like described above.

Sorry for the long post. I'll likely be using this as the first-draft for the "How to make Custom Open Graph Actions" guide that we'll be posting soon.. so thanks for being the guinea pig! As already mentioned... thoughts, comments, and feedback are welcome.

Good luck, and hope your brain isn't about to explode,
Alex
The topic has been locked.
Active Subscriptions:

None
Wow... Thanks for the thorough reply Alex... It was exactly what I was looking for... I will keep my notes coming on the docs... :)

Good news... My brain didn't explode yet.... I was able to follow along and implement the code you provided with the "trigger" onclick! I can now see items showing up in the activity log when I click the button I created... I do not, however, see these actions/objects appearing anywhere in facebook yet?...

So to recap... I am able to create a test user in Facebook... login to my site with the test account... and then click the "trigger/action" button I created... Then I can go to the backend and see everything in the activity log... But... nothing in facebook? Am I missing something else?

Also... I see what you mean about not having a callback or whatever... so after I clicked my button I wasn't sure if I had actually clicked it because there was no message... or effect... although... I could possibly fake it with jquery or javascript?! no?

I know I am pushing the limits here a bit... I am happy to help test / report along the way if it helps!...

Thank you again for taking the time to help!

Ryan

NOTE: I am using k2... I will PM you a link to the site!... It's in development so feel free to login / do whatever... I can get you can account setup if you would like as well?
The topic has been locked.
Active Subscriptions:

None
One thing to note... My k2 profile also shows a list of my completed actions (as it should I believe) with links to the objects that are associated to each action....

UPDATE: I FOUND THE ACTIONS/OBJECTS IN THE ACTIVITY LOG ON FACEBOOK... I JUST COULDN'T SEE IT IN THE MAIN TIMELINE EARLIER SO I ASSUMED IT WASN'T GETTING BACK TO FACEBOOK... I AM GUESSING IT'S BECAUSE I HAVEN'T HAD THE ACTIONS APPROVED BY FACEBOOK YET?

NOTE: I am seeing an error while doing some of the testing with the test accounts that says,"An active access token must be used to query information about the current user."... It's like the access token is only good for one page load with test users... anyway... Progress!!! :)

I am pretty sure that there is an error elsewhere... it appears that on new account
The topic has been locked.
Support Specialist
Glad you made it that far, and my late night, last post, made sense :) Also awesome that it seems to be working pretty well. A few quick notes:
* There should be the 'blue box' popup saying an action was posted to your Timeline when you click the button. The button itself won't change, but the popup should appear. We actually use the same Javascript code for our 'read' functions, simply set to a timer. So, it should do the same thing as the timed actions (like reading). If not, let us know.
* The action won't always appear on your News Feed. It will go to your Activity Log, which is the Timeline of all of your actions around the web/Facebook. From there, Facebook can choose to show it in your feed, your friends feed, the ticker on the right, or other places. In the Activity Log, you can click the white-circle and use the drop-down to force the action always (or never) on your own Feed.

The Active Access Token thing is a bug with Facebook. It was an issue a month ago as well and we worked around it. It sounds like it may be back, and is something we're looking into. Let us know if it persists; we're doing more tests as well.

Anyways, keep me posted on anything you're looking to do and/or need assistance with. We love to have users pushing the edge as we know this is the next area we need to make easier. Your feedback and experience will help shape the documentation and next revision(s) of JFBConnect. Thanks!

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

Alex
The topic has been locked.
Active Subscriptions:

None
Hey Alex... Yeah I noticed you were working a long one... I saw you online in the AM then again LATE at night answering my question!... Thanks!

SO... I am not seeing any blue indicator box telling me that an action has occurred? However I am still seeing the actions posting to facebook and now even in the timeline!... :) I would like to get that dialed out if possible!... and secondly registration / login has a few kinks it appears... Maybe you would be so kind as to try it from wherever you are?... I am curious if it's just a fb test user problem on my end.... or maybe a cache issue? or if it happens to you...

I couldn't get reCaptcha to work... It told me the captcha was incorrect every time I attempted it... I tried refreshing the image in the captcha... clearing my caches... restarting... etc... and it kept rejecting input :-/ I finally settled and turned it off.... But now I am a little concerned about spam?

In all honesty I am not totally sure how it should function yet... I just know that I had problems with the captcha... and with it off... It seems I can register via JFBConnect....

Thanks again for helping!

Ryan

PS... I left a glowing review in the JED
PSS. I PMed you a link to the site
The topic has been locked.
Active Subscriptions:

None
So I did some more testing... Here is where I am at:

JFBConnect does appear to login existing FB users correctly.... and also reCaptcha is working (Sorry about the confusion on that... must have been a funky issue when I was testing)....

Problem:
1) New FB Test users can register ok... and then after it shows the default joomla error blue at the top saying that they were connected successfully... and if I use my fb action "Clip It" right then.... it works... But after the first page load I am forced to "Connect" my account again... the login on the sitebar changes back to the connect button as well.... Then after I connect a 2nd time it appears to work between page loads!... Hope that helps? I can make a user for you if necessary?

Thanks again...

SMALL NOTE: When you fail a validation field on registration I am being redirected to the default registration... not back to the nice 50/50 layout from the jfbConnect component!
The topic has been locked.
Support Specialist
Ryan,
You already left a review. Do you think we're really going to help anymore? :D

Seriously though, that's some super sleuthing on the logout issue. That problem is something that we definitely have overcome for returning logged in users, but we'll be investigating over the next few hours here to see why our workaround isn't.. working.. for newly registered users. It's hopefully just a line of code here or there. We'll provide what we find, and are hoping to get a new rollup bug-release out in the next few days, and definitely want this one in there.

It's definitely not anything to do with test users specifically though, it's likely with any new user that's just been registered on your site.

Beyond that:
* Glad you got the captcha going. Wasn't sure what could be wrong there.
* We'll be looking into the blue box popup as well. If there's something we can find quickly, we'll get it in the next release.. if not, we'll still provide code once we get it, it may just be a few days.
* What?!

SMALL NOTE: When you fail a validation field on registration I am being redirected to the default registration... not back to the nice 50/50 layout from the jfbConnect component!

That doesn't sound right at all. What validation is failing? Can you tell me what error message is displayed, so we know what we need to do to fail and get redirected wrong? My guess is that it may be (again) your captcha.. when it fails, it may be hard-coded somewhere to redirect to the standard Joomla reg page (incorrectly). Not sure, but it's a guess.

Thanks again for all your feedback,
Alex
The topic has been locked.
Support Specialist
A few quick updates:
Trigger Action link improvement
Update the link you're using to trigger the action to look like:
<a href="javascript:void(0)" onclick="jfbc.opengraph.triggerAction('33', 'http://site.com/page')....
Using javascript:void(0) instead of # for the href will prevent some jumpiness you may have seen when clicking it.

Pretty blue box
Edit the /libraries/sourcecoast/openGraphPlugin.php file. Around line 200, you'll see:
//TODO: Replace this with the behavior framework call used in J2.5+ (after J1.5 support is dropped)
        if ($actionAdded)
        {
            JHTML::_('behavior.mootools');
            // Include our CSS file for styling the popup
            $doc = JFactory::getDocument();
            $doc->addStyleSheet(JURI::base() . 'components/com_jfbconnect/assets/jfbconnect.css');
        }
Remove the if statement and { } altogether, so it looks like:
//TODO: Replace this with the behavior framework call used in J2.5+ (after J1.5 support is dropped)
            JHTML::_('behavior.mootools');
            // Include our CSS file for styling the popup
            $doc = JFactory::getDocument();
            $doc->addStyleSheet(JURI::base() . 'components/com_jfbconnect/assets/jfbconnect.css');
That will ensure Mootools and our stylesheet are loaded on your site. Mootools is required for the OG Action to happen at all. The Stylesheet will make the pretty blue box be... well, pretty blue and in the center of your page. Right now, the text is probably appearing at the very bottom of your page, and you're just not even aware.

Trying to recreate the logout issue still, so no word there. Hopefully will have something soon.

Thanks,
Alex
The topic has been locked.
Support Specialist
Oh yeah, quick questions regarding the access token message.
* Is it regularly repeatable (pretty much always happens)
* To test, how are you re-registering:
Are you deleting the user in Joomla first?
Are you removing the application from the Joomla test user?
Are you just creating new test user's and trying again?
* Once the new user is registered, are you navigating to different pages, or staying on the same page to click the button for the action?

Not sure if you even know how to recreate it best, but once we can narrow things down a bit, hopefully we'll know what the heck is going on and get a solid fix in.

Thanks!
Alex
The topic has been locked.