I am using the latest version of wp-ecommerce (3.89) and a new filter has been introduced to enable role based access to certain dashboard features such as the sales page or upgrade capability. However, the default role in the core file is currently set to "administrator".

What I would like to do is take the original filter and modify it by placing the modified code in my functions file to over-ride that.

So how to modify this: (from plugin file wp-ecommerce/wpsc-admin/admin.php

$purchase_logs_cap = apply_filters( 'wpsc_purchase_logs_cap', 'administrator' );
$page_hooks[] = $purchase_logs_page = add_submenu_page( 'index.php', __( 'Store Sales', 'wpsc' ), __( 'Store Sales', 'wpsc' ), $purchase_logs_cap, 'wpsc-purchase-logs', 'wpsc_display_purchase_logs_page' );

to something like this

remove_filter('wpsc_purchase_logs_cap', 'administrator');
function sh_wpsc_admin_pages($purchase_logs_cap) {
apply_filters( 'wpsc_purchase_logs_cap', 'editor' );


1 Answer 1


The filter exists to avoid the need for replacements in the plugin code.

What you probably need is:

add_filter( 'wpsc_purchase_logs_cap', 'wpse_72095_admin_to_editor' );

function wpse_72095_admin_to_editor()
    return 'edit_others_posts';

This will change the capability/role to editor.

  • Ah that was it, thank you. I couldn't quite get the syntax ! Commented Nov 10, 2012 at 3:16
  • Hmmm it seems that although this now give access to the editor, it also removes access for the administrator. Is it possible to define both ? Commented Nov 10, 2012 at 4:22
  • It is better to ask for a real capability than for a role. I changed the sample code.
    – fuxia
    Commented Nov 10, 2012 at 4:27
  • Doh - why didn't I think of that! Thanks dude. Commented Nov 10, 2012 at 4:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.