× Joomla Facebook Connect support forum

Topic-icon Posting to FaceBook

Active Subscriptions:

None
15 years 4 months ago #7114 by bobmeetin
Replied by bobmeetin on topic Posting to FaceBook
Alex, If my head wasn't spinning adequately before, then it's definitely working up to speed. I coped in the code and it spits back a syntax error:

Parse error: syntax error, unexpected T_SL in /home/$account/public_html/scripts/write_to_facebook.php on line 28

That's the line with "echo <<"
I've seen the echo and EOT stuff before but rarely used in the last 20+ years. I would rather implement a simple if/else logic statement than some javascript. Other than copy/paste I don't do JavaScript. I'm capable of messing up the paste part even.
The topic has been locked.
Support Specialist
15 years 4 months ago #7116 by alzander
Replied by alzander on topic Posting to FaceBook
The EOT isn't as common, but it works. You could simply do the following as well (if you're in a template file):
if ($jfbcLibrary->getUserId()) // Check if Facebook thinks there's a user logged in 
{ 
?>
<script type="text/javascript">FB.ui( ...
       } 
     ); 
</script> 
<?php
}

Once you're 'outside' of PHP, whatever is written will just go to screen as if you echoed it.

As for avoiding Javascript, I don't think you're going to be able to do that unless you want to redirect the user to a new page to give permission. The Javascript API is the only way to create pop-ups on the screen, and the code I gave should work to present a "Post To Wall" pop-up. If you want different code for the grant stream_update permission, I can get that as well. Again, I haven't tested the above, but if you remove the EOT and simply place the code inline, you may have better results.

Let me know how you'd like to proceed. I prefer PHP too, trust me, but not sure you'll be able to do what you want with it.
The topic has been locked.
Active Subscriptions:

None
15 years 4 months ago #7118 by bobmeetin
Replied by bobmeetin on topic Posting to FaceBook
Alex, Getting real close, real close. The wham bam got punched in the face. It seems that FaceBook has a limit of somewhere between 10-12 per some period, perhaps 24 hours or some undefined day in their timezone of the moment. So to do any meaningful work during the day I need to be working multiple FB accounts which of course I have. Gotta love it.

Now apparently I need to set up a counter as well as an explanation regarding the limit or the member is going to seeing a FaceBook Error message and screaming what the hey. This was supposed to be fairly simple, yes? This has saga written all over it.
The topic has been locked.
Active Subscriptions:

None
15 years 4 months ago #7120 by bobmeetin
Replied by bobmeetin on topic Posting to FaceBook
BTW - I downloaded the new version, the component. Do I also need to download and install new plugins and modules?
The topic has been locked.
Support Specialist
15 years 4 months ago #7122 by alzander
Replied by alzander on topic Posting to FaceBook
Depends on what version you are upgrading from. There's a much improved "Extension Check" area in the main overview page now, so I'd recommend installing the main component, then hitting the Overview page and see what else is out of date. Then, just install those.

The 3.1 release (if you're using 3.0) has the addition of Profile plugins, so if you were integrating with JomSocial, CB, etc, you'd want to download and install that plugin as well. After that, it will be very similar to what you're used to.

As for the limits, yes, Facebook tries to prevent abuse of their system and users. I'm not sure of a good way to get around that (tracking times for each user could be a pain). That's one of the reason I was recommending not posting to the wall through PHP, since it's 'silent' and Facebook checks that stuff. If it's a pop-up, and the user has to approve the post, I don't believe there's a counter on that.

Good luck, and keep us posted with your progress!
The topic has been locked.
Active Subscriptions:

None
15 years 4 months ago #7161 by bobmeetin
Replied by bobmeetin on topic Posting to FaceBook
The topic has been locked.
Active Subscriptions:

None
15 years 4 months ago #7190 by bobmeetin
Replied by bobmeetin on topic Posting to FaceBook
Alex, hmmm. Thought I'd added this note yesterday, but that was then. A little more progress, quite a bit more actually.

See: www.jtest.us/index.php?option=com_conten...le&id=92&Itemid=228#

Ignore the Email option. Click on the Share this link. The idea is that there will be some canned text that the person will wish to post. Since I don't know how to pre-fill a FaceBook comment dialogue, I can do it this way with the help you've provided. All the member needs to do is sign-up, sign-in if necessary, check a box and click submit.

The other method you suggested using echo <<<EOT, I tried that (in the left menu on the home page it's option write_to_facebook2), but it is returning nothing, not FaceBook dialogue. I'd like to get it working to compare.

Question: Using JFBConnect Login module I have the redirect set to Home page for both login and logout. Also in the component I set up FaceBook Login Redirection Settings to point to Home. Neither of these are recognized if you log in with the login module. Is this by design, or other?
The topic has been locked.
Active Subscriptions:

None
15 years 4 months ago #7245 by bobmeetin
Replied by bobmeetin on topic Posting to FaceBook
Any idea yet on the redirection question?
The topic has been locked.
Support Specialist
15 years 4 months ago #7299 by alzander
Replied by alzander on topic Posting to FaceBook
The posting's pretty slick. I like the notification and everything that you put up. Looks good.

As for the the Stream Publish pop-up, it looks like the FB variable (which is the Javascript library) isn't defined by the time that code is called (at page load). There's 2 options. First is easiest.. create a button <input type="button" onclick="javascript:showPopup();" value="Post to Wall" /> and then add function showPopup() { ... } around the whole Javascript function I sent. Again, instead of EOT, you can just close PHP and whatever's not within the PHP tags will display, like so:
if ($jfbcLibrary->getUserId()) // Check if Facebook thinks there's a user logged in 
{ 
?>
<input type="button" onclick="javascript:showPopup();" value="Post to Wall" />
<script type="text/javascript">
function showPopup()
{
       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> 
<?php }

That code has the button and function declaration around the FB.ui code... and no pesky EOT :)

The redirections you mention don't sound to be by design, because they don't seem to be working right from what you say. The login parameters in the JFBCLogin module are ONLY for users logging in with Joomla credentials, and have no effect on Facebook Users. The settings in the component affect Facebook users that log in, and if you're using them, make sure that you have "Enable Login Redirection" and "Enable Logout Redirection" enabled directly above where you set the menu item to go to. If they are disabled, the user will remain on the same page they logged in/out from, which is what I'm seeing happen on your site.

If that doesn't help, let us know, or if you need anything else, you know where to find us! Please keep us posted on how things progress for you. Some of the features you're putting in, we're planning to make easier in upcoming releases.. sorry your grinding your teeth on it now, but it's looking good!
The topic has been locked.
Active Subscriptions:

None
15 years 4 months ago #7365 by bobmeetin
Replied by bobmeetin on topic Posting to FaceBook
Re Redirection - meaning that when using the FaceBook connect login the setting have no effect. Okay I'll live with that.

JFBCLogin does not seem to be working correctly. You can see this on all my pages on www.jtest.us under the API menu left column or more specifically, www.jtest.us/index.php?option=com_conten...cle&id=63&Itemid=174

Regarding the code for showPopup, I think I need to stay with what I have mostly working. Introducing more JavaScript is just going to make my head spin faster.
The topic has been locked.