Make WordPress Core

Opened 19 years ago

Closed 18 years ago

Last modified 11 years ago

#2590 closed enhancement (fixed)

New Filter: comment_post_redirect

Reported by: markjaquith's profile markjaquith Owned by: markjaquith's profile markjaquith
Milestone: Priority: normal
Severity: normal Version: 2.0.4
Component: Administration Keywords: has-patch hook filter comment_post_redirect 2nd-opinion bg|commit
Focuses: Cc:

Description

comment_post_redirect is a filter on the $location that is wp_redirect()ed after a successful comment. It also passes the $comment object as a second value.

Use case: modify the URI that people go do, to do one of many things, including passing a message. for instance, you could add ?message=1 and then have wp_head look for $_GETmessage? == "1" and do a JS alert or something. You could notify of spam, or moderation. Or, on spam or moderation, you could redirect to a captcha or something to allow someone to redeem themselves. Would really be quite useful.

Attachments (5)

comment_post_redirect-HOOK.diff (424 bytes) - added by markjaquith 19 years ago.
$location = apply_filters('comment_post_redirect', $location, $comment);
comment_post-edit_redirect.HOOKS.fragments.diff (1.4 KB) - added by Libertus 19 years ago.
My take, adding a simiar filter for edited comments, and automatic redirection to the comment by fragment, which makes WordPress much nicer to use.
comment_post-edit_redirect.HOOKS.fragments-2.diff (1.3 KB) - added by Libertus 19 years ago.
No direct possibility of a double fragment identifier now.
comment_redirect_filters.diff (1.4 KB) - added by markjaquith 18 years ago.
Patch for /trunk/
comment_redirect_hooks_BRANCHES_2.0.diff (1.3 KB) - added by markjaquith 18 years ago.
Patch for /branches/2.0/

Download all attachments as: .zip

Change History (20)

@markjaquith
19 years ago

$location = apply_filters('comment_post_redirect', $location, $comment);

#1 @markjaquith
19 years ago

  • Keywords 2nd-opinion added
  • Owner changed from anonymous to markjaquith
  • Status changed from new to assigned

Patch is up. 2nd opinion?

#2 @davidhouse
19 years ago

Why not.

#3 @davidhouse
19 years ago

  • Keywords bg|commit added

Err, meant to add this last time :)

#4 @Libertus
19 years ago

Yes, please.

#5 @markjaquith
19 years ago

Paging Ryan/Matt.

@Libertus
19 years ago

My take, adding a simiar filter for edited comments, and automatic redirection to the comment by fragment, which makes WordPress much nicer to use.

#6 @Libertus
19 years ago

Adding the same filter after editing the comment allows that redirect code to be tidied.

I was going to use the filters so I could add the comment fragments in a plugin, but thought they might be far better in the mainline. What do you guys think?

#7 @Libertus
19 years ago

Oops! Careless! Double fragment in that patch. Fixing...

@Libertus
19 years ago

No direct possibility of a double fragment identifier now.

#8 @markjaquith
18 years ago

Bump for bug hunt. Still a good idea.

#9 @ryan
18 years ago

Patch no longer applies. Needs a refresh.

@markjaquith
18 years ago

Patch for /trunk/

#10 @markjaquith
18 years ago

Freshened the patch up.

@markjaquith
18 years ago

Patch for /branches/2.0/

#11 @markjaquith
18 years ago

Added a patch for /branches/2.0/ for 2.0.5 consideration. Patch for trunk is still good.

#12 @ryan
18 years ago

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

(In [4260]) comment_post_redirect and comment_edit_redirect from Mark J. fixes #2590

#13 @ryan
18 years ago

(In [4261]) comment_post_redirect and comment_edit_redirect from Mark J. fixes #2590

#14 @ryan
18 years ago

  • Milestone changed from 2.1 to 2.0.5
  • Version changed from 2.1 to 2.0.4

#15 @(none)
18 years ago

  • Milestone 2.0.5 deleted

Milestone 2.0.5 deleted

Note: See TracTickets for help on using tickets.