Skip to content

Instantly share code, notes, and snippets.

@vanbo
Created February 17, 2015 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanbo/62d7aa5e9347c89243fd to your computer and use it in GitHub Desktop.
Save vanbo/62d7aa5e9347c89243fd to your computer and use it in GitHub Desktop.
User Activation Message Hook - MultiSite
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