Messages for unpublished profiles

These snippets, added to my user_profile.tpl.php file, are for Drupal 4.6. The profile.module must be enabled.

In my profile, I have a check box that asks: Do you want your profile to be listed on the site? If the person checks the box, then the profile will be visible to all registered users on the site. The profile field associated with the check box is "profile_list."

These snippets respond to the case when a user has not yet published his profile to other users on the site.

My goal was to distinguish between the user who might be looking at his own profile and a user looking at someone else's.

If a user clicks on his own unpublished profile, the following snippet informs him, "You have not yet entered in your user profile" and provides a link to his profile page.

<?php if ((!$user->profile_list) and ($user ==  $GLOBALS["user"])) {print "You have not yet entered in your  <a href='user/".$user->uid."/edit/Profile'>user\ profile</a>!";} ?>

If a user comes across someone else's unpublished profile, the following snippet explains that she has not yet entered in a profile.

<?php if((!$user->profile_list) AND  ($user !=  $GLOBALS["user"]))
{print
$user->name." has not yet entered a profile.";} ?>

Not all that important, but it looks better than a generic message for all users.
Please check over this code as I am not yet very experienced. So far it works for me and I thought it might be useful.

 
 

Drupal is a registered trademark of Dries Buytaert.