Skip to:
Content
Pages
Categories
Search
Top
Bottom

Change site url to user activity stream


  • thumoo
    Participant

    @thumoo

    Hi all. I have been searching around for a solution to this but to no avail.

    I have it set up to display the activity stream when a user logs in, but I would like to change the site url (that the logo links to) to link to the Activity stream for the logged in user (that appears when you click Activity) instead of showing the main page.

Viewing 1 replies (of 1 total)

  • thumoo
    Participant

    @thumoo

    So after much more hunting around and bit of fiddling, I found a way to do it so I’ll put what I found here for anyone else looking for similar.

    So what you need to do is get the current logged in user:

    $theCurrentUser = wp_get_current_user();

    This creates a variable with an object. Of course we don’t want the object, we want the string part of it. So we get that:

    $theCurrentUser = $theCurrentUser->user_login;

    We now have the string containing the current logged in user. We can now create the link:

    <a href="<?php echo $theCurrentUser; ?> . "/activity/">Activity Page</a>"

    I noted when creating this, there is no need to put the first part of the url as this is automatically put in, so it will look similar to:

    http://www.thebestwebsite.com/clive/activity/

    Hope that makes sense and is helpful to someone!

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar