• Resolved srujan20

    (@srujan20)


    Memphis is a great tool thank you for building it.
    I recently installed BBpress plugin, which introduced new roles for forum to all users, technically creating dual role for each user. I believe this is interfering with the permission status of the file. Even subsribers are now able to view the files that are set to PS=private.

    Could you please point me to the php file where I can filter the new roles.

    https://wordpress.org/plugins/memphis-documents-library/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author bhaldie

    (@bhaldie)

    you took a look at mdocs settings already, and made sure those roles are not active when viewing private posts.

    Thread Starter srujan20

    (@srujan20)

    Thank you for the quick response. When I look at the the Memphis options, I see only options for Editor, Author, Contributor and subscriber. but when I look at the DB for user meta table, now each user has 2 roles
    a:2:{s:13:”administrator”;b:1;s:13:”bbp_keymaster”;b:1;}
    a:2:{s:13:”administrator”;b:1;s:13:”bbp_moderator”;b:1;}
    a:2:{s:10:”subscriber”;b:1;s:15:”bbp_participant”;b:1;}

    The new roles for Forum introduced by bbpress are
    1. Keymaster,
    2. Moderator
    3. Participant
    4. Spectator.

    I would like to edit the code so that any users with Main role as Editor, Author, Contributor in combination with any of the forum roles to have access to the documents.

    In simpler words, I want to ignore the role returned for Forum and purely take the main site roles into consideration.

    Plugin Author bhaldie

    (@bhaldie)

    you can take a look at mdocs-rights.php line 37 is the function mdocs_check_posts_rights.

    function mdocs_check_post_rights($the_mdoc) {
    	global $current_user;
    	if(empty($current_user->roles)) $current_user->roles[0] = 'none';
    	$hide_all_post = get_option('mdocs-hide-all-posts');
    	$hide_all_post_non_members = get_option('mdocs-hide-all-posts-non-members');
    	$mdocs_view_private = get_option('mdocs-view-private');
    	$post_status = get_post_status($the_mdoc['parent']);
    	$is_allow = false;
    	// ADMINS GET FULL RIGHTS FOR EVERY FILE
    	if(current_user_can( 'manage_options' )) $is_allowed = true;
    	// OWNER RIGHTS
    	if($current_user->user_login == $the_mdoc['owner']) $is_allowed = true;
    	// VIEW PRIVATE POSTS
    	foreach($mdocs_view_private as $index => $role) {
    		if(in_array($index, $current_user->roles)) { $is_allow = true; break; }
    	}
    	// PUBLIC POST ONLY
    	if($post_status == 'publish') {
    		// HIDE ALL POSTS
    		if($hide_all_post == false && $hide_all_post_non_members == false) $is_allow = true;
    		// HIDE ALL POST NON MEMBERS
    		if(is_user_logged_in() == true && $hide_all_post_non_members == true) $is_allow = true;
    	}
    	return $is_allow;
    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Permission for private post’ is closed to new replies.