× Joomla Facebook Connect support forum

Topic-icon Posting to FaceBook

Active Subscriptions:

None
15 years 4 months ago #6715 by bobmeetin
I read this page, www.sourcecoast.com/jfbconnect/docs/common-support-questions , and found the "How do I post to a user's wall from other components?" help. This is useful but it seems to work silently. I've added it to a custom php script. On the page where the member is working I've added a checkbox to post the content to FaceBook. How do I add a PHP if statement to quality that Stream Publish has been granted.

<?php
if ( $stream_publish == "1" )
{ $message = "Success<br />"; }
else
{ $message = "Post failed, you must use JFBConnect first to connect with Facebook.<br />"; }
?>

You get the picture. What do I need in the if clause?
The topic has been locked.
Active Subscriptions:

None
15 years 4 months ago #6736 by bobmeetin
Replied by bobmeetin on topic Posting to FaceBook
Using your code I thought I had the base functionality working, but since yesterday when I hit the form page that should submit the post it is no longer appearing on Facebook. I have tried doing this from 2 websites. If I can get this working on the test website, www.jtest.us, that would be superb.

I reinstalled this test website from scratch this morning, fresh joomla, fresh jomsocial, fresh jfbconnect and plugins, fresh kunena, and a few other plugins including "jumi" which I use for pages which require a php form. I named the menu items according to what I'm testing.

Click on JFBConnect to login to facebook and just see in general if things are working (API etc). To test posting to Facebook I set up "write_to_facebook". If you select that page and do nothing else it will execute a php file called "write_to_facebook.php". You can see the contents by viewing the .txt version. The php file includes your connection/stream code.

Since I don't have any way to check for errors, I can't tell why the messages are not posting. I could use some help with this.
The topic has been locked.
Support Specialist
15 years 4 months ago #6749 by alzander
Replied by alzander on topic Posting to FaceBook
If you're using JFBConnect to post to Facebook, you can enable the "Display API Errors on Front-end" configuration, which should show any errors or issues if they are being reported from the Facebook API.

We did a little research yesterday, and we hope to have something to post shortly. The main thing is that, in the PHP code, you can test if a user has the ability to post to Facebook, but you can't request that permission using PHP. You need to do that through Javascript, so that it prompts the user to grant access. To do that, you'll need to add code like the following to the page:
FB.Connect.showPermissionDialog('publish_stream', null);

Once granted, the 'silent' posting to wall should work without issue, but until that permission is granted, you won't be able to. You can also force the granting of the permission on logging in through JFBConnect.

Hopefully, this will get you going a little more. If you have other questions, let us know, and we'll post more if we get more information for you.
The topic has been locked.
Active Subscriptions:

None
15 years 4 months ago #6765 by bobmeetin
Replied by bobmeetin on topic Posting to FaceBook
Thanks for being responsive and the help thus far. Unfortunately this is still not working. I needed to be sure that it was neither how/where I placed the code, nor the facebook account, so here's what I did:

1) Logged into www.jtest.us as administrator and double-checked - "Display API Errors on Front-end" is enabled
2) On pages, "JFBConnect" and "write_to_facebook" I enabled both JFBCLogin and JFBCFeed.
3) Edited $webhome/modules/mod_jfbcfeed/tmpl/default.php. Just below the "if($params->get('showPoweredByLink'))" function I added the following lines:
<?php
$rand = substr(md5(uniqid(rand(),1)),3,8);
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("Posting this message via mod_jfbcfeed $rand");
echo "<h2 style='background: #ff0000; color: #fff; padding: 5px; margin: 10px;'>mod_jfbfeed</h2><p>I added the code to post to facebook at the bottom of the mod_jfbfeed default.php file (above this text). It doesn't error out, but it also does not post. <strong>Display API Errors on Front-end</strong> is enabled.</p>";
?>
4) So, any time you load this page it should attempt to make a post. I added the $rand because so that Facebook doesn't get confused by you attempting to post the same status message twice. I load either of the two active pages, write_to_facebook in this case
5) The echo statement is there below JFBCFeed module but no FaceBook errors.
6) I logged into the fake account on Facebook, This email address is being protected from spambots. You need JavaScript enabled to view it. - unfortunately I see no post
7) Just to be sure, I created a second account, This email address is being protected from spambots. You need JavaScript enabled to view it., also a test Facebook account, and try there as well. Nothing... The only comment is the one I added when I set up the account.

If you need any images to see that I'm doing this write I'll attach them. If you need an administrative account on www.jtest.us say the word. Do you see anything else obvious?
The topic has been locked.
Support Specialist
15 years 4 months ago #6774 by alzander
Replied by alzander on topic Posting to FaceBook
No, everything you appear to be doing looks spot on. The only other change is possibly that the getUserID function you may want to pass false into:
if ($jfbcLibrary->getUserId(FALSE)) // Check if Facebook thinks there's a user logged in

This will post for any Facebook user, not just ones that are logged into your site. Worth a shot.

Beyond that, feel free to send us a super admin credential to look as well as the paths to any files you've modified and the pages we should see the changes on.
The topic has been locked.
Active Subscriptions:

None
15 years 4 months ago #6783 by bobmeetin
Replied by bobmeetin on topic Posting to FaceBook
Alex, I pm'd you superadmin access information for the site earlier today. Yes the answer is that it's still not working and there are no visual error messages, responses of any sort. If you're off and someone else is watching the fort for the next couple days, "the weekend", let me know who to contact and I'll send joomla access and ftp access if it helps.
The topic has been locked.
Active Subscriptions:

None
15 years 4 months ago #6837 by bobmeetin
Replied by bobmeetin on topic Posting to FaceBook
One other thing, in Facebook there is a function to remove a post. Depending on the type of post it lists various remove options. I believe the fact that the two options that relate to this website are still listed would seem indicate that I haven't accidentally selected either when I deleted extraneous posts last week. The two options:

Remove Publishing Rights of Joomla Fabo Connect Test API
Remove Joomla Fabo Connect Test API

The image from FaceBook will make more sense. Ideas?
The topic has been locked.
Active Subscriptions:

None
15 years 4 months ago #6887 by bobmeetin
Replied by bobmeetin on topic Posting to FaceBook
Is there any update on this problem?
The topic has been locked.
Support Specialist
15 years 4 months ago #6896 by alzander
Replied by alzander on topic Posting to FaceBook
Very sorry for the delay. I'll be looking into this now, and let you know what I find.
The topic has been locked.
Support Specialist
15 years 4 months ago #6898 by alzander
Replied by alzander on topic Posting to FaceBook
Bob,
Apologies again for the delay. I got in, and found a few things. One was definitely a bug on our part that we'll be fixing in the next release (I've implemented on your site already). Basically, we checked before we posted any messages to Facebook that the "Update Status Message:" setting was enabled. This setting is for whether to post to the users wall on registration or login, but shouldn't be used for checking any messages. I think that's just a legacy check and shouldn't be required anymore.

Additionally, before I found that, I saw that JomSocial's Facebook Integration was enabled. That wasn't causing any problems directly, but I disabled it to test. You can't use both JS and JFBConnect at the same time as they overlap in functionality, which will cause some conflicts.

Anyways, you should be all set up. If you need to make the change to another site, I can gladly tell you what I modified. Otherwise, be assured that in the 3.1.2 release (coming this weekend or Monday), the erroneous check will no longer be there.

Thanks for patience, and good luck!
The topic has been locked.