• Resolved Jory Hogeveen

    (@keraweb)


    I can’t figure out a capability configuration.

    For admins and super admins (network) overwriting files etc. works fine.
    However, I also created roles for users that are only allowed to manage downloads, nothing more.
    For this to work I modified the capability_type parameter for the wpdmpro post type.
    (Code example below)

    
    add_filter( 'register_post_type_args', 'register_wpdmpro_args', 10, 2 );
    function register_wpdmpro_args( $args, $name ) {
    	if ( 'wpdmpro' === $name ) {
    		// Custom capability for downloads.
    		$args['capability_type'] = $name;
    	}
    	return $args;
    }
    

    https://codex.www.ads-software.com/Function_Reference/register_post_type#capability_type
    This way I can separate edit_post and edit_wpdmpro capabilities.
    Unfortunately users who can’t access posts cannot overwrite wpdmpro posts.
    Is there a better way to configure such roles/capabilities?

    Recap: The idea is to create a role that ONLY has access to the downloads, nothing more.

    Thanks in advance!
    Cheers, Jory

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Capability for overwriting/uploading files’ is closed to new replies.