Hi,
I also needed this functionality. I modified peters’ login redirect plugin
1. Install the latest version of peters’ login redirect – 2.5.3
http://wordpress.org/extend/plugins/peters-login-redirect/
2. Replace /wp-content/plugins/peters-login-redirect/wplogin_redirect.php
with the following file:
http://www.rajewski.pl/code/wplogin_redirect.zip
3. One DB modification is needed – add “group” type of redirect:
ALTER TABLE wp_login_redirects CHANGE rul_type rul_type ENUM( 'group', 'user', 'role', 'level', 'all', 'register' )
4. Setup groups in UAM and create redirect links in Peters’ Login Redirect admin panel.
Backdraws:
– Peters’ Login Redirect plugin update will of course overwrite modified file.
– Deleting UAM group doesn’t delete redirects – you have to do it manually (but I used ID’s (with autoincrease) instead of names, so these records shouldn’t cause any problems.
wplogin_redirect.zip updated (with a few fixes).
aspero,
thanks for your modifications..
i am using wp-members plugins for groups.
and your changes not showing me groups in admin panel settings of login/logout redirects..
Any help would be appreciated.
thanks
I was able to integrate with Role Scoper in the way. I basically just used the wp_groups_rs table instead of UAM.
great custom solution!
Hi drsim,
In your case you have to examin wplogin_redirect.php and make some modifications concerning DB tables (I think) – just like jlipford did.
Thank you jlipford for your nice feedback 🙂
Bartek.
Thanks jlipford and aspero..
i have changed the DB queries according to wp members plugin, everything works , it is even saving the redirects in admin panel, but it is not redirecting after login,, i am using /wp-login.php page to test and it redirect the user to the profile page instead of the group page.
any idea ??
thanks
i think i have found the problem..
$user_has_groups = $wpdb->get_results(‘SELECT group_id FROM ‘.$wpdb->prefix . ‘uam_accessgroup_to_object WHERE object_type = \’user\’ AND object_id = ‘.$user->ID, OBJECT);
above is your query and below is what i have..
$user_has_groups = $wpdb->get_results(‘SELECT grel_group_id FROM ‘.$wpdb->prefix . ‘ps_group_relationships WHERE grel_user_id = ‘.$user->ID, OBJECT);
i was assuming that object_id is user id, but it is the page id ,, so in wp member plugin , it does not save the page id in groups relationship table..
how can i get around with that??
Did you
ALTER TABLE wp_login_redirects CHANGE rul_type rul_type ENUM( ‘group’, ‘user’, ‘role’, ‘level’, ‘all’, ‘register’ )
?
Yes i did. and i did some further debuging..
when i execute in sql …
$user_has_groups = $wpdb->get_results('SELECT grel_group_id FROM '.$wpdb->prefix . 'ps_group_relationships WHERE grel_user_id = '.$user->ID, OBJECT);
above query return the group id.
then…
$rul_users = $wpdb->get_results('SELECT rul_value, rul_url FROM ' . $rul_db_addresses .
' WHERE rul_type = \'group\' AND rul_value = '.$user_has_groups[0]->group_id , OBJECT);
it returns the rul_value and rul_url..
but
if ($rul_users) {
{
foreach( $rul_users as $rul_user )
{
echo $rul_user->rul_url;
$redirect_to = rulRedirectFunctionCollection::rul_replace_variable( $rul_user->rul_url, $user );
return $redirect_to;
}
}
}
this part never gets true, it does not enter into loop.. so no redirects.
got it.. 🙂
i have to use $user_has_groups[0]->grel_group_id not just group_id..
thanks anyway ,, good piece of code 😉