• Resolved carlgagnon

    (@carlgagnon)


    Hi, I have a WordPress Multisite Website with three WooCommerce private stores and users are not deleted when I check the option “Delete users that are not present in the CSV?”

    Users present in the CSV are updated but not deleted when they are not in the file.

    Thank you in advance for your help !!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Javier Carazo

    (@carazo)

    If you have some kind of error or warning in the users import results, it won’t delete any user (as a precaution measure).

    Thread Starter carlgagnon

    (@carlgagnon)

    Hello Javier, nice it’s working perfectly, thank you very much for the quick response !!!
    Is there a way to protect users with another role, if I create a new role called “do_not_delete” and I add this role as Other Role, can I protect those users?

    Thank you for your help

    Plugin Author Javier Carazo

    (@carazo)

    Sorry I do not understand really well your question.

    Thread Starter carlgagnon

    (@carlgagnon)

    I’m using the “Delete users not in CSV file” option during imports.

    In my use case, I need to protect certain users from deletion, even if they are not present in the CSV file.

    Is there a built-in method (or a filter) to exclude specific users, besides admins (for example, users with a specific role or a custom meta flag), from being deleted when this option is enabled?

    I hope my question is clearer?

    Thank you for your support!

    Plugin Author Javier Carazo

    (@carazo)

    Currently, there is no way to do this, but if it’s enough for you, I can prepare a hook here:

    $args = array(

    ‘fields’ => array( ‘ID’ ),

    ‘role__not_in’ => $exclude_roles,

    ‘exclude’ => array( get_current_user_id() ), // current user never cannot be deleted

    );

    Would that work for you? In the exclude, you could add user_ids to exclude.

    Thread Starter carlgagnon

    (@carlgagnon)

    Yes, that would be perfect. Please go ahead and add the hook as you suggested — being able to use role__not_in and exclude to protect users from deletion would fully cover my needs.

    This is very much appreciated, thank you for your support!

    Plugin Author Javier Carazo

    (@carazo)

    Hook added:

    $args = array( 
    'fields' => array( 'ID' ),
    'role__not_in' => $exclude_roles,
    'exclude' => apply_filters( 'acui_exclude_users_to_delete', array( get_current_user_id() ) ), // current user never cannot be deleted
    );

    It will be available in minutes.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Users not deleted’ is closed to new replies.