Skip to:

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#6497 closed enhancement (fixed)

Missing action hook inside Login widget's login form

Reported by: mrk's profile m@… Owned by: r-a-y's profile r-a-y
Milestone: 2.4 Priority: normal
Severity: normal Version:
Component: Core Keywords: has-patch good-first-bug commit
Cc: markusweser@…



in wp-core-widgets.php, besides bp_{before,after}_login_widget_loggedout, we should have another action hook available inside the login form, like bp_login_widget_login_form - just as applied within the good ol' BP Default theme.

That enables us to apply some sweet magic, like

 * Adds a hidden "redirect_to" input field to the login widget form as applied
 * within BP Default theme
 * Taken from buddypress/bp-themes/bp-default/functions.php's function
 * bp_dtheme_sidebar_login_redirect_to
 * Action hook bp_login_widget_login_form is located in
 * buddypress/bp-core/bp-core-widgets.php
function bp_login_widget_redirect_to() {
  $redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
  $redirect_to = apply_filters( 'bp_no_access_redirect', $redirect_to ); ?>

  <input type="hidden" name="redirect_to" value="<?php echo esc_url( $redirect_to ); ?>" />

add_action( 'bp_login_widget_login_form', 'bp_login_widget_redirect_to' );

Please find my appropriate patch for wp-core-widgets.php attached. I'd appreciate to see it in the next release ;)

Thank you all!

Attachments (1)

bp-core-widgets.php.patch (757 bytes) - added by m@… 9 years ago.
Created action hook bp_login_widget_login_form as applied in BP Default theme

Download all attachments as: .zip

Change History (9)

9 years ago

Created action hook bp_login_widget_login_form as applied in BP Default theme

#1 @DJPaul
9 years ago

  • Milestone changed from Awaiting Review to 2.4

Sure, we can add more actions here. Thanks for the patch!

#2 @m@…
9 years ago

  • Cc markusweser@… added

#3 @DJPaul
9 years ago

  • Keywords good-first-bug added

Let's get this in -- we just need to check the name of the action is consistent with any other actions in nearby/related functions, and update the @since version number for 2.4.

#4 @r-a-y
9 years ago

  • Keywords commit added

I'm okay with the action name being 'bp_login_widget_form'.

This ticket was mentioned in Slack in #buddypress by boone. View the logs.

9 years ago

#6 @boonebgorges
9 years ago

+1 from me too.

#7 @r-a-y
9 years ago

  • Owner set to r-a-y
  • Resolution set to fixed
  • Status changed from new to closed

In 10211:

Widgets: Add new 'bp_login_widget_form' hook in login widget.

Props m@rk.

Fixes #6497.

#8 @m@…
9 years ago

Thank you guys, looking forward to 2.4!

Note: See TracTickets for help on using tickets.