× Joomla Facebook Connect support forum

Topic-icon Posting to FaceBook

Active Subscriptions:

None
15 years 4 months ago #6905 by bobmeetin
Replied by bobmeetin on topic Posting to FaceBook
Alex, Thanks! This is indeed good news. I ran over to my test website, logged in as comrade dmitri, then clicked on the write_to_facebook page, braced myself, logged into FaceBook as dmitri, and like magic it worked. We have liftoff!

You disabled Jomsocial FaceBook Connect. Perhaps that one time long ago when I thought I had it working maybe it was before I'd enabled it as well, don't remember. You know however that there is a caveat to this solution. We are counting on using Jomsocia FaceBook Connect to import the most recent FaceBook message (also avatar if changed), so if we use JFBConnect that breaks.

Thus back to my other post: www.sourcecoast.com/forums . You said "monthish" when you replied to it. I would be happy to disable Jomsocial FaceBook Connect if JFBConnect served both needs. Looking back at the live site moments ago it looks like Jomsocial FaceBook Connect took another casualty. I installed the most recent Kunena on the live site which includes a Mootools upgrade. To get Kunena's bbcode to work I had to disable the old system Mootools and I'm thinking maybe this fried Jomsocial again. The Mootools stuff has already lead to a world of inconsistency. I feel like a ping pong ball.

It would be a good world to get JFBConnect working and get off reliance of Jomsocial Connect.

There is one other thing that kind of throws me. If I have been logged out, then click on JFBConnect the FaceBook screen flashes then logs me in as whomever it remembers. This probably won't happen in real life much, but if I want to log in as someone else from this computer I need to clear my history. One of Cookies, Cache or Recent Logins (this is Firefox). This might result in some other tickets in the future.
The topic has been locked.
Support Specialist
15 years 4 months ago #6907 by alzander
Replied by alzander on topic Posting to FaceBook
Glad to hear it worked.

As for needing JomSocial, we understand, the status import is important. I'll still sick by the month'ish statement for importing the status from Facebook to a user's JomSocial profile. We're investigating the pushing of status from JomSocial to Facebook still. As for avatar, we already update that if a user updates it in Facebook.

That's not fun about the Mootools upgrade. We've written our stuff to use minimal Mootools, and try to make it 'gracefully' fail where possible, so that shouldn't be too much of a problem with us, but no guarantees as we're adding more Javascript functionality in future releases.

As for the logging in, if you disable the the "Automatically log the user in" setting, it won't log you in if you're logged into Facebook in another tab. Yes, that can be confusing, but it hasn't been much of a problem because 1) most people only have one Facebook account and 2) if they have more than one, they probably aren't both registered on your site. That way, even if they switch in the background and come back, the 2nd (non-registered user) won't be auto-logged in. It's usually more confusing for the admins who are testing functionality out.

Hope that helps, and we hope to meet all 100% of your needs soon, instead of the 99% right now. Good luck!
The topic has been locked.
Active Subscriptions:

None
15 years 4 months ago #6948 by bobmeetin
Replied by bobmeetin on topic Posting to FaceBook
Alex, I'm going to need to implement the changes on the live site. If you can either tell me the files modified so that I can ftp them or get me a working prelim of the bug-fix component by email or ftp location that will help. If you need folks to help out in testing from time to time, it appears that I'm good for that. -Bob
The topic has been locked.
Support Specialist
15 years 4 months ago #6949 by alzander
Replied by alzander on topic Posting to FaceBook
The change is quite simple. The file is /components/com_jfbconnect/libraries/facebook.php. You can either copy this from the site I fixed up above, or you can make the following change in the file:
At about like 380 is the following line:
if ($facebookUpdateStatusMessage && $message)
Change it to:
if ($message)

We obviously missed this weekend for the 3.1.2 release. There's one other minor bug we're working on implementing. The target is still tomorrow (Monday) or Tuesday, if we run into any issues with the last bug.

Thanks!
The topic has been locked.
Active Subscriptions:

None
15 years 4 months ago #6966 by bobmeetin
Replied by bobmeetin on topic Posting to FaceBook
I tested it on the live website just a few minutes ago and "it worked!" Presto and major bravo. Your comment, "There's one other minor bug we're working on implementing." That's interesting, most developers prefer not to implement bugs. If you are, why waste your time on minor ones? :)

Do you have any plans on a plugin option for the login function? Something like FaceBook Connect Login with options? This would be a nice bonus - nice to be able to place an FConnect login anywhere you want on a website.

So you say that Jomsocial FConnect and JFBConnect are mutually incompatible. Is that only the case if they are both used/implemented on the same page or is it true incompatibility?
The topic has been locked.
Support Specialist
15 years 4 months ago #6973 by alzander
Replied by alzander on topic Posting to FaceBook
Har har :) We figured out the bug and squashed that sucker. 3.1.2 is available now.

As for the plugin for login functions, I think we already have what you're looking for in the JFBCLogin {} tag. Just put that anywhere on your site and the blue button will magically appear. For more info, see:
www.sourcecoast.com/jfbconnect/docs/configuration-guide

If that's not what you're looking for, and we'll help you out.

As for JomSocial and JFBConnect, yeah, they're incompatible for multiple reasons. One is that, on the same page, you can't have 2 javascript events fire when a user logs in.. and since both components need to do something when a user logs in, that's a problem. Additionally, each component has it's own table for mapping which Joomla User is connected with which Facebook user. I think there are some ways that you may be able to keep some JS FB capabilities while using JFBConnect, but it's not something we test, and I wouldn't guarantee anything. If there's a specific feature you're looking for, let us know!
The topic has been locked.
Active Subscriptions:

None
15 years 4 months ago #6975 by bobmeetin
Replied by bobmeetin on topic Posting to FaceBook
Special feature - yeah - make mootools backwards compatible. Now back to what you're capable of. That was the function I looked for earlier on your site but couldn't find, {JFBCLogin}. Unfortunately it works not on either of my websites. See www.jtest.us/ scroll down the left column. And you thought this thread would end some day!
The topic has been locked.
Support Specialist
15 years 4 months ago #6993 by alzander
Replied by alzander on topic Posting to FaceBook
Sorry, should have clarified. The JFBCLogin tag is only available in the 3.1.x series of JFBConnect that was released earlier this month. There's a bunch of minor changes and improvements in this release, and we'd recommend upgrading. That's a straightforward process as well:
www.sourcecoast.com/jfbconnect/docs/

Hope this helps, and we don't mind long threads. They prove we respond to support :)
The topic has been locked.
Active Subscriptions:

None
15 years 4 months ago #7108 by bobmeetin
Replied by bobmeetin on topic Posting to FaceBook
Sooo close we are. Yes I am able to use the API to post activities to FaceBook successfully. However what is lacking is an if/else test. I thought that was the purpose of stream_publish but I can't figure out how to implement this in my PHP. I set up a couple changing variables so that FaceBook doesn't balk thinking I'm just resubmitting by accident. The FB.Connect.showPermissionDialog - I don't know how to use this. It errors out if I uncomment it (not php?).

The goal is to be able to first check that the FaceBook connection is open and if yes I will display a connection good message and if not, I will post a message saying that you must sign into FaceBook to use this function.

-Bob

<?php
$rand = substr(md5(uniqid(rand(),1)),3,8);
$date = date("Y-m-d-H-i-s");

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
#FB.Connect.showPermissionDialog('publish_stream', null); // not sure how to use this.

if ( $stream_publish == "1" )
{ $msg = "Success because you are logged into facebook<br />"; }
else
{ $msg = "Post failed, you must use JFBConnect first to connect with Facebook.<br />"; }

echo "stream_publish: $stream_publish <br />";
echo "Response: $response <br />"; // found in components/com_jfbconnect/libraries/facebook.php
echo "Message: $message <br />"; // found in components/com_jfbconnect/libraries/facebook.php
echo "Msg: $msg <br />";

$comment = "Posting this message ($rand) via write_to_facebook.php ($date)";
$jfbcLibrary->setFacebookMessage("$comment");

echo "<br /><h4>Message: <span style='color: #ff0000;'>$comment</span></h4>";
?>
The topic has been locked.
Support Specialist
15 years 4 months ago #7111 by alzander
Replied by alzander on topic Posting to FaceBook
Try the following. I honestly don't know if this will work directly, and will have to do a little research if not. The FB.Connect code you're trying to use is Javascript, not PHP, and it's from the 'old' FB Javascript library which may or may not work (it's slowly being deprecated). The below uses the new Javascript library code, which should work.. but again, no testing yet on our end..
if ($jfbcLibrary->getUserId()) // Check if Facebook thinks there's a user logged in 
{
echo <<<EOT
<script type="text/javascript">FB.ui(
       {
         method: 'stream.publish',
         message: 'Message here.',
         attachment: {
           name: 'Name here',
           caption: 'Caption here.',
           description: (
             'description here'
           ),
           href: 'url here'
         },
         action_links: [
           { text: 'Code', href: 'action url here' }
         ],
         user_prompt_message: 'Personal message here'
       },
       function(response) {
         if (response && response.post_id) {
           alert('Post was published.');
         } else {
           alert('Post was not published.');
         }
       }
     ); 
</script>
EOT;
}

That should actually put up a pop-up with a message pre-populated that any user (regardless of whether they're logged into FB) can post to their wall. We're working on some Javascript for a future release to make this stuff much, much easier to include on a page.. but the above was copied from these 2 locations which may help you:
Code snippet:
stackoverflow.com/questions/2724977/usin...with-just-javascript

Facebook developer reference:
developers.facebook.com/docs/reference/javascript/FB.ui

The EOT stuff above is just an easy way to echo a lot of text without have to put single or double-quotes everywhere, in case you didn't know.

I know you asked for getting the stream_publish permission, and not actually posting to wall, but this may be a good solution for you. In this case, since the user has to approve the message, stream_publish permission isn't required. If you want the code for just getting the stream_publish (so that you can silently post in multiple place), let us know.

Good luck, and definitely let us know how it goes!

Edit: Updated the code to add the script tags, woops.
The topic has been locked.