I am currently using the wp_login hook to run a php function when a user logins. However, I want to show users who login notifications (a pop up with recent posts, etc) and I was planning to do this by running a javascript function.
Is it possible to edit the page shown to the user after login?
This is the code I have so far:
add_action( 'wp_login', 'my_login_function' );
add_action( 'wp_footer', 'the_footer_function' );
function the_footer_function(){
if (defined('FIRST_RUN')){
echo "<script>jQuery(document).ready( function(){alert('hello');});</script>";
define('FIRST_RUN', false);
}
}
function my_login_function($user_login){
global $altdb;
$user_info = get_userdatabylogin($user_login);
$wonAwards = $altdb->get_var("SELECT achievement_id FROM user_".$user_info->ID." WHERE isTold='false'");
define('FIRST_RUN', true);
//$altdb->query("UPDATE user_".$user_info->ID." SET isTold='true' WHERE isTold = false") or die(mysql_error());
}
Any help is appreciated.