• Resolved Steel Rat

    (@steel-rat)


    I see in the description of the plugin that there are varying levels of privacy for docs. But that only seems to be settable if you’re an admin and editing the doc page in the WP admin section. As a group owner, there are no privacy settings at all.

    Are there plans to be able to allow group owners to restrict doc access to specific group members?

    Thanks.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author David Cavins

    (@dcavins)

    Yes, the default behavior is to reserve the bp_docs_manage capability to the doc author (creator), but you can add a filter if you want group mods and admins to be able to do more than disassociate docs from the group (which is the standard behavior). You can add this filter, https://gist.github.com/dcavins/399cf7e0c7affcd475ac8bd5f46cada9, to your bp-custom.php file. Read more about bp-custom here: https://codex.buddypress.org/themes/bp-custom-php/

    Thread Starter Steel Rat

    (@steel-rat)

    Ok, I added the code you linked into bp-custom.php. But, I’m not sure what I should see that’s different. The only things I’m seeing are “unlink from group” when I mouseover a doc in the listing. And when editing, only Permanently Delete seems different.

    I was hoping for some ability to have documents that only the group admin can see, or that selected group members could see, selected by the group admin/owner.

    Plugin Author David Cavins

    (@dcavins)

    The code I provided enables the “Access” pane on the doc edit screen for group-related docs if the current user is a group mod or admin.

    BP Docs natively has the ability for you to create a doc and set the “read” capability to “Admins and Mods of {Group Name}”, so you don’t need to change anything to do that.

    Thread Starter Steel Rat

    (@steel-rat)

    I’m not seeing an “Access” pane when editing a doc I created, both as site admin and group owner.

    Here is the content of bp-custom.php, which was uploaded to wp-content/plugins:

    <?php
    // hacks and mods will go here
    
    add_filter( 'bp_docs_map_meta_caps', 'bp_docs_groups_allow_group_admins_to_manage_access', 20, 4 );
    function bp_docs_groups_allow_group_admins_to_manage_access( $caps, $cap, $user_id, $args ) {
    	// We only want to act on the "manage" capability, in group situations.
    	if ( 'bp_docs_manage' !== $cap ) {
    		return $caps;
    	}
    	$doc = bp_docs_get_doc_for_caps( $args );
    	if ( empty( $doc ) ) {
    		return $caps;
    	}
    
    	$group_id = bp_docs_get_associated_group_id( $doc->ID, $doc );
    
    	// If not associated with a group, nothing to do here
    	if ( ! $group_id ) {
    		return $caps;
    	}
    
    	if ( groups_is_user_admin( $user_id, $group_id ) || groups_is_user_mod( $user_id, $group_id ) ) {
    		$caps = array( 'exist' );
    	}
    
    	return $caps;
    }
    ?>
    Plugin Author David Cavins

    (@dcavins)

    You should be seeing an Access panel on the edit screen, as shown in this image: https://imgur.com/Jl4mS28

    If you are not seeing the Access panel for a doc you created that suggests that you’re using a very customized installation.

    Thread Starter Steel Rat

    (@steel-rat)

    I haven’t customized anything outside the WP interface, apart from some custom CSS to get rid of annoying round avatars.

    Thread Starter Steel Rat

    (@steel-rat)

    At any rate, this wouldn’t really get me where I need to be. I was hoping for the option to make a doc visible to only the author and specified group members.

    Still not sure why the access pane doesn’t show for me. My WP is not heavily modified, only additional CSS. I can post that if you think it might be causing problems.

    Plugin Author David Cavins

    (@dcavins)

    Honestly, I’m not sure what you’re trying to do. However, associating a doc with a group and making it readable only by members of that group is one of the default access options for group-associated docs.

    If your single-doc edit screen doesn’t look something like this (https://imgur.com/a/DUorRgN), my first troubleshooting step would be to try another theme temporarily.

    Thread Starter Steel Rat

    (@steel-rat)

    As I mentioned, I would like the ability for a group owner to set doc visibilty to a specified group member or members, not always to all members of the group. So being able to select one or more group members from either a list or autofill fields.

    I’m using the Colormag theme. I tried EXS, and still do not see the access panel.

    Is it possible to put the function in a different place that might work better?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Group owner can’t set doc privacy?’ is closed to new replies.