wp_login action and wp_mail
-
So far, I’ve been workung with WP3.5.1 and decided now to update to WP3.9.2. Yet, I am facing problems with login/logout actions/hooks.. I am using the actions as recommended like so:
add_action('wp_login', 'PN_on',10,1); function PN_on($user){ global $wpdb; $GLOBALS['PM'] = $user; $us = get_user_by('login', $user); add_user_meta($us->ID,'login',$user ); wp_mail('[email protected]', 'PM_signon', dbg_r($us->user_login)); if ( in_array('administrator',$us->roles ) ) { // wp_mail('[email protected]', 'PM_signon_Admin', dbg_r($us->user_login)); } }
When I try to login, the process is not completed and -in debug mode- I get a message output like ‘cookies are de-activated due to unexpected output’ and further on the infamous ‘cannot complete header’-error and finally login hangs up.
If I comment out the wp_mail lines, everything works perfect.
It worked until WP3.5.1 but obviously no longer now.
How can I send an email during login process on certain conditions in WP3.9.2?
Should I use ob_start here instead?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘wp_login action and wp_mail’ is closed to new replies.