• Resolved hommealone

    (@hommealone)


    I’ve previously posted a question asking for advice on how to allow WordPress users with the role of Editor to access Store Sales. (https://wordpress.org/support/topic/let-editor-role-view-sales-logs?replies=1) The topic was closed without any answers. I’m hoping that now someone can give some suggestions. Here again is my question:

    I want users with “Editor” capabilities to be able to view the “Store Sales” log. Although I believe that this is NOT how the plugin is designed (correct?)

    I expected WPeCommerce to provide a setting to determine what roles have access to the “Store Sales” logs; it does not.

    I hacked the plugin – although this is just a temporary solution:
    In wp-e-commerce/wpsc-admin/admin.php edit line 220, replace “administrator” with ‘7’

    $purchase_logs_cap = apply_filters( 'wpsc_purchase_logs_cap', '7' );

    This worked, but I would like a more ‘durable’ solution that doesn’t require hacking the plugin files.

    Any suggestions appreciated.

    https://wordpress.org/plugins/wp-e-commerce/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Justin Sainton

    (@justinsainton)

    Hi hommealone,

    As you can see, we provide a filter to the capability so you can change it without hacking core.

    In a custom plugin or in your theme’s functions.php file, you could add the following:

    add_filter( 'wpsc_purchase_logs_cap', function() { return 'edit_posts'; }

    Thread Starter hommealone

    (@hommealone)

    I’ve hooked into the filter like this, and it seems to be working:
    (in my fuctions.php file…)

    /**
     *
     * Filter to allow users with Editor role to access WP E-commerce sales figures.
     *
     */
    function my_wpsc_purchase_logs_cap() {
    	return '7';
    }
    add_filter('wpsc_purchase_logs_cap','my_wpsc_purchase_logs_cap');

    Does this seem correct?

    Plugin Author Justin Sainton

    (@justinsainton)

    Looks good! I’d probably not use ‘7’, but if it’s working, then it’s working!

    Thread Starter hommealone

    (@hommealone)

    Thanks Justin, much appreciated!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Allow editor role access to sales information’ is closed to new replies.