Conversation
supportHi. When I try to edit my resume (I created years ago), the page seems to work, yet, changes aren’t saved. In the HTML the nonce is present on the <resumes ...> component, but is not passed on in the ajax call to save the changes. Weird thing is; I downloaded my entire website and tried it in LocalWP, and everything works fine. … I don’t understand 😉 Would you be willing to share a less minified version of the javascript so I can try to figure out what is going wrong? Thanks.
Hello @rmpel did you resolve your issue? I have exactly the same problem.
– deleted – This reply was modified 2 months, 3 weeks ago by Acato .
Hi @ante1974 , no unfortunately not. (And sorry for the comment above, I was logged in with my employers account, if a mod can remove it, that would be great)
I had this Issue for more than 7 Months now. Thanks @rmpel I did some digging and noticed the nonce is not set properly. I assume the call in templates/admin/resume.php setting the nonce is not made in the proper order? Following this guide: https://developer.wordpress.org/news/2023/08/understand-and-use-wordpress-nonces-properly/ The init function must have been called first, which I assume is not the case because the nonce is empty. However the nonce for the wordpress api is set in a callback (in class.resume-builder-admin-enqueues.php) and this apparently works. There are different ways to address this, for example by adding the required nonce (rb_edit_resumes_nonce) to a global variable and retrieving it in main.js from this variable instead of this.opts. However I compared version 3.2 with 3.1.1 and noticed the check $_POST['rb_edit_resumes_nonce'] ) && wp_verify_nonce( sanitize_key( $_POST['rb_edit_resumes_nonce'] ), 'rb_edit_resumes' ) was only added in the latest version to “class.resume-builder-core.php”, so I simply removed it (pay attention not to mess up the braces when you want to do this) Its not pretty, but it works, and I don’t think the nonce adds a lot to the security, as no permissions are checked anyways. Edit: I actually signed up just to post this. And the pineapple on pizza thing is really not funny, I had to create an additional account because of it. Another Edit: It would probably make much more sense to use the settings field as mentioned in the article. https://developer.wordpress.org/reference/functions/settings_fields/ This reply was modified 2 months, 2 weeks ago by martinsac . This reply was modified 2 months, 2 weeks ago by martinsac .
Hello @rmpel did you resolve your issue? I have exactly the same problem.
– deleted – This reply was modified 2 months, 3 weeks ago by Acato .
Hi @ante1974 , no unfortunately not. (And sorry for the comment above, I was logged in with my employers account, if a mod can remove it, that would be great)
I had this Issue for more than 7 Months now. Thanks @rmpel I did some digging and noticed the nonce is not set properly. I assume the call in templates/admin/resume.php setting the nonce is not made in the proper order? Following this guide: https://developer.wordpress.org/news/2023/08/understand-and-use-wordpress-nonces-properly/ The init function must have been called first, which I assume is not the case because the nonce is empty. However the nonce for the wordpress api is set in a callback (in class.resume-builder-admin-enqueues.php) and this apparently works. There are different ways to address this, for example by adding the required nonce (rb_edit_resumes_nonce) to a global variable and retrieving it in main.js from this variable instead of this.opts. However I compared version 3.2 with 3.1.1 and noticed the check $_POST['rb_edit_resumes_nonce'] ) && wp_verify_nonce( sanitize_key( $_POST['rb_edit_resumes_nonce'] ), 'rb_edit_resumes' ) was only added in the latest version to “class.resume-builder-core.php”, so I simply removed it (pay attention not to mess up the braces when you want to do this) Its not pretty, but it works, and I don’t think the nonce adds a lot to the security, as no permissions are checked anyways. Edit: I actually signed up just to post this. And the pineapple on pizza thing is really not funny, I had to create an additional account because of it. Another Edit: It would probably make much more sense to use the settings field as mentioned in the article. https://developer.wordpress.org/reference/functions/settings_fields/ This reply was modified 2 months, 2 weeks ago by martinsac . This reply was modified 2 months, 2 weeks ago by martinsac .