Support » Plugin: Expire Users » Can you set this plugin to only expire certain roles?

  • Hi,

    I’m just wondering if it would be possible to set this plugin so that it only works on certain roles.

    The idea is to revert a privileged role back to a basic role after a certain amount of time.

    If a user with a basic role is created, the plugin does not affect the user. If any user’s role is changed to a privileged role, the countdown begins and when the countdown ends, the user is reverted back to a basic role.

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • No, but not enable expiry by default then manually add expiry dates to any user with the specific role.

    Or, you can easily create your own code to add the relevant expiry data to users of that role, hence they will be the only users getting an expiry date.

    In fact it’s pretty simple to do any variation(s) that you want since it simply stores expiry data against each user as metadata in the wp_usermetadata table of the database.

    It looks like I’ll have to do it manually.

    Thanks for the help.

    Hello sharcs I have the same need to make the plugin active only for a type of user role. Have you already made the change to make the plugin work only for a specific user role?

    Thanks

    Sorry I haven’t, but if I find a solution I’ll let you know – if you find one first then please let me know.

    TWIR

    (@mtgarmorydotcom)

    Did you ever find a way to do this? I am pretty sure you can using the expire users hook just I am unsure of the logic for it to work.

    https://github.com/benhuson/expire-users/wiki/expire_users_expired

    <?php
    function my_expire_users_expired( $user ) {
    /*
    $user is an instance of the Expire_User object
    The user’s ID is $user->user_id
    */
    }
    add_action( ‘expire_users_expired’, ‘my_expire_users_expired’ );
    ?>

    Basically you need to write the logic to be when a user expires it moves them to the new user role and sets them to never expire.

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