Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

AJAX operation fails using custom role user

$
0
0

Replies: 0

Hello,
I have a plugin creating users owning a custom WP role with basic-to-none capabilities.

Here’s the user object log

["caps"]=>
  array(2) {
    ["my-role"]=>
    bool(true)
    ["read"]=>
    bool(true)
  }
  ["cap_key"]=>
  string(15) "wp_capabilities"
  ["roles"]=>
  array(1) {
    [0]=>
    string(10) "my-role"
  }
  ["allcaps"]=>
  array(4) {
    ["read"]=>
    bool(true)
    ["edit_posts"]=>
    bool(false)
    ["delete_posts"]=>
    bool(false)
    ["my-role"]=>
    bool(true)
  }

Ajax operations return -1 because of nonce check fail.
I can’t also update the cart.

I already spent several hours debugging and it’s almost surely a nonce issue, but I’m not understanding why.

NB: It’s a clean dev environment with just my plugin and WooCommerce installed. No extra WP user operations, just a single user logged with that custom role and limited capabilities.

Is there anything I am missing?
Thanks


Viewing all articles
Browse latest Browse all 59525

Trending Articles