• samso

    (@samso)


    Dear Support Team,

    I hope this message finds you well. I am currently using the Restrict User Access plugin on my WordPress site, and I am encountering an issue when trying to assign the user access level “Zona Cliente” to a specific user.

    I have more than 1000 users on my site, and manually assigning the access level to each user is not feasible. I attempted to assign the level programmatically via a custom code snippet, but it does not seem to work as expected. The code I’m using is as follows:

    function assign_user_level() {
    $username = ‘cliente-prueba’;
    $user = get_user_by(‘login’, $username);

    if ($user) {
        $level_id = 'Zona Cliente';
        rua_get_user($user->ID)->add_level($level_id);
    }

    }
    add_action( ‘init’, ‘assign_user_level’ );

    Unfortunately, the user does not receive the assigned access level, and I do not see any confirmation message or changes. I have also enabled debugging on my site, but the issue persists.

    Could you please guide me on how to correctly assign the access level to multiple users, or if there’s an alternative method to achieve this on a larger scale? Additionally, I would appreciate it if you could confirm whether the function rua_get_user() is the correct way to interact with users’ access levels.

    Given the large number of users (over 1000), I need an automated solution, as manual updates are not practical.

    Many thanks for your attention and help,

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Issue Assigning User Access Level with Restrict User Access Plugin’ is closed to new replies.