0

I want to do particular verification process for my wordpress users, and I want to know if it is even possible, before I spend any more time trying.

This is what I have in my WordPress so far.

My WordPress users can define email addresses of their managers in separate database "wattp2_as_managers". Database structure example:

 |------------------------------------------------------|
 |ID|user_id|direct_manager    |cancelled_dm|approved_dm|
 |------------------------------------------------------|
 |1 |   1   |direct@manager.com|     0      |     1     |
 |------------------------------------------------------|

I want the managers to be able to approve the email address through an email notification with a link.

Scenario 1

User inserts manager email and a new row is created in the database. That triggers an event in wordpress/php/sql (really not sure) that sends email to manager that contains two links

a) first link has token that leads to a page on website. SQL query gets executed and "approved_dm" entry gets changed from 0 to 1

b) second link changes the "cancelled_dm" value for this row from 0 to 1

Scenario 2

Instead of trigger, there is a cron that checks if there are any rows that have "cancelled_dm" and "approved_dm" with value 0. Then based on that sends the email to all direct_manager emails with the two options listed in the scenario 1.

Questions

  1. Which scenario is better for my project?
  2. If one is more probable/easier, i would appreciate any pointers on how to achieve that.
  3. Is there a safe way to do verification links with tokens. Is it safe to use the wordpress user token, considering that user can have up to 3 managers?
  4. Maybe I am overthinking it and there is easier plugin/buy script/use zapier method to do all of that. I can always move the managers information to usermeta if it makes easier.

I appreciate help, i am new to the PHP world.

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.