Enter your subject Name (or) Subject code


9 July 2013

How to make Nayar facebook connect plugin for MYBB redirect to page where you clicked that button rather than index page?

Solution for Fbconnect Redirecting to Index page

If you really love your site and have taken time to build your site and if you know the workflow, you will find one absurd behavior of the Nayar FB connect plugin. When you register or login, you will be redirected to the index page rather than the page from where you had clicked fbconnect.

To rectify this, Find 
$my_url = $mybb->settings['bburl']."/fbcore/fbconnect.php";
1. Place this code below it.
if($_SERVER['HTTP_REFERER'])
    {
        $redirect_url = htmlentities($_SERVER['HTTP_REFERER']);
     //echo $redirect_url;
    }
    else
    {
        $redirect_url = 'index.php';
    }
    if(!$_COOKIE["LastURL"])
    {
    setcookie("LastURL", $redirect_url, time()+60);
    }
2. Replace all occurrences of
window.location = \"../index.php\"

by
 window.location = \"".$_COOKIE["LastURL"]."\"
3. Replace 
//Add his Facebbok UID into database
by
if($mybb->input['url'] != "" )
      {
        redirect(htmlentities($mybb->input['url']), $lang->redirect_loggedin);
      }
      else
      {
      if($_COOKIE["LastURL"])
        {
        redirect($_COOKIE["LastURL"]);
                }
                $fbconnectjavascript = "";  
          }
                //Add his Facebbok UID into database
That's it now, your plugin works fine...

Need more material ? Visit www.csetube.in

No comments:

Post a Comment