[buddypress-trac] [BuddyPress Trac] #6497: Missing action hook inside Login widget's login form
buddypress-trac
noreply at wordpress.org
Thu Jun 11 20:52:30 UTC 2015
#6497: Missing action hook inside Login widget's login form
------------------------------+-----------------------------
Reporter: m@… | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Component - Core | Version:
Severity: normal | Keywords: has-patch
------------------------------+-----------------------------
Greetings,
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
{{{#!php
<?php
/**
* 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 ); ?>" />
<?php
}
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!
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6497>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list