Last updated September 26, 2009. Created by John Morahan on February 8, 2006.
Edited by SLIU, bryan kennedy, greggles, add1sun. Log in to edit this page.
PLEASE NOTE! These snippets are user submitted. It is impossible to check them all, so please use at your own risk! For users who have setup drupal using an alternate database to the default (MYSQL), please note that the snippets may contain some database queries specific to MYSQL.
Description
This php snippet displays the length of time the user has been registered. The out-of-the-box Drupal prefix is "HISTORY" but you can change that to "MEMBER FOR:" or whatever you choose,
Usage
- For use in your user profile page override
- Using a text editor like NOTEPAD.EXE or an equivalent, copy and paste the code into your user_profile.tpl.php file
- Tested and works with Drupal 5.x
- Change the div class names or the prefix text to suit.
<div class="fields">
<p>Member for:<?php print (format_interval(time() - $account->created));?></p>
</div>To print a "member since" message you can use this code:
<div class="fields">
<?php print (format_date($account->created, 'small'));?>
</div>or for a slightly different format:
<div class="fields">
<span>Member since: <span>
<?php print (format_date($account->created, 'medium'));?>
<span class="member-for">
(<?php print (format_interval(time() - $account->created));?>)
</span>
</div>More details on format_date are in the API guide.