How to redirect a user to a specific page only in the first login of the site in wordpress?

0

I include some users in the wp_users table, just with the ID, USER_LOGIN, USER_PASS, USER_NICENAME, and DISPLAY_NAME.

So, for example:

INSERT INTO wp_users (ID, user_login, user_pass, user_nicename, user_email, 
user_url, user_registered, user_activation_key, user_status, display_name) 
VALUES
(1500, ‘steoliv’, ‘65442334hio’,’steoliv’, ”, ”,’2018-01-09 13:01:00′, ”, 0, 
‘Stefany’);

I would like the first login, made by the username and password I created, to redirect the user to a page, which I have already created (site / edit-register) and update the data with the missing information, such as e-mail. Is there a plugin or some code that can do what I want?

    
asked by anonymous 09.01.2018 / 17:29

1 answer

0

You can use a flag to see if it's the first time a user logs onto your platform. Add this flag to your database and every time you log in you test fleg . After testing if the username and password are correct you test the flag

if(result['flag'] == 0){
    // Atualiza a colona da flag
    $query = "UPDATE wp_users SET flag = 1 WHERE usuario = $usuario";
    mysqli_query($con,$query);
    // Faz o redirecionamento para a página de editar cadastro
    header("location: http://minhaurl/site/editar-cadastro");
}else{
    header("location: http://minhaurl/site/outra-area");
}
    
09.01.2018 / 18:53