Arrow

multiple users redirected to same url | Peter's Login Redirect | Forum

Back to the login redirect plugin page

Please consider registering
guest

Log In

Lost password?
Advanced Search

— Forum Scope —

  

— Match —

   

— Forum Options —

   

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
multiple users redirected to same url
May 30, 2013
8:27 am
kasper
New Member
Forum Posts: 2
Offline

I want to have usernames like this: usergroup_username and then change some code in the plugin that
basically just explode() the variable username, so that everything after the underscore gets ignored and
the usergroup name is used to do redirection.

any hint would be great.

thanks,
Kasper

May 30, 2013
9:10 am
kasper
New Member
Forum Posts: 2
Offline

I figured it out. I changed this:

case 'username':
$variable_value = rawurlencode( $user->user_login );

to this:

case 'username':
$variable_value = rawurlencode( $user->user_login );
if(strpos($variable_value, '_') !== false)
{
$pieces = explode("_", $variable_value);
$variable_value = $pieces[0]; // piece1
}

I tested it with a new username: test_username1 and it does redirect to the directory /test.

let me know if this is safe or if this could alter or break something.

thanks!

May 30, 2013
9:26 am
Peter
Admin
Forum Posts: 841
Offline

That should be fine as it's not used elsewhere by the plugin. However, to be more upgrade-proof, you could write support for your own variable such as "usergroup_username" as explained near the bottom of this page:

http://wordpress.org/plugins/p.....her_notes/