Private Messenger disallows attachments if primary user role is participant.

There isn't an option to select the "participant" role from the roles allowed to upload attachments... this is a problem for me because the default role of my folks on the main blog is "participant". It is a multisite network and folks don't get assigned any role other than participant (on the main blog) unless they join another blog -- but I still want their private messaging capabilities to include uploads, even if they haven't joined a blog yet. Is there a work-around for this? And/or any prospects for the developer to add "participant" as an option in the settings to receive upload permissions? Thanks!

  • Alex Stine

    Hello xbladerunner
    Hope you are having a great day!

    Could you please add this code in a mu-plugin? To create a mu-plugin, access your site via FTP or File Manager, navigate to /wp-content and create a new directory named mu-plugins. Inside this folder, create a file with a .php extension.

    <?php
    add_filter( 'bbp_get_caps_for_role', 'ST_add_role_caps_filter', 10, 2 );
    add_action( 'admin_init', 'ST_add_role_caps_filter');
    
    function ST_add_role_caps_filter( $caps, $role ){
        // Only filter for roles we are interested in!
        if( $role == 'bbp_participant' ) {
    
    	$new_caps = array(
                    // Primary caps
                    'spectate'              => true,
                    'participate'           => true,
                    'moderate'              => false,
                    'throttle'              => false,
                    'view_trash'            => false,
    
                    // Forum caps
                    'publish_forums'        => false,
                    'edit_forums'           => false,
                    'edit_others_forums'    => false,
                    'delete_forums'         => false,
                    'delete_others_forums'  => false,
                    'read_private_forums'   => false,
                    'read_hidden_forums'    => false,
    
                    // Topic caps
                    'publish_topics'        => true,
                    'edit_topics'           => true,
                    'edit_others_topics'    => false,
                    'delete_topics'         => false,
                    'delete_others_topics'  => false,
                    'read_private_topics'   => false,
    
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => false,
                    'delete_replies'        => false,
                    'delete_others_replies' => false,
                    'read_private_replies'  => false,
    
                    // Topic tag caps
                    'manage_topic_tags'     => false,
                    'edit_topic_tags'       => false,
                    'delete_topic_tags'     => false,
                    'assign_topic_tags'     => true,
    // Custom CAP
    'upload_files'     => true,
                );	
    
    	}
    
        return $new_caps;
    }
    ?>

    Please let me know how it goes.

    Cheers,
    Alex :smiley:

  • Alex Stine

    Hello xbladerunner
    Hope you are well today!

    My teammate Dimitris helped me come up with this code revision, could you please give it a try in the same mu-plugin after replacing the existing code?

    <?php
    add_filter( 'bbp_get_caps_for_role', 'ST_add_role_caps_filter', 10, 2 );
    add_action( 'admin_init', 'ST_add_role_caps_filter');
    
    function ST_add_role_caps_filter( $caps, $role='' ){
        // Only filter for roles we are interested in!
        if( $role == 'bbp_participant' ) {
    
    	$caps = array(
                    // Primary caps
                    'spectate'              => true,
                    'participate'           => true,
                    'moderate'              => false,
                    'throttle'              => false,
                    'view_trash'            => false,
    
                    // Forum caps
                    'publish_forums'        => false,
                    'edit_forums'           => false,
                    'edit_others_forums'    => false,
                    'delete_forums'         => false,
                    'delete_others_forums'  => false,
                    'read_private_forums'   => false,
                    'read_hidden_forums'    => false,
    
                    // Topic caps
                    'publish_topics'        => true,
                    'edit_topics'           => true,
                    'edit_others_topics'    => false,
                    'delete_topics'         => false,
                    'delete_others_topics'  => false,
                    'read_private_topics'   => false,
    
                    // Reply caps
                    'publish_replies'       => true,
                    'edit_replies'          => true,
                    'edit_others_replies'   => false,
                    'delete_replies'        => false,
                    'delete_others_replies' => false,
                    'read_private_replies'  => false,
    
                    // Topic tag caps
                    'manage_topic_tags'     => false,
                    'edit_topic_tags'       => false,
                    'delete_topic_tags'     => false,
                    'assign_topic_tags'     => true,
    // Custom CAP
    'upload_files'     => true,
                );	
    
    	}
    
        return $caps;
    }
    ?>

    Please let me know if this works.

    Cheers,
    Alex :smiley:

  • xbladerunner

    Thanks Alex,

    Still not working, the pop up message composer does not include the bottom segment for attachments -- it remains missing for those in the participant role. Cleared cache, etc.

    I'm going back to using the native buddypress messenger, with a separate plugin that adds attachment capabilities to it. The private messenger plugin is much prettier, but -- for now -- the native buddypress messenger is a simpler fix if participants need attachment functionality.

    I remain interested in seeing the private messenger gain buddypress user compatibility (attachments for participant role), and am happy to continue testing if you send things my way. Thanks!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.