× Joomla Facebook Connect support forum

Topic-icon help integrating the "post to wall" feature after a poll vote

Active Subscriptions:

None
Hello there.
i've just purchased jfbconnect and im quite happy with the results im getting into my site.

One left thing is to integrate it into polls such as when an user votes (eg. hits vote button) some text gets posted to his wall.

now, im using the acepolls component and i've found the code bit relative to the poll form:
EDIT: can't get the form code posted correctly, here's a link to the tmpl file www.elexismusic.com/default.txt

Looking into the support docs i've found the following snippet of code to integrate such feature:
require_once (JPATH_ROOT.DS.'components'.DS.'com_jfbconnect'.DS.'libraries'.DS.'facebook.php');
$jfbcLibrary = JFBConnectFacebookLibrary::getInstance(); 
if ($jfbcLibrary->getUserId()) // Check if Facebook thinks there's a user logged in
$jfbcLibrary->setFacebookMessage("mytext");

How i'm supposed to use that code in the form so it's actually triggered after a "push" of the vote button?
Thanks for the help.
The topic has been locked.
Support Specialist
Giorgio,
The code snippet you posted for JFBConnect to post is for us to post to a user's wall silently after an action has been done. For example, after a user's registered or logged in. In your case, to add that code, you'd probably want to add it to the following file (I don't know Acepolls, so I'm guessing this from the file you posted):
/components/com_acepolls/controller.php (or acepolls.php) in a function called "vote"

The alternative, and what we currently don't make as easy as 3 lines of code, as in the first case, is to pop-up a Facebook box with a pre-filled message of "I just voted on...". We're actually starting a little bit of work on the code to make this into a line you can add to existing forms, as in your case, so that when a user hits submit, it will prompt them to also post something to their wall. If that's what you want to do, let us know, and we may be able to help you implement something before we get it into a full release. For more information on what I'm talking about, see the "Dialogs" section (about 1/2-2/3's the way down):
developers.facebook.com/docs/reference/javascript/

Let us know if this helps, and good luck!
The topic has been locked.
Active Subscriptions:

None
Thank you, looking for the vote function on controller.php was the correct way to do what i wanted.


Have an happy easter!

Cheers!
The topic has been locked.
Support Specialist
Great! Keep in mind that you'll only be able to post to user's walls with the method above who have approved your application and are currently logged into Facebook. Anyone that isn't, the above steps should simply do nothing. However, we recommend you test with non-Facebook users and other cases to make sure nothing unexpected happens.

We hope you continue enjoying JFBConnect, and should you need anything else, just let us know!
The topic has been locked.