News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

SA Facebook Integration

Started by SMFHacks.com Team, February 12, 2010, 01:36:11 PM

Previous topic - Next topic

JonoJames

The function loads, the same way it did if calling show_facebook(); its just the links don't work.

For example, when itry to connect, the page just reloads, there is no popup box.

When i am logged in i get a message to integrate with account, i click it and the page just reloads.

bahgheera

Quote from: SleepyArcadeno cos i cannot replicate this the only i think that can happen is if they have the same name as the admin on facebook but i doubt it considering each facebook id is unick to that user

i logs the user in using the  id so if you was john smith clikc the facebook connect button it will look for the the user id from facebook the search the members table for that id then it will do the login stuff

Ok, well thanks then.

Casa Grande

#502
Quote from: Sleepy Arcade on June 18, 2010, 09:01:07 PM

you may also need this
echo'<script src="path to fbc dir/fbc/fbconnect.js" type="text/javascript"></script>';

just change the part in red



I have installed the mod and I'm having troubles.  It seems the above code you mentioned there is a problem.  I keep getting a parse error.  Granted, I did have to manually update the index.template.php file, but I have checked and triple checked and I am still getting the error on this line:

   echo'<script src="http://www.bigbendchat.com/portal/forum/fbc/fbconnect.js" type="text/javascript"></script>';

Here is the error message that comes up:


Template Parse Error!
There was a problem loading the /Themes/default/index.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly.

You may want to try to refresh this page or use the default theme.

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in .../Themes/default/index.template.php on line 162

153: if ($context['user']['is_guest'])
154: {
155: $options['collapse_header'] = !empty($_COOKIE['upshrink']);
156: $options['collapse_header_ic'] = !empty($_COOKIE['upshrinkIC']);
157: }
158:
159: // Output any remaining HTML headers. (from mods, maybe?)
160: echo $context['html_headers'], '
161:

162: echo'<script src="http://www.bigbendchat.com/portal/forum/fbc/fbconnect.js" type="text/javascript"></script>';

163: echo'<script type="text/javascript">
164: var mod_settings_fb_app_pageid = "',$modSettings['fb_app_pageid'],'";
165: var mod_settings_fb_app_stream = "',$modSettings['fb_app_stream'],'";
166: var mod_settings_fb_app_connection = "',$modSettings['fb_app_connection'],'";

any help? thanks

JonoJames

// Output any remaining HTML headers. (from mods, maybe?)
160: echo $context['html_headers'], '


should be

// Output any remaining HTML headers. (from mods, maybe?)
160: echo $context['html_headers'];



SA™

http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

JonoJames

If you mean me, i've got SSI as an include in includes/application_top.php and then i call the facebook function in the header.php


<?
if ($include == 1) {
include ('includes/application_top.php');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<link href="<? echo DOMAIN; ?>forums/Themes/Estalia20Rc3/css/index.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="harry, max, myles, matt, fitzgerald, mondryk, ryan, connor, connected, boyband, britains, got, talent, events, news, forums, videos, pictures, biography" />
<meta name="description" content="<? echo $pgdesc; ?>" />
<title><? echo $title; ?></title>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript" src="functions.js"></script>
<script src="/forums/fbc/fbconnect.js" type="text/javascript"></script>
</head>
<?
function show_facebook_ext()
{
    global $settings, $user_info, $context, $txt, $modSettings;

    if ($context['user']['is_logged'] && !empty($modSettings['fb_enable']))
    {
        if (!empty($user_info['fbname']))
            echo '<img src="' . $settings['images_url'] . '/facebook.png" alt="'.$txt['fb_title'].'" /> <a href="#" onclick="javascript:fbLogincheck(); return false;">'.$txt['fb_title'].'</a>';
        else
            echo ' <img src="' . $settings['images_url'] . '/facebook.png" alt="'.$txt['fb_title'].'" /> <a href="#" onclick="javascript:fbLoginsync(); return false;">'.$txt['fb_integrate'].'</a>';
   
        echo'<br /><br />';
    }
    elseif (!empty($modSettings['fb_enable']))
        echo'<a href="#" onclick="javascript:fbLogin(); return false;"><img src="http://b.static.ak.fbcdn.net/rsrc.php/zB6N8/hash/4li2k73z.gif" alt="" /></a>';
}
?>
<body>

<!-- Begin header -->
<div id="body-top">
<!-- Start logo display -->
<div id="top-banner">
        <span style="position:relative; left:15px; top:15px;float:left;">
        <table align="left">
        <tr><td colspan="2" style="font-size: 1.25em; color:white; font-weight:bold;">Follow us on these sites:</td></tr>
        <tr><td><a href="http://www.youtube.com/officiallyconnected"><img src="images/youtube.png"  height=45 width=45 style="padding:3px; "/></a></td><td align="left" style="font-size:1.15em;  font-weight:bold;"><a href="http://www.youtube.com/officiallyconnected" style="color:white;">YouTube</a></a></tr>
        <tr><td><a href="http://www.facebook.com/pages/OfficiallyConnected/121869631187830"><img src="images/facebook1.png"  height=45 width=45 style="padding:3px; "/></a></td><td align="left" style="font-size:1.15em;  font-weight:bold;"><a href="http://www.facebook.com/pages/OfficiallyConnected/121869631187830" style="color:white;">Facebook</a></a></tr>
        <tr><td><a href="http://www.twitter.com/connectedforum"><img src="images/twitter.png"  height=45 width=45 style="padding:3px; "/></a></td><td align="left" style="font-size:1.15em;  font-weight:bold;"><a href="http://www.twitter.com/connectedforum" style="color:white;">Twitter</a></a></tr>
        </table>
       
        </span>
<!-- Start Login/User display box -->
        <span style="position:relative; left:0px; top:0px;float:right; width:27%;">
<?

// If user is logged in display the info box.
if ($context['user']['is_logged'])
{
echo'<table align="right" width="190"><tr>';
echo '
<td><ul class="reset">
<li class="greeting" style="color: #fff;"><b>Hello <span>', $context['user']['name'], '</b>' . loginout("logout",$pgid) . '</span></li>
<li><a href="', $scripturl, '?action=unread" style="color: #a9ddff">View unread posts since last visit</a></li>
<li><a href="', $scripturl, '?action=unreadreplies" style="color:#a9ddff">View new replies to your posts<br></a></li>
';

echo'
</ul></td>';

echo'</tr></table>';
}

// Else show a log in box
else
{
loginout("login",$pgid);
}
if ($context['user']['is_logged']){

if (empty($modSettings['fb_enable_fbc_menu']))
    {
    echo '<div align="right" style="clear:both;">';
       show_facebook_ext();
    }
    echo '</div>';
  }
  else {
  echo '<div align="center" style="font-size:13px; color:white; font-weight:bold;">---- OR ----- <br>';
if (empty($modSettings['fb_enable_fbc_menu']))
    {
       show_facebook_ext();
    }}
echo '</div>';
echo '
</td></tr></table>'; ?>
               
                </span>
<!-- End user info box -->
</div>
<!-- End logo -->
</div>
<!-- End Header -->

<!-- Start Menu -->
    <div id="menu">
    <ul>
    <li><a href="index.php" title="Home">Home</a></li>
    <li><a href="news.php" title="News">News</a></li>
    <li><a href="bio.php" title="Biography">Biography</a></li>
    <li><a href="events.php" title="Events">Events</a></li>
    <li><a href="/forums/index.php?action=media" title="Gallery">Gallery</a></li>
    <li><a href="/forums/index.php?action=media;sa=album;in=18" title="Videos">Videos</a></li>
            <li><a href="<? echo DOMAIN;?>forums" title="Join the forums, interact with other fans">Forums</a></li>
<?         
// If user is logged in display profile button on menu
if ($context['user']['is_logged'])
echo ' <li><a href="/forums/index.php?action=profile" title="View your forum profile">Profile</a></li>';
// if ((in_array(1, $user_info['groups'])) || (in_array(9, $user_info['groups'])))
// echo ' <li><a href="admin.php" title="Manage">Manage</a></li>';
?>
</ul>
    </div>
<!-- End Menu -->

<!-- Start main body -->
   <div id="mainbody">
<div class="clr"/></div>
<!-- Everything inside the wrapper which is aligned to center of page -->
<div class="wrapper">
           



SA™

sry i ment Casa Grande

can i have a link to you site pls
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

littleone

How can I uninstall this mod?  It shows that it has not been installed yet but it is installed. I want to uninstall it, but can't do so since its showing with an "Apply Mod" link only and I dont want to double install it.  Is there a way to uninstall without removing all that code manually?

SA™

http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

Casa Grande

#509
Thanks for your help, Sleepy

Yes, the site is here: http://www.bigbendchat.com

and here is the file code.  Keep in mind, I had to manually add the code for this file.  All other files where installed using the admin control panel.

you can download the zip file containing the offending php page here: http://www.bigbendchat.com/index.template.zip

MATTEK

Quote from: Abu Fahim Ismail on June 21, 2010, 06:03:23 AM
Quote from: MATTEK on June 21, 2010, 03:27:01 AM
Does this mod conflict with any other facebooks mods? I'm trying to install and it says it's corrupt or incompatible with my version of SMF.
I've been using this mod for quite some times now and it's awesome. And yes, from my past experience it does conflict with other facebook mods (which you do not need with this mod installed). And normally, I use mod page to download the mod, upload it back to my forum and install it there; as sometimes directly download and install from Package Server [Simple Machines Third-party Mod Site] cause me problems like yours (" it's corrupt or incompatible").

I'm not entirely sure what you mean. I manually download from the mod page and it still said incompatible or corrupt.
SMF 2.0.1

Like Comics, Books, Movies or T.V. Shows? Read about them here!!

JonoJames

Ok i've fixed my problem :D

I added the following to my header.php

Above the header tag



echo'<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>';

echo'<script src="'.$boardurl.'/fbc/fbconnect.js" type="text/javascript"></script>
<script type="text/javascript">
var mod_settings_fb_app_pageid = "',$modSettings['fb_app_pageid'],'";
var mod_settings_fb_app_stream = "',$modSettings['fb_app_stream'],'";
var mod_settings_fb_app_connection = "',$modSettings['fb_app_connection'],'";
var mod_settings_fb_app_width = "',$modSettings['fb_app_width'],'";
var mod_settings_fb_com_xid = "',$modSettings['fb_app_comments_boxid'],'";
var mod_settings_fb_com_show = "',$modSettings['fb_admin_commets_post'],'";
</script>';

echo'<script type="text/javascript">
FB.init("'.$modSettings['fb_app_key'].'",
"'.$boardurl.'/fbc/xd_receiver.htm",
{"doNotUseCachedConnectState":true });
function doLoggedOutFacebookUser(){
FB.Connect.logout(function(){location.href = "'.$scripturl.'?action=logout;sesc='.$sc.'";});
}
</script>';

if(isset($_GET['fb_feed']))
{
include_once $boarddir.'/fbc/facebook/php/facebook.php';
$api_key = ''.$modSettings['fb_app_key'].'';
$secret  = ''.$modSettings['fb_app_secret'].'';
$fb = new Facebook($api_key,$secret);
$fb_user = $fb->get_loggedin_user();
$user_id = $fb->require_login();
$user_details = $fb->api_client->users_getInfo($fb_user, array('first_name','last_name')); 
$firstName = $user_details[0]['first_name'];
$lastName = $user_details[0]['last_name'];
$name = ''.$firstName.' '.$lastName.'';
echo'<script type="text/javascript">
window.onload = function()
{
callPublish(\'\',{\'name\':\''.$name.' '.$txt['fb_haslogged'].' '.$context['forum_name'].' '.$txt['fb_haslogged2'].'\',\'href\':\''.$scripturl.'\',\'description\':\''.$name.' '.$txt['fb_haslogged'].' '.$context['forum_name'].' '.$txt['fb_haslogged2'].'\'},null);
facebook_onload(true);
};
</script>';
}



Wherever you want on the page



       show_facebook_ext();

function show_facebook_ext()
{
    global $settings, $user_info, $context, $txt, $modSettings;

    if ($context['user']['is_logged'] && !empty($modSettings['fb_enable']))
    {
        if (!empty($user_info['fbname']))
            echo '<img src="' . $settings['images_url'] . '/facebook.png" alt="'.$txt['fb_title'].'" /> <a href="#" onclick="javascript:fbLogincheck(); return false;">'.$txt['fb_title'].'</a>';
        else
            echo ' <img src="' . $settings['images_url'] . '/facebook.png" alt="'.$txt['fb_title'].'" /> <a href="#" onclick="javascript:fbLoginsync(); return false;">'.$txt['fb_integrate'].'</a>';
   
        echo'<br /><br />';
    }
    elseif (!empty($modSettings['fb_enable']))
        echo'<a href="#" onclick="javascript:fbLogin(); return false;"><img src="http://b.static.ak.fbcdn.net/rsrc.php/zB6N8/hash/4li2k73z.gif" alt="" /></a>';

SA™

Quote from: Casa Grande on June 21, 2010, 06:33:53 PM
Thanks for your help, Sleepy

Yes, the site is here: http://www.bigbendchat.com

and here is the file code.  Keep in mind, I had to manually add the code for this file.  All other files where installed using the admin control panel.

you can download the zip file containing the offending php page here: http://www.bigbendchat.com/index.template.zip

try this
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

Casa Grande

thank you, Sleepy!  Works great now...thanks for the personal attention!

JonoJames

I'm having another problem. When clicking the forum logout button, it pops up to tell me that its logging out of facebook and the forum, however it doesn't, the page just reloads and i'm still logged in.

MATTEK

I'd still like to know why it says the mod is corrupt or incompatible, please.
SMF 2.0.1

Like Comics, Books, Movies or T.V. Shows? Read about them here!!

SA™

@JonoJames you can disable that in facebook admin or try clearing you forum cache


@MATTEK because you are using the wrong package if you notice there is two packages there one for smf1 and one for smf2
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

MATTEK

Quote from: Sleepy Arcade on June 22, 2010, 08:50:52 PM
@JonoJames you can disable that in facebook admin or try clearing you forum cache


@MATTEK because you are using the wrong package if you notice there is two packages there one for smf1 and one for smf2

I tried both. Same error for each.
SMF 2.0.1

Like Comics, Books, Movies or T.V. Shows? Read about them here!!

SA™

well eaither you are downloading the same file twice or ive gone mad cos i just tested it and it installs just fine

http://custom.simplemachines.org/mods/index.php?action=download;mod=2322;id=142369
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

kaansef

Fatal error: Class 'Facebook' not found in /home/vhosts/xxxxxxxxx.xxx.biz/forum/Sources/FB_Connect/FB_Connect_Subs.php on line 717

Help me please.

Advertisement: