Description:
I'm using a WordPress plugin that applies specific redirects after logging in based on users and roles.
The problem:
- I'm using a sidebar widget to allow users to log in on blog and forum (bbPress) pages.
- This widget doesn't have a perceptible redirect (stays on the same page).
- The plugin applies a redirect to this widget. I don't want it to.
Information:
This is the documentation on how to extend the plugin: http://wordpress.org/extend/plugins/peters-login-redirect/other_notes/
It uses the following filters:
rul_before_user
rul_before_role
rul_before_capability
rul_before_fallback
...and the following variable for each:
$empty
$redirect_to
$requested_redirect_to
$user
I'm using bbPress 2.0 as a plugin for WordPress. The log-in widget comes with this.
An example:
This code shows how to write custom redirect logic for the plugin I'm using:
function redirectByIP( $empty, $redirect_to, $requested_redirect_to, $user )
{
$ip_check = '192.168.0';
if( 0 === strpos( $_SERVER['REMOTE_ADDR'], $ip_check ) )
{
return '/secret_area';
}
else
{
return false;
}
}
add_filter( 'rul_before_user', 'redirectByIP', 10, 4 );
I'm not sure how to manipulate this condition for it to read:
if (user has logged in using sidebar widget){
Keep on same page;
}
else{
Redirect the user as usual;
}
My question(s):
- How do I set my log-in widget to ignore the redirect being applied by the plugin?
- Should I try to achieve this by tackling bbPress or the plugin?
- Any ideas on how to edit the above example?