WordPress.org

Ready to get started?Download WordPress

Forums

Customize User Display - 'personalize your homepage' (8 posts)

  1. imagiscapeca
    Member
    Posted 6 years ago #

    Sites like google.com/ig allow users to "personalize your homepage". Users can add content from available add-ins.
    Can I make that available to my users?

    Related:
    Have you found a weather widget that automatically detects the user's location?

  2. Adam Brown
    Member
    Posted 6 years ago #

    Can I make that available to my users?

    I've seen a really cool plugin that lets you do this to your admin dashboard, but not to your blog's frontend.

    Have you found a weather widget that automatically detects the user's location?

    No, but I've seen plugins that figure out a commenter's country and put a little flag next to their comment. Find something like that, and use their method to set which country's weather to display?

  3. imagiscapeca
    Member
    Posted 6 years ago #

    Is there somewhere I can post a plugin request/suggestion?

    Would the solution for this be a plugin or could it be a theme or a core feature?

  4. imagiscapeca
    Member
    Posted 6 years ago #

    Here's a start:

    From http://codex.wordpress.org/Conditional_Tags:

    is_author()
    When any Author page is being displayed.
    is_author('1337')
    When the archive page for Author number 1337 is being displayed.
    is_author('Elite Hacker')
    When the archive page for the Author with Nickname "Elite Hacker" is being displayed.
    is_author('elite-hacker')
    When the archive page for the Author with Nicename "elite-hacker" is being displayed.

    See also Author Templates.

    I could custom-add items to some individuals pages, but I can't imagine how to create a form where users can self-manage which add-ins they want. (Ideally not just from several I make available, but from any site, in the way that some Google Gadgets can get their source from any site.)

  5. imagiscapeca
    Member
    Posted 6 years ago #

    Doh!!!

    (not: Eureka!!!)

    The condition is_author won't help, we need is_user() or is_member() or whatever the term for a user/member/registrant is.

    And none of those exist.

    Do we need an is_user() thing?

  6. ruzel
    Member
    Posted 6 years ago #

    Here's a fix for your problem (although I haven't got all the kinks worked out). What I think you're looking for is the user_data() function. In order to call up user data--like a display name, you call user_data() with the user's id as the argument. Butwaitthere's more!

    There is also a function called wp_get_current_user() You can use this function as an argument as well, ala user_data(wp_get_current_user()) and now what you have is an object with all the user's info stored in it. So your final code (as a simple example) on your template page would look like this:

    $user_info = get_userdata(wp_get_current_user());
    
    echo 'Hey there, ' . $user_info->user_login . '!';

    You can learn more about the user_data object here:
    http://codex.wordpress.org/Function_Reference/get_userdata

  7. ruzel
    Member
    Posted 6 years ago #

    Slight refinement to the code above:

    wp_get_current_user() also returns an object, so you need to do this instead:

    $user_obj = wp_get_current_user(); //fetch information about who is logged in
    
    $user_info = get_userdata($user_obj->id); //fetch user info based on known user id
    
    echo 'Hey there, ' . $user_info->first_name . '!';

    And that should do it!

  8. Umbrovskis.com
    Member
    Posted 5 years ago #

    thanks ruzel. Just what I was looking for to exclude from some statistics loged in users end provide some special likts to them...

Topic Closed

This topic has been closed to new replies.

About this Topic