• Resolved bodiashv

    (@bodiashv)


    Hi! I want to updates users by my custom function.
    In my function, I compare the activation key from user object and activation key that come from request. And if they are equal I want to update user activation status. I use this code for that:
    update_metadata( ‘user’, $user_id, ‘user_activation_status’, ‘1’, ‘0’ );

    Does i need to do somethig else?

    • This topic was modified 3 years, 5 months ago by bodiashv.
Viewing 5 replies - 1 through 5 (of 5 total)
  • this should be ok, you could also use following code,

    update_user_meta( $user_id, 'user_activation_status', 1 );

    Thread Starter bodiashv

    (@bodiashv)

    @hasanrang05 thanks for your answer, but I got a problem, if I change verification status via API, email about user success verification doesn’t send. Is there any ways to fix that?

    Thread Starter bodiashv

    (@bodiashv)

    @hasanrang05 I created my custom email sending when update user
    for this in function.php I get plugin settings

    $user_verification_settings = get_option('user_verification_settings');
    $email_template = $user_verification_settings['email_templates_data']['email_resend_key'];

    then I fill the email fields by info that I got from settings

    $email_to = $user_data->email;
    $email_bcc = isset($email_template['email_bcc']) ? $email_template['email_bcc'] : '';
    
    $email_from = isset($email_template['email_from']) ? $email_template['email_from'] : get_option('admin_email');
    $email_from_name = isset($email_template['email_from_name']) ? $email_template['email_from_name'] : get_bloginfo('name');
    
    $reply_to = isset($email_template['reply_to']) ? $email_template['reply_to'] : get_option('admin_email');
    $reply_to_name = isset($email_template['reply_to_name']) ? $email_template['reply_to_name'] : get_bloginfo('name');
    
    $attachments = isset($email_template['attachments']) ? $email_template['attachments'] : '';
    ...

    and in the end I send email via
    $status = wp_mail($email_to, $subject, $email_body, $headers, $attachments);

    That is correct way to fixing this issue?

    • This reply was modified 3 years, 5 months ago by bodiashv.
    • This reply was modified 3 years, 5 months ago by bodiashv.

    this should be working.

    Thread Starter bodiashv

    (@bodiashv)

    @hasanrang05 thank you for your answers!)

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘User Verification. Update verification status.’ is closed to new replies.