I am new to PHP. I've been trying to get this authorization code to work, but am getting this error:
Call to undefined function redirect()
Code:
$Auth = Auth::getAuth();
if($Auth->loggedIn())
{
redirect(getCoreSitePath().'/account.'.SITE_CONFIG_PAGE_EXTENSION);
}
if(isset($_REQUEST['error_description']))
{
$error = $_REQUEST['error_description'];
}
redirect(getCoreSitePath()."/login.".SITE_CONFIG_PAGE_EXTENSION."?social_login_error=".urlencode($error));
Based on some Googling, I saw that I might need to add $this->load->helper('url');
Revised code:
$Auth = Auth::getAuth();
$this->load->helper('url');
if($Auth->loggedIn())
{
redirect(getCoreSitePath().'/account_home.'.SITE_CONFIG_PAGE_EXTENSION);
}
if(isset($_REQUEST['error_description']))
{
$error = $_REQUEST['error_description'];
}
redirect(getCoreSitePath()."/login.".SITE_CONFIG_PAGE_EXTENSION."?plugin_social_login_error=".urlencode($error));
But now I get this error:
Using $this when not in object context
I tried the suggestions here but wasn't able to get it working.