railmedia
Forum Replies Created
-
Thanks David. The solution works.
However, for me the original need was to pull the user id to reflect a direct link to user edit in the admin notification.
Here’s the final code and how it looks on my end:
In functions.php I added the below code:
1. Add the new email tag for userid:
add_filter( 'nua_email_tags', 'add_email_tags_user_id'); function add_email_tags_user_id( $email_tags ) { $email_tags[] = array( 'tag' => 'userid', 'Description' => __('Generates the user ID', 'new-user-approve'), 'function' => 'email_tag_user_id', 'context' => array('email') ); return $email_tags; }
2. The function David came up with to pull the user ID from the database:
function email_tag_user_id( $attributes ) { $user = get_user_by( 'login', $attributes['user_login'] ); $userID = $user->ID; return $userID; }
3. The function that sends the message to the admin when a new user registers on the website:
add_filter( 'new_user_approve_notification_message_default', 'user_registration_message', 10, 2 ); function user_registration_message( $message ) { $message = __( '{username} ({user_email}) has requested a username at {sitename}', 'new-user-approve' ) . "<br/>"; $message .= "{site_url}<br/>"; $message .= __( 'To approve or deny this user access to {sitename} go to', 'new-user-approve' ) . "<br/>"; $message .= home_url().'/wp-admin/users.php?user_id={userid}'; return $message; }
Hope this helps anybody in trouble.
Regards,
AdrianAny luck with finding another possible solution?
Thanks
Hi Josh,
Thank you very much for your reply. Unfortunately this doesn’t solve my problem. It’s the same result, no user id.
Regards,
AdrianAnyone with this problem?