HEX
Server: Apache
System: Linux webd006.cluster128.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: zwafgyp (177615)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/zwafgyp/coolswim/wp-content/plugins/sitepress-multilingual-cms/classes/roles/Roles.php
<?php

namespace WPML;

use WPML\LIB\WP\Hooks;
use WPML\LIB\WP\User;
use WPML\LIB\WP\Roles as WPRoles;
use function WPML\FP\spreadArgs;

class Roles implements \IWPML_Backend_Action, \IWPML_AJAX_Action {

	public function add_hooks() {
		Hooks::onAction( 'set_user_role', 10, 3 )->then( spreadArgs( [ self::class, 'remove_caps' ] ) );
	}

	public static function remove_caps( $userId, $role, $oldRoles ) {
		if ( ! WPRoles::hasCap( 'manage_options', $role ) ) {
			$user = User::get( $userId );

			wpml_collect( DefaultCapabilities::getKeys() )
				->map( [ $user, 'remove_cap' ] );
		}
	}
}