• Resolved dsovino

    (@dsovino)


    Is there any way I can “query” a user status programatically on ie get_users($args) loop result?

    I guess i could use a specific field and monitor it myself and toogle a flag with the help of alg_wc_ev_user_account_activated action hook, but it seems to be an overkill since I assume you somehow store the status.

    Thanx in advance.

    • This topic was modified 2 years, 5 months ago by dsovino.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Pablo Pacheco

    (@karzin)

    Hi @dsovino ,

    You could do it like this:

    global $wpdb;
    $skip_user_roles = get_option( 'alg_wc_ev_skip_user_roles', array( 'administrator' ) );
    $args  = array(
    	'meta_query' => array(
    		'relation' => 'OR',
    		array(
    			'key'     => $wpdb->prefix . 'capabilities',
    			'value'   => '"' . implode( $skip_user_roles ) . '"',
    			'compare' => 'REGEXP'
    		),
    		array(
    			'key'     => 'alg_wc_ev_is_activated',
    			'value'   => '1',
    			'compare' => '='
    		)
    	)
    );
    $users = get_users( $args );
    • This reply was modified 2 years, 5 months ago by Pablo Pacheco.
    Plugin Contributor Pablo Pacheco

    (@karzin)

    Oh, I’m sorry. Actually, that would be a way of getting the activated users, considering the “General > Ignore user roles” option.

    In order to simply get the verification status, you can simply try it like this:
    get_user_meta( $user_id, 'alg_wc_ev_is_activated', true ).

    Now, you’d need to check it against the “Ignore user roles” option as well.

    • This reply was modified 2 years, 5 months ago by Pablo Pacheco.

    Hello @dsovino,

    I hope you are doing well and safe!

    We haven’t heard from you in a while, I’ll mark this thread as resolved.

    Feel free to let us know if you have any additional questions or problems.

    Best Regards
    Moshtafizur

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Get user’s verification status’ is closed to new replies.