2015-09-25, 10:04 AM
If you are hooking into datahandler_login_complete_end, the $mybb->user object is still stuck to a general guest data. The user data will be loaded afterwards, so you should grab the authenticated user data by using the argument passed in the hook, which is a "by-reference" hook type:
function myplugin_datahandler_login_complete_end($user)
{
global $session;
setcookie('my_session', $user['uid'] . ' ABCDE ' . $session->sid, time() + (86400 * 30), "/");
}