I have an issue with a plugin that uses the wp_mail function, which I am trying to solve. Basically the following piece of code will generate an email once a certain condition has been met within the website:
function simplr_activate_users( $ids = false ) {
if( !$ids ) {
if( @$_REQUEST[‘action’] == ‘sreg-activate-selected’ AND !empty($_REQUEST[‘users’]) ) {
simplr_activate_users( $_REQUEST[‘users’] );
}
}
else {
global $wpdb,$simplr_options;
foreach( $ids as $id ) {
$return = $wpdb->update( $wpdb->users, array( ‘user_status’=> 0 ), array( ‘ID’ => $id ), array(‘%d’), array(‘%d’) );
if( !$return ) {
return new WP_Error( “error”, “Benutzer konnte nicht aktiviert werden.” );
}
$data = (array) get_userdata( $id );
$data = (array) $data[‘data’];
$data[‘blogname’] = get_option(‘blogname’);
do_action(‘simplr_activated_user’, $data);
$subj = simplr_token_replace( $simplr_options->mod_email_activated_subj, $data );
$content = simplr_token_replace( $simplr_options->mod_email_activated, $data );
$headers = “From: “.$data[‘blogname’].”<“.get_option(‘admin_email’).”>\r\n”;
wp_mail( $data[‘user_email’], $subj, $content);
The last line of the code “wp_mail( $data[‘user_email’], $subj, $content);” generates an email with a preset message to the user. I am trying to add a parameter to the email body (or subject), which identifies the email/first_name/last_name of the user who has just registered.
Any help is greatly appreciated.
Thank you in advance.
William Genske