public static function confirm_link_login($userid, $username, $issuerid, $token) {
        if (empty($token) || empty($userid) || empty($issuerid) || empty($username)) {
            return false;
        }
        $params = [
            'userid' => $userid,
            'username' => $username,
            'issuerid' => $issuerid,
            'confirmtoken' => $token,
        ];

        $login = linked_login::get_record($params);
        if (empty($login)) {
            return false;
        }
        $expires = $login->get('confirmtokenexpires');
        if (time() > $expires) {
            $login->delete();
            return;
        }
        $login->set('confirmtokenexpires', 0);
        $login->set('confirmtoken', '');
        $login->update();
        return true;
    }
public static function confirm_link_login($userid, $username, $issuerid, $token) {
        if (empty($token) || empty($userid) || empty($issuerid) || empty($username)) {
            return false;
        }
        $params = [
            'userid' => $userid,
            'username' => $username,
            'issuerid' => $issuerid,
            'confirmtoken' => $token,
        ];

        $login = linked_login::get_record($params);
        if (empty($login)) {
            return false;
        }
        $expires = $login->get('confirmtokenexpires');
        if (time() > $expires) {
            $login->delete();
            return;
        }
        $login->set('confirmtokenexpires', 0);
        $login->set('confirmtoken', '');
        $login->update();
        return true;
    }
public static function confirm_link_login ( $ userid , $ username , $ issuerid , $ token ) { if ( empty ( $ token ) || empty ( $ userid ) || empty ( $ issuerid ) || empty ( $ username ) ) { return false ; } $ params = [ 'userid' => $ userid , 'username' => $ username , 'issuerid' => $ issuerid , 'confirmtoken' => $ token , ] ; $ login = linked_login :: get_record ( $ params ) ; if ( empty ( $ login ) ) { return false ; } $ expires = $ login -> get ( 'confirmtokenexpires' ) ; if ( time ( ) > $ expires ) { $ login -> delete ( ) ; return ; } $ login -> set ( 'confirmtokenexpires' , 0 ) ; $ login -> set ( 'confirmtoken' , '' ) ; $ login -> update ( ) ; return true ; }
Look for a waiting confirmation token, and if we find a match - confirm it.

@param int $userid
@param string $username
@param int $issuerid
@param string $token
@return boolean True if we linked.
Look for a waiting confirmation token and if we find a match - confirm it .