Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Chad Butler

    (@cbutlerjr)

    Yes – the user meta that determines if they are activated is set when they are activated (or updated when they are deactivated).

    Thread Starter islp

    (@islp)

    @cbutlerjr ok, but my users are not active by default. So the question is: will I bypass wpm approval if I register a user programmatically?

    • This reply was modified 2 months, 1 week ago by islp.
    Thread Starter islp

    (@islp)

    @cbutlerjr sorry for the late reply, I’ve been very busy. ?? Ok: I found a user registered programmatically is NOT active by default.

    So, my question is: is there any way to bypass this setting? Basically, I would like to have programmatically registered users be directly active.

    Is there a wp_members usermeta where the user’s status is recorded? I could also change the user status from there, perhaps.

    [EDIT] Ok, I found wp-members sets an ‘active’ usermeta with value 0 or 1. When I update_user_meta setting active=1, the Users table reflects this change and it doesn’t display the Activate label anymore. Usermeta update by code does not cause unwanted activation emails to be sent (perfect!) ??

    Please, let me know if you have any comment, that is if I’m missing something important here.

    • This reply was modified 1 month, 4 weeks ago by islp.
    Plugin Author Chad Butler

    (@cbutlerjr)

    Sorry – I misunderstood your original question (or actually, didn’t understand which direction you were going with this).

    If you set a user meta value of “active” as “1” when you create the user, they will be created as already active.

    The best approach would be to use the plugin’s API function wpmem_activate_user(). This allows you the most forward compatible (should the meta ever have a change). That function allows you to not only activate the user, but to determine if the notification email to the user should be sent. The email is sent by default, so if you want them to not be notified, you would do it as follows:

    wpmem_activate_user( $user_id, false );

    where $user_id is the user ID being activated.

    Thread Starter islp

    (@islp)

    Hi @cbutlerjr, thanks for your detailed reply. One more question: from my plugin, is there anything I can do to check if wp_members is installed and working? I could check for its presence before calling wpmem_activate_user

    Plugin Author Chad Butler

    (@cbutlerjr)

    You could check if $wpmem is an object.

    Or (probably best), check if wpmem_activate_user() exists as a function (i.e. if ( function_exists( 'wpmem_activate_user' ) ) ...

    Thread Starter islp

    (@islp)

    @cbutlerjr fantastic, thanks ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.