• Resolved [email protected]

    (@manuelpalachukcom)


    Hello,

    I use BuddyPress and I have a plugin called BP Redirect to profile but it does not work when logging in using Clear Login.

    I’d use the ClearLogin redirect link but I have no idea how to create a url to point dynamically to a user profile.

    Any help would be great.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey manuel. I was having this trouble myself using BBPress forums. I’ve come up with a really simple, good solution for all your (pointing to user bbpress url woes).

    It involves a little setup, but once it’s done, it’s done forever and every time you need to point a user to their profile you’ll have one link you can use in any url or for any plugin which will look like this “mysite.com/user-profile”.

    So if you don’t already make a folder in your theme (or child theme) folder called “template” (no “s” at the end, just “template”). In that folder you want to create a new .php file with this exact content in it (that is “exact” if using bbpress forums, I’m not familiar with using BuddyPress as an entire site template, in either case, down where it says “forums/users” in the below code, just change that to be whatever the url normally is to your user profiles, just before the part that needs to be dynamically filled in (which is handled by the . $user . bit down there).

    <?php /*  
    Template Name: User Profile
    */ 
    
    $current_user = wp_get_current_user();
    $user=$current_user->user_login;     
    
    header('Location: /forums/users/' . $user . '/');
    exit();
    
    ?> 

    Ok so, copy and paste that into a text file and save it as user-profile.php, load that into the template folder I just mentioned. Now in the backend of WordPress, make a regular new wordpress page and name it “user-profile” and to the far right change it’s template to “User Profile” which should now appear as a selectable template for any page you create. You don’t need to put anything else in the actual wordpress page. Just save it.

    Now anytime you use the url “mysite.com/user-profile” it will redirect any logged in user to their profile. You can build a link for users to edit their profile directly by repeating the same technique and just replacing the last part of the header line in the above code from ‘/’ to ‘/edit/’ and changing the template name to “User Profile Edit” or “user-profile-edit” or whatever. I’ve only tried this on my site, and I’m certainly no expert, so try at your own risk.

    Plugin Author Alberto Hornero

    (@hornero)

    @buckyohare thanks for your feedback and support. I really appreciate your help with this issue.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Redirect to BuddyPress user profile after login’ is closed to new replies.