Forums

Redirect after login problem (1 post)

  1. dmserf
    Member
    Posted 2 years ago #

    Hi there,

    I'm trying to write a function that once logged in, redirect the user to his website, as entered in the user's Profile. Here is my code:

    <?php
    function redirect_to_profile() {
    	global $redirect_to, $user_url;
    	get_currentuserinfo();
    	if (!isset($_GET['redirect_to'])) {
    		$redirect_to = get_option('siteurl') . $user_url;
    	}
    }
    
    add_action('login_form', 'redirect_to_profile');
    ?>

    Actually, the function redirect me to the homepage and not to the link entered on my profile (in fact, the user_url is a link to a specific page, different for all users).

    Any ideas on why it might be doing this? Thanks in advance for any help!

Topic Closed

This topic has been closed to new replies.

About this Topic