Created
February 17, 2015 16:20
-
-
Save vanbo/62d7aa5e9347c89243fd to your computer and use it in GitHub Desktop.
User Activation Message Hook - MultiSite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('my_do_active_user_message_hook', 'check_header_for_active_user'); | |
/** | |
* Check for the set activated user and echo a message on the home page | |
*/ | |
function check_header_for_active_user() { | |
if ( ! session_id() ) { | |
session_start(); | |
} | |
if ( isset($_SESSION['my_active_user_variable']) && ! empty( $_SESSION['my_active_user_variable'] ) ) { | |
$user = $_SESSION['my_active_user_variable']; | |
echo '<div>'. sprintf( __( 'Dear %s. Your account is now active!' ), $user->user_login ).'</div>'; | |
// Unset the session variable since we don't needed anymore | |
unset($_SESSION['my_active_user_variable']); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment