Skip to:
Content
Pages
Categories
Search
Top
Bottom

Redirection plug in help please

  • Avatar of Devweb
    devweb
    Participant

    @devweb

    Hi all

    Found this excellent and useful plugin for redirecting to profile after login:

    <?php

    function oci_login_redirect($redirect_to, $set_for, $user){

    $redirect_to = “http://IP_address/account/members/$user/profile”;

    return $redirect_to;

    }

    add_filter(‘login_redirect’, ‘oci_login_redirect’, 10, 3);

    ?>

    However, trying to change redirect_to at the moment to the profile in a not-so-standard way due to the fact I have no domain name attached to the account. Can someone take a look at the code above and see if there is anyway of getting ‘$user’ in there so that it recognises the user on login and directs to their profile page?

    Unfortunately no domain name is being applied for a while so it has to be like this temporarily!

    Thanks in advance.

    DW

Viewing 3 replies - 1 through 3 (of 3 total)
  • Avatar of Simon
    Simon
    Participant

    @conceptfusion

    This should work (added to the bp-custom.php file in the mu-plugins folder):

    function oci_login_redirect($redirect_to, $set_for, $user){

    $redirect_to = bp_core_get_userurl($user->ID);

    return $redirect_to;

    }

    Avatar of Simon
    Simon
    Participant

    @conceptfusion

    Credit for the above code too burtadsit by the way :-)

    Avatar of Burt Adsit
    Burt Adsit
    Participant

    @burtadsit

    Hah! I see that little snippet of code all over the place now. Like the term ‘buddybar’ which is coming back to haunt me. :)

    I created another little snippet for somebody in the forums, which restricts the user to one blog per customer. Something like the 5 line thing above. Now on my dev server *I* can’t get more than one blog created because I’ve forgotten where I put the damn thing.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.