• Resolved LCweb

    (@lcweb-projects)


    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 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘AJAX operation fails using custom role user’ is closed to new replies.