Support » Plugins » Get Notified of User's One Year Anniversary After Registration – Possible?

  • Freelancealot



    I’ve tried to find a plugin but haven’t been 100% successful.

    Members List will let me see a list of users via the registration date. So the information is in the database to be used.

    Is there anyway of getting notified as the WP Admin when a user reaches the 365th day after they registered — ie, their one-year anniversary as a member of the site?

    So put simply, something along the lines of:

    function user_anniversary {
    if user = subscriber (& registration date +365 days = today) 
    action "notify Admin (via email preferably)" 

    As you may guess, I’m not a natural php coder!! 😉

    I’m pretty sure I’m not the only one having requested this, but can’t seem to find anything.

    Any pointers gratefully received.



Viewing 2 replies - 1 through 2 (of 2 total)
  • TCBarrett


    Here’s a quick, untested, snippet that will hopefully inspire you.

    global $current_user;
    $registered = $current_user->user_registered;
    $now        = date('Y-m-d H:i:s');
    $diff       = strtotime($now) - strtotime($registered);
    $days       = $diff / (60 * 60 *24);
    $daysround  = round($days);
    if( $daysround == 365 ) echo "Happy anniversary";

    Don’t forget leap years…



    Hi tcbarrett,

    Thanks for this — looks promising.

    Somehow I need to add an instruction to email Admin in place of the:

    echo "Happy anniversary"

    I found this useful snippet (at that looks well on the way to getting what I want along with the above code (slighly hacked for this purpose):

    if (!wp_next_scheduled('my_task_hook')) {
       wp_schedule_event( time(), 'daily', 'my_task_hook' );
    add_action( 'my_task_hook', 'my_task_function' );
    function my_task_function() {
      wp_mail('', 'Automatic email', 'User-name has been a member for one year.');

    Basically, a scheduled event happening daily, that will call the function to check if any user has been a member for 365 days.

    I just don’t know how to marry the two snippets of code above. As I say, I’m not a programmer so I’m relying heavily on you experts out there.



Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get Notified of User's One Year Anniversary After Registration – Possible?’ is closed to new replies.