• Resolved Achim

    (@ar7)


    In my eyes, if a subscriber creates a doc and attaches it as child to another doc, he CHANGES that other doc.

    Is it possible to prevent that?

    THANK YOU, kind regards,

    Achim

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

    (@dcavins)

    Hi a.r.7-

    Similar to my other answer, if I look in templates/single/docs/edit.php for the section that outputs the “parent doc” form field, I find this line:
    apply_filters( 'bp_docs_allow_parent_doc_setting', true, $doc_id )
    The following code filters that value, allowing contributors and up to use the parent field, excluding subscriber-level users:

    
    add_filter( 'bp_docs_allow_parent_doc_setting', 'my_bpd_disallow_parent_field' );
    function my_bpd_disallow_parent_field( $retval ) {
    
        if ( ! current_user_can( 'edit_posts' ) ) {
            $retval = false;
        }
    
        return $retval;
    }
    

    See https://codex.wordpress.org/Roles_and_Capabilities to see how I chose the capability to check.

    Thread Starter Achim

    (@ar7)

    This works fine for me, THANK YOU.

    (In my eyes the best way would be, if everybody could only choose a doc as parent, if he is allowed to edit that doc. Would that be very complicated to implement?)

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Prevent subscribers from making childs?’ is closed to new replies.