Skip to:
Content

bbPress.org

Opened 9 years ago

Closed 7 years ago

#2817 closed enhancement (fixed)

return WP_Error object when a reply, topic or forum

Reported by: tharsheblows's profile tharsheblows Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.6 Priority: normal
Severity: normal Version: 2.2
Component: Component - Any/All Keywords: commit
Cc:

Description

The error message is used in the template notice. It'd actually be nice to filter these too but I haven't done that. What do you think?

Thinking about it, not sure this is good to add because it's going to change people's error notices, hmm.

Attachments (2)

2817.diff (1.6 KB) - added by tharsheblows 9 years ago.
return WP_Error object on reply / topic / forum failure
2817.2.diff (1.7 KB) - added by tharsheblows 9 years ago.
change which wp_insert_post returns WP Error object in replies/functions.php

Download all attachments as: .zip

Change History (8)

@tharsheblows
9 years ago

return WP_Error object on reply / topic / forum failure

#1 @netweb
9 years ago

Thanks @tharsheblows, take a look the ticket and comments on both #2116 and #1883

I'm leaning towards closing this as a duplicate of #1883 and/or wontfix based on #2116

#2 @tharsheblows
9 years ago

Ah yes, I see what they're saying about the filters. But the wp_insert_post needs to pass true to $wp_error or the error message needs to be changed as it's currently always:
The following problem(s) have been found with your reply:Please try again.

@tharsheblows
9 years ago

change which wp_insert_post returns WP Error object in replies/functions.php

#3 @tharsheblows
9 years ago

I put it in the wrong wp_insert_post in replies/functions.php, argh. This one expects the WP Error object to be returned on failure, the other one doesn't.

Oops, editing to include code to show where it's expecting it, eg in forums/functions.phpL340

// Errors
	} else {
		$append_error = ( is_wp_error( $forum_id ) && $forum_id->get_error_message() ) ? $forum_id->get_error_message() . ' ' : '';
		bbp_add_error( 'bbp_forum_error', __( '<strong>ERROR</strong>: The following problem(s) have been found with your forum:' . $append_error, 'bbpress' ) );
	}
Last edited 9 years ago by tharsheblows (previous) (diff)

#4 @thebrandonallen
8 years ago

@netweb What do you want to do here?

#5 @johnjamesjacoby
7 years ago

  • Component changed from General to Component - Any/All
  • Keywords commit added; dev-feedback removed
  • Milestone changed from Awaiting Review to 2.6
  • Owner set to johnjamesjacoby
  • Type changed from defect to enhancement
  • Version changed from trunk to 2.2

We can do this, but we may end up pulling it later if we want to own the error messaging & verbiage to be more forum/public specific.

Moving to 2.6.

#6 @johnjamesjacoby
7 years ago

  • Resolution set to fixed
  • Status changed from new to closed

In 6499:

General: Audit wp_insert_post() usages.

Return a WP_Error object in some instances, and explicitly do not in others.

Where possible, use the error message in the user feedback response.

Fixes #2817.

Note: See TracTickets for help on using tickets.