Approve/deny link in the email
-
Hey my situation is the following.
I want to make it possible to approve or deny the newly registered user from inside the email the administrator/moderator gets.
Kind of like how wordpress approves and denies a comment from within the emailI know about the filter hook “new_user_approve_request_approval_message_default”.
I have tried to create the tags for the approve and deny url.
Let me tell you how I did the process.
I noticed the link for the approve and deny link is like the following:
localhost/wp-admin/users.php?action=approve&user=1&_wpnonce=vyas98f7v
I found the function
admin_approval_email
to be very helpful.
What I then did was to create an url with the nonce for it.$approve_link = admin_url( "users.php?action=approve&user={$user_id}"); $approve_link = wp_nonce_url( $approve_link, 'pw_new_user_approve_action_' . get_class( $this ) );
Then I added/created the tags for the approve and deny link.
Both in the array and in nua_setup_email_tags.
I also created new functions for the tags too.
Where I just get the attribute and the link$deny_link = $attributes['approve_url']; return sprintf(__('Approve: %s'), $approve_link);
Now it does work, and it prints the links correctly but the problem is that when I try to press the links then it says that the link has expired.
It also makes sense, since the nonce is not correct etc.So I tried to do something, but ultimately, I did not get what I wanted.
TL:DR – I just want the approve and deny link to be inside the “new user registered” email notification that the admin gets.
Thanks in advance.
I hope you all will have an awesome day.
- The topic ‘Approve/deny link in the email’ is closed to new replies.