Recent Topics

1 May 02, 2006 07:22    

Hi all,

Sorry for my php ineptness. I'm 99% of the way there, now I'm clearing up the niggling details!

On the home page for an individual blog in my setup, I want to be able to show some user variables (e.g. firstname, lastname) under the blog description in the sidebar. I know where to put this in _main.php, I just can't get the code quite right.

Thank you!

2 May 02, 2006 16:23

Hi,
I will answer for v0.9.1 in which you have 2 functions for what you want to do.

The first one is useful if you want to store some user information in another php variable:

void  get_user_info( [   $show   = ''  ]  , [   $this_userdata   = ''  ]  )

It returns the user variable you asked for in $show, for the user $this_userdata (default is the current user, so you may not use this parameter).

An exemple storing current user's nickname:

$nick = get_user_info('nickname');

Possible values are:

    ID num_posts level firstname lastname nickname idmode email url icq aim msn yim notify locale login[/list:u] The second one is made for displaying (or at least formatting) the content you ask for and may be more attractive to you:
    void user_info( $show = '', $format = 'raw', $display = true )
    It calls get_user_info to get what you want (use $show to tell this) and format_to_output() to format it (using $format, for sidebar display you may want to use 'htmlbody'), and actually display or only return it according to $display (true by default, you might not use it). The closest and simplest exemple for what you want to do may be using this function and looking like:
    user_info('nickname', 'htmlbody');
    If you want further documentation you should look in b2evocore/_functions_users.php or here: http://doc.b2evolution.net/v-0-9/evocore/_b2evocore__functions_users_php.html

3 May 16, 2006 08:08

Sorry, computer died and it took a while to get back here. I appreciate the reply, but it looks like this gives me the user info for the currently logged in user? What I want is for under the blog description, to show some of the user variables (but I want it to be the same for everyone viewing this page). How do I reference the user info related to the blog I am currently viewing?

(You may well have answered this and the problem is my lack of skill!)


Form is loading...