One unexpected issue has popped up with the custom login form I've built.
For some reason, no matter what I do I just get a blank white page after logging in. The user successfully logs in but it doesn't redirect properly.
Here's my method:
Code:
public static function loginUser($username, $password, $remember) {
// INCLUDE CB API
global $_CB_framework, $mainframe, $_CB_database, $ueConfig, $_PLUGINS;
if (defined('JPATH_ADMINISTRATOR')) {
if (!file_exists(JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php')) {
echo 'CB not installed!';
return;
}
include_once(JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php');
} else {
if (!file_exists($mainframe->getCfg('absolute_path') . '/administrator/components/com_comprofiler/plugin.foundation.php')) {
echo 'CB not installed!';
return;
}
include_once($mainframe->getCfg('absolute_path') . '/administrator/components/com_comprofiler/plugin.foundation.php');
}
cbimport('cb.database');
cbimport('cb.html');
cbimport('cb.plugins');
// GET CB USER
$myId = $_CB_framework->myId();
$cbUser =& CBuser::getInstance( $myId );
if ( ! $cbUser ) {
$cbUser =& CBuser::getInstance( null );
}
$user =& $cbUser->getUserData();
cbimport( 'cb.authentication' );
$cbAuthenticate = new CBAuthentication();
$messagesToUser = array();
$alertmessages = array();
$redirect_url = '/index.php?option=com_comprofiler';
$resultError = $cbAuthenticate->login( $username, $password, $remember, 1, $redirect_url, $messagesToUser, $alertmessages, 0 );
if ( $resultError ) {
$user->_error = $resultError;
echo $user->_error;
} else {
return ( count( $alertmessages ) > 0 ? stripslashes( implode( '<br />', $alertmessages ) ) : true );
}
return false;
}
** UPDATE **
Never mind I guess, for some reason it now works lol, no idea why.