• Resolved designer13421321

    (@nistuj817)


    I just created a user account and assigned the guy to be a contributor. When I signed into his account as a contributor, I noticed the Quotes and Invoices tabs on the left hand side were displaying. I also saw that he can create an invoice. I need to know how to disable this so that only admins can view and create invoices / quotes.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author SlicedInvoices

    (@slicedinvoices)

    You could try something like the following:

    function sliced_custom_params_admins_only( $opts ) {
    	$opts['map_meta_cap'] = false;
    	$opts['capabilities'] = array(
    		'edit_post'          => 'manage_options',
    		'read_post'          => 'manage_options',
    		'delete_post'        => 'manage_options',
    		'edit_posts'         => 'manage_options',
    		'edit_others_posts'  => 'manage_options',
    		'delete_posts'       => 'manage_options',
    		'publish_posts'      => 'manage_options',
    		'read_private_posts' => 'manage_options',
    	);
    	return $opts;
    }
    add_filter( 'sliced_invoice_params', 'sliced_custom_params_admins_only' );
    add_filter( 'sliced_quote_params', 'sliced_custom_params_admins_only' );

    Simply add this code to your (child) theme’s functions.php file, and it should do what you want.

    It uses the filters ‘sliced_invoice_params’ and ‘sliced_quote_params’ to change the capabilities required — in this case, ‘manage_options’ is only available to admins.

    Thread Starter designer13421321

    (@nistuj817)

    I had entered the code into my child theme function.php file, and I’m seeing this message appear. Just want to make sure the code is correct before saving. Here’s a screenshot for you to review.

    https://gyazo.com/90919ccf27f3f0b88ca6f228154994a2

    Plugin Author SlicedInvoices

    (@slicedinvoices)

    The code I see in your screenshot definitely won’t work… all the single quotes (‘) have been converted into html entity codes. I would try pasting it into a plain text editor first (for example, Notepad), and then copy & paste from there to it’s final destination. It should look exactly the same as it appears above on this page.

    Plugin Author SlicedInvoices

    (@slicedinvoices)

    …and if that doesn’t work, try copy and pasting from here instead: https://gist.github.com/grantalltodavid/b707a53dc2c1b10f4a9e425721dc23af

    Thread Starter designer13421321

    (@nistuj817)

    My bad. It works now. Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Contributor can make invoices & quotes’ is closed to new replies.