× Joomla Facebook Connect support forum

Topic-icon Javascript Issue with Joom Comment

Active Subscriptions:

None
15 years 6 months ago #5796 by Ivan
Hi,

After installing jfbconnect joom comments 3.0.1 has begun to throw an error in IE

Specifically

Error: missing ; before statement
Source File: mysite.com/plugins/system/pc_includes/ajax_1.2.js
Line: 33, Column: 17
Source Code:
<script type="text/javascript">

It seems that since joom comments is ajax based its conflicting with the window.fbAsyncInit in the function initJavascript() php code in jfbconnect. Once i comment this out, it loads joom comment.
The topic has been locked.
Support Specialist
15 years 6 months ago #5803 by alzander
Yes, that is a known issue with JFBConnect v3.0.2 that will be fixed in the upcoming 3.1 release. If you want to make some minor modifications to your existing JFBConnect installation, you can follow the (pretty easy) instructions in the thread below:
www.sourcecoast.com/forums/topic?id=1366&p=1#p5386

Sorry for the inconvenience. This isn't a common issue, but does crop up in AJAXy environments in certain situations. Again, this will be fixed in the next release.

Please let us know how this goes or if you run into any other issues.
The topic has been locked.
Active Subscriptions:

None
15 years 6 months ago #5812 by Ivan
How long before the new release? I've tried to modify as you explained in that thread but it still doesnt work.

It still conflicts with the ajax1.2.js file.
The topic has been locked.
Support Specialist
15 years 6 months ago #5816 by alzander
We're working on it now, but aren't posting timelines for it. If you're an active subscriber, we'd gladly help you further with some of the changes that may make it work. We don't have a copy of JomComment though, and this is the only report of this issue, so we're not actively investigating this problem.
The topic has been locked.
Active Subscriptions:

None
15 years 6 months ago #5819 by Ivan
If i set getInstance($loadJavascript = false) jom comments work, but the Login with Facebook button doesnt show because its not loading the script. What other options are there to make this work?
The topic has been locked.
Support Specialist
15 years 6 months ago #5820 by alzander
Sorry Ivan. We only offer immediate support for our subscribers. We leave the the forums open to all to read, but have thought about locking it so only subscribers can post. We haven't done that yet since so few non-subscribers post.

I linked to a post similar to this earlier, but if that solution didn't work, I don't have any other suggestions. Please wait for the next release, which should have a fix, or subscribe for priority support if you want us to help you fix it sooner.

Also, since you aren't a subscriber, I don't know what version you're on. Last post I remember, you were using version 2.5 or something. We also no longer support the very old versions. If you're on 2.6.2 or 3.0.2, and you subscribe, we should be able to get your JomComment issues fixed quickly.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
15 years 6 months ago #5865 by Ivan
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
The topic has been locked.
Support Specialist
15 years 6 months ago #5866 by alzander
Ivan,
We don't offer in-depth support to non-subscribers. I understand the issue, but do not plan to investigate this further at this time. If you'd like our support and access to the most recent releases, please subscribe.

I'm assuming you purchased JomComment. Hopefully they will be able to help you further.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
15 years 6 months ago #5875 by Ivan
I need you guys to fix the issue an make another release. That is all
The topic has been locked.
Support Specialist
15 years 6 months ago #5876 by alzander
We believe we already have a fix ready for the 3.1 release. We're finalizing other details, and that release should be out later this month or early next month.
The topic has been locked.