4

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 3

6

You could try Peter's Login Redirect to set the landing page to /wp-admin/admin.php?page=CiviCRM after successful authentication.

see https://wordpress.org/plugins/peters-login-redirect/

1
  • That worked perfectly and took two minutes to set up, thanks! Apr 9, 2015 at 23:42
4

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

1

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/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.