Thread: Integration with vBulletin - vB Nexus, Facebook & Google multiple login integration
View Single Post
  #186  
Old 08-25-2009, 07:05 PM
Calash's Avatar
Calash Calash is offline
 
Join Date: Jun 2006
Location: East Coast, USA
Posts: 297
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just so I have a reference, and for anybody else having similar problems I am going to post the issues and solutions I have found so far.


Facebook Button does not appear next to Google Login button:
Check your footer template and make sure the $template_hook[footer_links] hook is there. Add if it is missing.


Login buttons do not show up in external scripts or you want to relocate them
Create a new plugin with any name and set for global start. Add the following code.

Code:
global $vbulletin;
            if(!$vbulletin->userinfo['userid'])
{
global $vbnexus_request_uri;
$fb_login_button =
'<!-- fbconnect --><fb:login-button onlogin="window.location=\''.$vbulletin->options[bburl].'/index.php?product=vbnexus&product-mod=facebook&do=login&loc='.$vbnexus_request_uri.'\';"></fb:login-button><!-- / fbconnect -->';


$vbnex_login  = "
<div class=\"tborder\" style=\"padding:$stylevar[cellspacing]px; border-top-width:0px\">
<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" width=\"100%\">
  <tr align=\"right\">
    <td align=\"right\" valign=\"middle\"><span class=\"smallfont\">New! Use your <strong>Facebook, Google, AIM & Yahoo</strong> accounts to securely log into this site, <strong>click logo to login</strong></span></td>
    <td width=\"380px\" align=\"right\">$fb_login_button &nbsp<a href='#' onclick='isgooglesignin = true; google.friendconnect.requestSignIn()'><img src=\"/vb/vbnexus/images/nexus.gif\" border=\"0\"></a>
    </td>
  </tr>
</table></div>";

}
In your header or navbar template place $vbnex-login where you want the login buttons to appear

Disable Modify navbar template plugin.

Google Friend Connect login does not work outside of vBulletin directory.

Replace the
Include facebook js after <body> template contents with the following to add the bburl path to Javascript.

Code:
$headinclude .= "
<script type=\"text/javascript\" src=\" ".$vbulletin->options[bburl]."/vbnexus/js/jquery.js\"></script>";

if(!$vbulletin->userinfo['userid'])
{
// Add google related stuff

$headinclude .= "
<!-- Load the Google AJAX API Loader -->
    <script type=\"text/javascript\" src=\"http://www.google.com/jsapi\"></script>

    <!-- Load the Google Friend Connect javascript library. -->
    <script type=\"text/javascript\">
      google.load('friendconnect', '0.8');
    </script>

    <!-- Initialize the Google Friend Connect OpenSocial API. -->
    <script type=\"text/javascript\">
    google.friendconnect.container.setParentUrl('".$vbulletin->options[bburl]."/vbnexus/google/' /* location of rpc_relay.html and canvas.html */);
    google.friendconnect.container.initOpenSocialApi({
      site: '" . $vbulletin->options['vbnexusconfig_google_apikey'] ."',
      onload: function(securityToken) { loadData(); }
    });
    var isgooglesignin = false;
    </script>
    ";

$headinclude .= "
<script type=\"text/javascript\">
    //google.friendconnect.requestSignOut();
 // load the data using open social 
    function loadData() {
    var req = opensocial.newDataRequest();
      req.add(req.newFetchPersonRequest('VIEWER'), 'viewer');
      req.send(onLoadCallback);
    }


    // called after data is loaded
     function onLoadCallback(data) {
     var ongoogle = ".
 (($_REQUEST['product-mod'] == 'gfconnect') ?"true": "false")."             
      if(data.get('viewer').getData()) {
        var viewer = data.get('viewer').getData();
        var name = viewer.getDisplayName();
        //alert('Viewer is ' + name + viewer.getId());
        if(isgooglesignin)
        {
            window.location = '".$vbulletin->options[bburl]."/index.php?product=vbnexus&product-mod=gfconnect&do=login&loc=".$vbnexus_request_uri."';
        }
        else if(ongoogle)
        {
            //document.getElementById('login_username').value = viewer.getDisplayName();
        }
        if(!ongoogle && !isgooglesignin)
        {
            google.friendconnect.requestSignOut();
        }
      } else {
        //alert('Viewer is anonymous');
        //google.friendconnect.renderSignInButton({ 'id': 'google-login-button', 'style': 'long' })
      }
    }
 </script>   
    ";
}
$header = '<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>' . $header;
Blank page appears in background when Facebook asks if you want to post to profile. Blank sometimes stays after you accept or deny.

Go to http://www.facebook.com/developers
Click on your App, then Edit Settings, the Canvas
For Render Method select FBML

Save, reload your site, and test.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01362 seconds
  • Memory Usage 1,796KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete