Support » Plugin: Multisite User Management » [SOLVED] Don't work using 4.3.2 and Active Directory

  • Cyssoo

    (@cyssoo)


    Plugin doesn’t work in WP 4.3.2
    Active directory installed.
    Solved deleting multisite-user-management plugin, and adding these functions in theme :

    //No Reader Role
    function add_role_noread() {
       add_role( 'none_role', 'Aucun droit', array( 'read' => false, 'level_0' => true ) );
    }
    add_action('admin_init', 'add_role_noread', 10, 0);
    
    //Add user to all blogs
    function ds_new_user_meta($user_id) {
    	$blog_list = wp_get_sites();
    	$none_role = 'none_role';
    	$subscriber = 'subscriber';
    	$user_blogs = get_blogs_of_user( $user_id );
    	foreach ($blog_list as $blog) {
    		//Get blog name by ID in loop
    		$blog_details = get_blog_details($blog['blog_id']);
    			//If blog is locked
    			if(!is_user_member_of_blog( $user_id, $blog['blog_id']) && get_blog_option($blog['blog_id'],'blogsecure')){
    				//Add user with none role
    				add_user_to_blog($blog['blog_id'], $user_id, $none_role);
    			} else if (!is_user_member_of_blog( $user_id, $blog['blog_id'])){
    				//Add user with subscriber role
    				add_user_to_blog($blog['blog_id'], $user_id, $subscriber);
    			} else {
    				//Do nothing
    			}
    	}
    }
    
    add_action( 'user_register', 'ds_new_user_meta', 10, 2);
    // add_action( 'wpmu_new_blog', 'ds_new_user_meta', 10, 2 );
    
    function login_new_user_meta($login) {
    	$user = get_userdatabylogin($login);
    	$user_id = $user->ID;
    	$blog_list = wp_get_sites();
    	$none_role = 'none_role';
    	$subscriber = 'subscriber';
    	$user_blogs = get_blogs_of_user( $user_id );
    	foreach ($blog_list as $blog) {
    		//Get blog name by ID in loop
    		$blog_details = get_blog_details($blog['blog_id']);
    			//If blog is locked
    			if(!is_user_member_of_blog( $user_id, $blog['blog_id']) && get_blog_option($blog['blog_id'],'blogsecure')){
    				//Add user with none role
    				add_user_to_blog($blog['blog_id'], $user_id, $none_role);
    			} else if (!is_user_member_of_blog( $user_id, $blog['blog_id'])){
    				//Add user with subscriber role
    				add_user_to_blog($blog['blog_id'], $user_id, $subscriber);
    			} else {
    				//Do nothing
    			}
    	}
    }
    add_action('wp_login', 'login_new_user_meta');

    https://wordpress.org/plugins/multisite-user-management/

  • The topic ‘[SOLVED] Don't work using 4.3.2 and Active Directory’ is closed to new replies.