Nonce error: It looks like you don't have permission to do that.

So more problem: When a user does not login or just a visitor, when they try to ask a question and hit "Registrar/Login and submit", it return this error message:

Nonce error: It looks like you don't have permission to do that.

But when just answer a question as not login visitor, and hit the same "Registrar/Login and submit" button, they are correctly forward to my registrar page which is a Page using Buddypress registrar Page template.

What went wrong?

  • Elliott Bristow
    • The Bug Hunter

    Hi @hughred22,

    When users hit the "Register/Login and submit" button, which page are they being forwarded to? It sounds like they may be being directed to the wrong page (perhaps by another plugin intercepting the redirection?).

    Could you provide a link to the Q&A page so that we can see what's happening for our selves?

  • hughred22
    • Site Builder, Child of Zeus

    Currently the site is in my local development server (localhost). I have BuddyPress and use its default registration page with the template.

    The URL for the error is still http://localhost/CU/questions/, it does not show me other URL.

    I will need something to upload that onto the live server to demo the error for you. What is the "Registrar/Login and submit" button do and in what order does this send user to? Wp-login.php ? BuddyPress Registrar Page? Can I decide what registrate landing page I want to send user to?

    I kinda want to create a new system as well. Maybe just a Bootstrap Modal pop up with login window (using #divname) instead of redirecting to other page?

  • Elliott Bristow
    • The Bug Hunter

    hmmm... it's tricky troubleshooting a site when we can't see the error ourselves. It's difficult to visualise the exact problem and we can't "view source" to see if there is anything out of place. If there is any way you can get a version of the site onto a live server it would be useful... especially considering the fact that part of the problem could be the configuration of your local server.

    As far as the order of the functions is concerned, I'm afraid I would have to defer to the developer for that one as I'm not sure on the exact flow. I'll tag the developer to ask him to take a look.

    The modal pop-up idea would be beyond what this plugin is designed to do. You may be able to find a developer to assist you with that on our Job Board at https://premium.wpmudev.org/wpmu-jobs if you wanted to give that a try?

  • hughred22
    • Site Builder, Child of Zeus

    Okay, I made the site live and it does redirect to my buddypress registrar page. But the UX is horrible.

    So for a visitor to post a question, it redirect them to registrar page which is normal. But after successful registrar, it redirect them to a page to ask them to activate their account via email. They did not login or redirect back to their question... I will want after successful registrar, it will redirect them back to the question they just post or a Thank you page I set up in the Q and A setting page.

    How can I do that?

    Please def cc your developer. I do not want to Job Board it. I just need to know how you hook the "Registrar/Login and submit". B/c it is pretty BAD UX to send user away to buddypress register page if they already have an account with us. Just provide them a very easy login and get back to posting question and answering question business. If the button is just a tag, I can trigger a modal, easy. But I need to know how you write the logic to make this happen

    Thanks!

  • Elliott Bristow
    • The Bug Hunter

    Sorry for the delay in getting back to you.

    The Q&A plugin would normally only direct users to the registration page if they are not logged in. If the plugin is directing people who ARE logged in then this could be a bug, or perhaps a compatibility issue between Q&A and BuddyPress.

    I'm going to ask the developer for his comments to help us establish exactly what's happening here.

  • Arnold
    • El Macho WP

    Best way to do it is require them to register before they can enter a Question or Answer. Set the QA Visitor to only View. Use a hook on the template like "qa_after_answers' To insert a block like "If you would like to post a question/answer, please register" with a link off to the registration form. Part of the problem is BuddyPress is inserting it's own registration process which doesn't know about QA.

    If you want them to post unregistered you should use the "Question is assigned to a user" and setupan "Anonymouise" user to assign the posts to.

  • hughred22
    • Site Builder, Child of Zeus

    For your solution 1, can you give me an example of "Use a hook on the template like "qa_after_answers' To insert a block like "If you would like to post a question/answer, please register" with a link off to the registration form."

    - How to use "qa_after_answers" hook? An example will be great!
    - Where to insert "qa_after_answers" hook? Which template I need to insert this hook?

    I need the help in the php and logic part for this hook.

    Second, I do want visitor to post and answer question, but I want them to registar since the Q and A is a lead gen system for me (the reason why I purchased it).

    So I will like to keep the "Registrar/Login and submit" button. But after they click it, I want to pop a JavaScript power modal (like the Twitter Bootstrap Modal) for quick login without page load. And in the modal, I can redirect them if they need to registar. So I can send them somewhere instead of BuddyPress registration form, or to my social 1-click login in (or using your Facebook login). This to me is UX friendly.

    In order to do this, I will need the modify the on click "Registrar/Login and submit" event. So where is this code and logic to show this code? We can start from here and I will look at the code to see how to insert a onclick with jQuery to trigger my Modal.

  • Arnold
    • El Macho WP

    If you look through the qa templates you'll see a bunch

    do_action('qa-something');

    calls. Those are standard WP action hooks.A simple example would be add to your child function.php

    function qa_display_register(){
     Do whatever you need to display
    }
    
    add_action('qa_after_answers', 'qa_display_register');

    Now when ever the template calls do_action your function will be called. See:

    http://codex.wordpress.org/Function_Reference/add_action

    The button would be in core.php function get_the_qa_submit_button()

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.