Skip to:
Content
Pages
Categories
Search
Top
Bottom

WP Nonce problem

  • Hey guys, first off thanks for this awesome forum solution!!

    I have been able to customize it pretty well with my wordpress installation, take a look here..

    http://www.designsaga.com/forum

    I am having some problems with nonce verification with my forms. I couldn’t find where the hidden form fields are being output so I was adding them in manually like this..

    <button id = 'postformsub' type = 'submit' name = 'Submit' tabindex = '4'></button>

    <?php if ( function_exists('wp_nonce_field') ) { wp_nonce_field('_wpnonce', '_wpnonce'); ?>
    <input type="hidden" value="/forum/topic.php?id=<?php echo get_forum_id(); ?>" name="_wp_http_referer">
    <input type="hidden" value="<?php echo get_forum_id(); ?>" name="topic_id">

    </form>

    The form was working great but after the nonce expired I keep getting this message when trying to submit the form..

    Your attempt to create this topic has failed.

    Please try again.

    Back to Support Forum.

    I’m just not sure what I should do.. any help is appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Sorry, I post this and I immediately find the solution here..

    http://phpxref.ftwr.co.uk/bbpress/nav.html?_functions/index.html

    I edited my code like this..

    <button id = 'postformsub' type = 'submit' name = 'Submit' tabindex = '4'></button>

    <?php bb_nonce_field( bb_is_topic() ? 'create-post_' . $topic->topic_id : 'create-topic' ); ?>
    <input type="hidden" value="/forum/topic.php?id=<?php echo get_forum_id(); ?>" name="_wp_http_referer">
    <input type="hidden" value="<?php echo get_forum_id(); ?>" name="topic_id">

    And it seems to work now. If anyone is making their own forms then try this solution out for nonce.

    Sorry, I post this and I immediately find the solution here..

    http://phpxref.ftwr.co.uk/bbpress/nav.html?_functions/index.html

    I edited my code like this..

    <button id = 'postformsub' type = 'submit' name = 'Submit' tabindex = '4'></button>

    <?php bb_nonce_field( bb_is_topic() ? 'create-post_' . $topic->topic_id : 'create-topic' ); ?>
    <input type="hidden" value="/forum/topic.php?id=<?php echo get_forum_id(); ?>" name="_wp_http_referer">
    <input type="hidden" value="<?php echo get_forum_id(); ?>" name="topic_id">

    And it seems to work now. If anyone is making their own forms then try this solution out for nonce.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar