Hi alzander,
I managed to get jfbconnect script loading differently. I sent this message to jomcomments support in hopes that they can assist me with getting this to work.
Here is what I sent them:
I am using Facebook Connect Api to Connect users with my site. Upon installing JFB Facebook Connect Component, In Internet Explorer 8 I started getting 2 error. At first it would not show the
comments on my site and sometimes it would.
I figured out that the php code below which is part of JFB Connect Component was causing the comments not to show because it seems that jomcomments was being blocked or not loading before
this code or onload.
echo
<<<EOT
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({appId: '{$this->facebookAppId}', status: true, cookie: true, xfbml: true});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/{$locale}/all.js';
document.getElementById('fb-root').appendChild(e);
}());
function fb_login_button_click()\n
{
if (FB.getSession())
{
self.location = "{$optionPermsUrl}";
}
}
function fb_logout_button_click()\n
{
{$logoutCall}
}
function redirect_to_jfbconnect_logout()
{
self.location = '{$logoutLink}';
}
</script>
EOT;
What I did to fix this is use a javascript method like this instead:
Which loads after jomcomment’s javascript
echo
<<<EOT
<div id="fb-root"></div>
<script type="text/javascript">
(function() {
window.fbAsyncInit = function()
{
FB.init({appId: '{$this->facebookAppId}', status: true, cookie: true, xfbml: true});
};
function async_load(){
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = document.location.protocol + '//connect.facebook.net/{$locale}/all.js';
document.getElementById('fb-root').appendChild(s);
var x = document.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
}
if (window.attachEvent)
window.attachEvent('onload', async_load);
else
window.addEventListener('load', async_load, false);
})();
function fb_login_button_click()\n
{
if (FB.getSession())
{
self.location = "{$optionPermsUrl}";
}
}
function fb_logout_button_click()\n
{
{$logoutCall}
}
function redirect_to_jfbconnect_logout()
{
self.location = '{$logoutLink}';
}
</script>
EOT;
This solved the IE issue and got the comments to show again.
Okay now for the real issue and I hope I can get a fix for this ASAP.
I am using jomcomments plugin to display the comments by unique id and in the code for
templates/pastel/index.tpl.html
I added a checkbox code that would detect if you are a facebook user and display a Post to Facebook Check Box, right next to the Submit Comment Button:
<button id="jc_submit" onclick="addComments(); return false;" class="button" >_JC_TPL_SUBMIT_COMMENTS</button>
<?php
$jfbcLibraryFile = JPATH_ROOT.DS.'components'.DS.'com_jfbconnect'.DS.'libraries'.DS.'facebook.php';
if (!JFile::exists($jfbcLibraryFile)) {
echo "JFBConnect not found. Please reinstall.";
return;
}
require_once ($jfbcLibraryFile);
$fbClient = JFBConnectFacebookLibrary::getInstance(true);
$fbUserId = $fbClient->getUserId(TRUE);
$sitenamex = JRequest::getVar('sn', '0' );
?>
<?php if($fbUserId): ?>
<img src=http://remembered-dev.com/images/fb_comment_icon.png />
<input type="checkbox" name="cposttofb" checked="checked" />Post to Facebook
<input type="hidden" name="sitename" value="<?php echo $sitenamex; ?>" />
<?php endif; ?>
This code above would reference the facebook library and detect $fbUserId and display the checkbox as stated above.
Now in main.jomcomment.php
I added at the top of the code:
include_once ($cms->get_path('root') . '/components/com_jfbconnect/libraries/facebook.php');
And in function ajaxAddComment($xajaxArgs)
I added:
$post_to_fb = $data->cposttofb;
$the_sitename = $data->sitename;
$fbClient = JFBConnectFacebookLibrary::getInstance();
$fbUserId = $fbClient->getUserId(TRUE);
$dbx =& JFactory::getDBO();
$tableName = $dbx->nameQuote('#__records');
$sql = "SELECT fname,lname,dateof_birth,dateof_death,biography,pathof_photo,gender FROM ".$tableName." WHERE sitename = '$the_sitename'";
$dbx->setQuery($sql);
$rowx = $dbx->loadRow();
$fname = $rowx;
$lname = $rowx;
$dateofbirth = $rowx;
$dateofdeath = $rowx;
$shortbiox = $rowx;
$memphoto = $rowx;
$genderx = $rowx;
if($memphoto == NULL)
{
if($genderx == "male")
{
$memphoto = "/images/male-default.png";
}
if($genderx == "female")
{
$memphoto = "/images/female-default.png";
}
}
$statusx = 'posted a comment on '.$fname.' '.$lname.'\'s Wall';
if($post_to_fb=="on")
{
$fbClient->setFacebookComment($statusx);
}
Right before
# store the new comment into database
if ($status == JC_STATUS_OK) {
$data->store();
}
What this is supposed to do is get the info and post it to facebook user’s wall, which it does, but then fails to save the coment.
The error is that once I post a comment it only shows in facebook wall and it doesn’t get stored into our db and the loading/ajax icon stays and doesn’t go off.
The only time it saves is if I do a refresh of the page right after posting it.
IE then throws:
Syntax Error
ajax_1.2.js
Code:0
Firefox shows a message:
api-read.facebook.com : server does not support RFC 5746, see CVE-2009-3555
And this error:
missing ; before statement
URI :
onlinememorials.remembered-dev.com/plugi...includes/ajax_1.2.js
<script type=”text/javascript”>
I don’t know why its not returning and posting the comments. You can log into my site with jfbconnect, click a memorial or select “onlinememorials” from the Online Memorials listing on the side and then go to Memorial Wall and post a comment to see the error. Like the one above.
I am using Joomla Latest Version 1.5.22 and would like some assistance on getting this solved.
Ivan