In Drupal, you can go to Configuration menu > Site Information and set http://mysite.org/civicrm to be the default front page. That way, once a user is authenticated, they're dropped right on to the CiviCRM dashboard. How do you perform an equivalent task in Wordpress?
3 Answers
You could try Peter's Login Redirect to set the landing page to /wp-admin/admin.php?page=CiviCRM after successful authentication.
-
That worked perfectly and took two minutes to set up, thanks! Apr 9, 2015 at 23:42
If you didn't want to install a plugin, you could also add a redirect directly to functions.php in your theme. Something like the below would let you redirect only administrators to CiviCRM.
function civicrm_login_redirect( $url, $request, $user ){
if( $user && is_object( $user ) && is_a( $user, 'WP_User' ) ) {
if( $user->has_cap( 'administrator' ) ) {
$url = admin_url( 'admin.php?page=CiviCRM', 'https' );
} else {
$url = home_url('/some-landing-page/');
}
}
return $url;
}
add_filter('login_redirect', 'civicrm_login_redirect', 10, 3 );
https://codex.wordpress.org/Plugin_API/Filter_Reference/login_redirect
There is also a plugin available in the WordPress Repository that allows you to set redirects depending on WP user roles. https://wordpress.org/plugins/login-with-ajax/