Opened 6 years ago
Closed 6 years ago
#3209 closed defect (bug) (fixed)
bbp_is_topic_form_post_request() always returns false while editing a topic
Reported by: | wpdennis | Owned by: | johnjamesjacoby |
---|---|---|---|
Milestone: | 2.6 | Priority: | high |
Severity: | normal | Version: | 2.5 |
Component: | General - UI/UX | Keywords: | commit |
Cc: |
Description
While editing a topic bbp_is_topic_form_post_request() always returns false, because it checks a wrong nonce action:
<?php // Editing an existing topic if ( bbp_verify_nonce_request( 'bbp-edit-topic' ) ) { return true; }
The actual nonce action from bbp_topic_form_fields() contains the topic id:
<?php if ( bbp_is_topic_edit() ) : ?> ... <?php wp_nonce_field( 'bbp-edit-topic_' . bbp_get_topic_id() );
I put this at a high priority because if someone edits an existing topic and there is an error (e.g. forum id or title empty), he loses all changes he made in the editor. That's a real downer.
The solution is probably to change bbp_is_topic_form_post_request() to:
<?php function bbp_is_topic_form_post_request() { // Bail if not a post request if ( ! bbp_is_post_request() ) { return false; } // Creating a new topic if ( bbp_verify_nonce_request( 'bbp-new-topic' ) ) { return true; } // Editing an existing topic if ( bbp_verify_nonce_request( 'bbp-edit-topic_' . bbp_get_topic_id() ) ) { return true; } return false; }
Change History (3)
Note: See
TracTickets for help on using
tickets.
Forums also. Will fix immediately.
Thanks for catching this.