Hi - I am trying to find an all in one block that would display in my side bar at all times (once a user has loggined into the site)

This block would show (for emaple)

- (Avitar Goes Here)
- Name:
- Location:
- Inbox:
- UserPoints:

I searched the forums and search box: but I could not really find this sort of tool.

Do you know of any module or custom block of code that I could use for something like this?

Comments

Muslim guy’s picture

<?php global $user; ?> <!--declare global user info -->
<?php echo theme("user_picture", $user); ?> <!-- display avatar -->
<?php print $user->name ?>
<br>

<?php print $user->profile_userfield ?>
<p>
<?php print $user->profile_country ?>
<p>

<a href="http://yourdomain.com/user/me/edit" target="_blank">Edit</a> | <a href="http://yourdomain.com/logout" target="_blank">Logout</a>
<p>
<a href="http://yourdomain.com/user/me/edit/Customizable+Personal+Profile" target="_blank">Customize profile</a>

*You display only the selected option (here country and specialty)
*Its also possible to display user's textfield or textarea
*You have to use Me.module in order to create URL to user's profile links

If you want to see the members selecting the same option (eg Country, Gender, Profession):

<a href="http://yourdomain.com/profile/profile_userfield/<?php print $user->profile_userfield ?>"> <?php print $user->profile_userfield ?> </a>
<p>
<a href="http://yourdomain.com/profile/profile_country/<?php print $user->profile_country ?>"> <?php print $user->profile_country ?> </a>

Set the whole block above to appear except in:
node/add*
node/*/edit
user/*/edit*

Last logged in - this only works for a user profile being viewed (only set to display in user*)

<?php
  //Last logged in
  global $user;
  if ($user->uid>0){
   $userid = arg(1);
   //$userid = '1';

   $u = user_load(array("uid" => $userid));

   $output9 .= '<TABLE BORDER="1" CELLPADDING="1"  CELLSPACING="3" WIDTH="100%"> <TR><TD BGCOLOR="#f5f4ff"><FONT SIZE=-1>';

   $output9 .= '<FONT SIZE=-2><B>Last logged in:<BR> <FONT SIZE=-2>';
   $output9 .= format_date($u->access,'short');

   $output9 .= "</TD></TR></TABLE><BR>";
   $output9 .= "</FONT></B><FONT SIZE=-1>"; 
   $output9 .= '<center>';

  $output9 .=  "</center>";
  print $output9;
  }
?>

The pic snippet below is for custom user profile:

<?php if($user->picture): ?>
<div class="picture">
<img align="center" src="http://yourdomain.com/<?php print $user->picture ?>">




gonz’s picture

I appreciate your time that you took to help me out - thank you.

Unfortunately the code did not fully function on my website. I am using the latest Drupal 5.4 and I did install and activate the ME module.

For some reason - the Profile Image did work, but the profile_state (in your example = profile_country) did not show up.

I created the profile entry with the id of profile_state - then called to it using the
print $user->profile_state

Nothing - I tried this with other Profile fields - but still nothing.

I read some other posts about customizing Drupal - and they all had similar code to yours... this gets me to think it my be a problem with my drupal installation.

:(

Muslim guy’s picture

Might be the database `collation' - if yours is latin1, then even if there is data in tables, some modules will not be able to output it in Drupal.

You can glance http://yourdomain.com/phpmyadmin and select the database, and see whether utf8 or latin1

gonz’s picture

Yeah - MySQL connection collation is UTF8_general

Thanks for trying.