Hey jez,
That hook kicks in after a user has successfully sent a valid login and password and immediately after a new session has been created for them.
Immediately after the hook the following is done via the rest of the default EE login code:
// -------------------------------------------
// 'cp_member_login' hook.
// - Additional processing when a member is logging into CP
//
$edata = $EXT->call_extension('cp_member_login', $query->row);
if ($EXT->end_script === TRUE) return;
//
// -------------------------------------------
/** ----------------------------------------
/** Log the login
/** ----------------------------------------*/
// We'll manually add the username to the Session array so
// the LOG class can use it.
$SESS->userdata['username'] = $IN->GBL('username', 'POST');
$LOG->log_action($LANG->line('member_logged_in'));
/** ----------------------------------------
/** Delete old password lockouts
/** ----------------------------------------*/
$SESS->delete_password_lockout();
/** ----------------------------------------
/** Redirect the user to the CP home page
/** ----------------------------------------*/
$return_path = $REGX->decode_qstr($IN->GBL('return_path', 'POST').'?S='.$session_id);
if ($IN->GBL('bm_qstr', 'POST'))
{
$return_path .= AMP.$IN->GBL('bm_qstr', 'POST');
}
$FNS->redirect($return_path);
exit;You would likely in your case want to replicate that in your extension and then provide alternate return_paths based on the member_id of the member logging in.
Jamie
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.