[wp-trac] [WordPress Trac] #24074: Admin bar can provide redirect hook and home button
WordPress Trac
noreply at wordpress.org
Sun Apr 14 05:11:07 UTC 2013
#24074: Admin bar can provide redirect hook and home button
-------------------------------------+------------------------------
Reporter: godhulii_1985 | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Toolbar | Version: 3.5.1
Severity: normal | Resolution:
Keywords: ux-feedback ui-feedback |
-------------------------------------+------------------------------
Changes (by SergeyBiryukov):
* component: General => Toolbar
Comment:
> Despite lots of potential information in this bar, a theme owner may not
want to see this in his site. So there should be an option in ''Dashboard
> Settings'' to show/hide this.
There's an option in user profile: [[BR]]
http://core.trac.wordpress.org/browser/tags/3.5.1/wp-admin/user-
edit.php#L224
There's also a function and a filter for theme and plugin developers:
[[BR]]
http://codex.wordpress.org/Function_Reference/show_admin_bar [[BR]]
http://codex.wordpress.org/Plugin_API/Filter_Reference/show_admin_bar
> Leftmost anchor element of this bar is '''site-name''' that redirects
the user to http://example.com/wpurl/wp-admin. However there is another
link just below it (Dashboard) that redirect to the same link.
This is intentional, see #19184.
> This admin bar is always visible no matter how deep we scroll in a site.
So lets assume, an user (say Bob) has scrolled down for 1000 lines. Then
Bob wish to return to homepage.
This is partially implemented in #18758. A click on an empty area in
Toolbar would take you to the top of the page.
> The logout button works as follows: From http://example.com?p=111 page
if Bob click on logout then Bob will be taken to http://example.com/wpurl
/wp-login.php?action=logout. From here Bob have to click to '''back to
Site-name''' link to return to homepage or type http://example.com?p=111
in address bar to return to this page. This is distracting for the user
IMO.
The user needs a way to make sure the operation was successful, and the
redirect to `wp-login.php` makes that explicit.
> '''So long story short''': there should be a hook for the logout link in
admin bar, taking input on where to redirect once Bob logout.
The Toolbar uses `wp_logout_url()` function, which has `logout_url`
filter: [[BR]]
http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/general-
template.php#L199
You can use it this way to redirect back to the current page:
{{{
function redirect_on_logout_24074( $logout_url, $redirect ) {
if ( empty( $redirect ) )
$logout_url = add_query_arg( 'redirect_to', urlencode(
$_SERVER['REQUEST_URI'] ), $logout_url );
return $logout_url;
}
add_filter( 'logout_url', 'redirect_on_logout_24074', 10, 2 );
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/24074#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list