1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

[WP] Redirect user to his/her own author page after login.

Discussion in 'Content Management' started by dbuggr, Oct 22, 2009.

  1. #1
    Hi gurus,

    In wordpress Is there a way to redirect user to his/her own author page after login?

    Thanks so much,

    dBuggr
     
    dbuggr, Oct 22, 2009 IP
  2. Fabio Fask

    Fabio Fask Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    /*Aggiunge un filtro per reindirizzare l'URL login*/
    add_filter("login_redirect","gangmei_redirect_to_profile",100,3);
     
    function gangmei_redirect_to_profile($redirect_to_calculated,$redirect_url_specified,$user)
    {
    /*if no redirect was specified,let us think ,user wants to be in wp-dashboard*/
    if(empty($redirect_to_calculated))
        $redirect_to_calculated=admin_url();
     
        /*if the user is not site admin,redirect to his/her profile*/
        if(!is_admin($user->user_login))
            return get_author_posts_url($user->ID,$curauth->user_login);
     
        else
            return $redirect_to_calculated; /*if site admin or not logged in,do not do anything much*/
     
    }
    Code (markup):
     
    Fabio Fask, Mar 28, 2011 IP