MyBB Community Forums

Full Version: Show Age on the Member List
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I use this plugin: Show Age on the Postbit.
It's great but now I want to put age of users (not birthday) on the member list.
It is possible, please ?
Smile
Please, who knows how can I add this in memberlist !?


[attachment=7913]
Open memberlist.php

Find
		eval("\$member .= \"".$templates->get("memberlist_row")."\";");	

Add above
		// GET AGE
		if($users['birthday'] != "")
		{
			$membday = explode("-", $users['birthday']);
			if($membday[2])
			{
				$age = get_age($users['birthday'])."y";
			}
			else
			{
				$age = "";
			}
		}
		else
		{
			$age = "";
		}

Then add a new column for the title + change the colspan in memberlist template && in memberlist_row add a column where you put {$age} for displaying the age if the birthday is filled in completely.
Thank you, LeX !

But now I have a little problem. I think you should see this:

[attachment=7914]

First user in memberlist don't have age, and last user have age but it's not him age.

I need something like $users-1['birthday']... I don't know.

Example:
If
1. User1 = 30y
2. User2 = 20y
3. User3 = 10y

in my memberlist I have now something like this:

1. User1 =
2. User2 = 30y
3. User3 = 20y

So... where is the problem !?

Maybe you can help me to fix this, plz. I use a lot of plugins (about 60) and all works great and I really want to put age of users in memberlist.
And another question: it's possible to display just number of age (like 20) whithout y after this number ? And how can I make this !?

p.s.: Sorry for my english skill. I'm romanian.

Can you help me, please !?
You did add the age-code ABOVE the eval statement ?

Edit:

Losing the 'y';
Change
                $age = get_age($users['birthday'])."y";
into
                $age = get_age($users['birthday']);
I put above like you say.

Here it's my memberlist.php

[attachment=7915]

Sad

EDIT:
And this is memberlist_row
<tr>
<td class="trow1" align="left" width="150px"><a href="member.php?action=profile&uid={$users['uid']}">{$users['username']}</a></td>
<td class="trow2" align="center">{$users['regdate']}</td>
<td class="trow1" align="center"><img src="images/flags/$post[fid1].gif" title="$post[fid1]"></td>
<td class="trow2" align="center"><img src="images/$post[fid3].gif" title="$post[fid3]"></td>
<td class="trow1" align="center">{$age}</td>
<td class="trow2" align="center">{$users['postnum']}</td>
<td class="trow1" align="left">$users[fid2]</td>
<td class="trow2" align="center"><a href="http://$users[fid4]" target="_blank"><img src="http://forumania.ilive.ro/images/english/postbit_www.gif" title="$post[fid4]"></a></td>
<td class="trow2" align="center"><a href="private.php?action=send&uid={$memprofile['uid']}"><img src="http://www.forumania.ilive.ro/images/english/postbit_pm.gif"></a></td>
</tr>

And the last... this is memberlist template
<html>
<head>
<title>{$mybb->settings['bbname']} - {$lang->member_list}</title>
{$headerinclude}
</head>
<body>
{$header}
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead" colspan="9"><strong>{$lang->member_list}</strong></td>
</tr>
<tr>
<td class="tcat" align="center"><span class="smalltext"><strong>Membru</strong></span></td>
<td class="tcat" align="center"><span class="smalltext"><strong>Inscris</strong></span></td>
<td class="tcat" align="center"><span class="smalltext"><strong>Tara</strong></span></td>
<td class="tcat" align="center"><span class="smalltext"><strong>Sex</strong></span></td>
<td class="tcat" align="center"><span class="smalltext"><strong>Varsta</strong></span></td>
<td class="tcat" align="center"><span class="smalltext"><strong>Posturi</strong></span></td>
<td class="tcat" align="center"><span class="smalltext"><strong>Cum a ajuns pe FORUMANIA !?</strong></span></td>
<td class="tcat" align="center"><span class="smalltext"><strong>Site recomandat</strong></span></td>
<td class="tcat" align="center"><span class="smalltext"><strong>Mesaj Privat</strong></span></td>
</tr>
{$member}
<tr>
<td align="center" colspan="9" class="tfoot">
<form action="memberlist.php" method="post">
<input type="hidden" name="page" value="{$page}" />
{$lang->sort_by} <select name="by">
<option value="regdate"{$regdatesel}>{$lang->sort_regdate}</option>
<option value="username"{$usernamesel}>{$lang->sort_username}</option>
<option value="postnum"{$postnumsel}>{$lang->sort_posts}</option>
</select> {$lang->sort_in} <select name="order">
<option value="ASC"{$ascsel}>{$lang->sort_asc}</option>
<option value="DESC"{$descsel}>{$lang->sort_desc}</option>
</select> {$lang->order} {$lang->search_for} <input type="text" class="textbox" name="usersearch" value="{$usersearch}" size="20" /> {$gobutton}
</form>
</td>
</tr>
</table>
<table align="center" width="100%"><tr>
<td><span class="smalltext">[<a href="showteam.php">{$lang->forumteam}</a>]</span></td>
<td align="right">{$multipage}</td>
</tr></table>
<table align="center" width="100%">
<tr><td class="thead" align="center"><b>Clasele membrilor</b></td></tr>
<tr><td class="trow1" align="center">
<span class="smalltext">[Administrator] | [Moderator] | [VIP] | [Elite User] | [Power User] | [User] | [<a href="memberlist.php?groups=2">New User]</a> | [Banned]</span>
</td></tr>
</table>
{$footer}
</body>
</html>

I really don't know how can fix this.
No you didn't, just did a test on my forum and when i've place it under the eval statement, the ages are 1 off.

Your code
	eval("\$member .= \"".$templates->get("memberlist_row")."\";");
	// GET AGE
  if($users['birthday'] != "")
  {
    $membday = explode("-", $users['birthday']);
    if($membday[2])
    {
     $age = get_age($users['birthday'])."y";
    }
    else
    {
     $age = "";
    }
    }
    else
    {
     $age = "";
    } 

...

Should be
	// GET AGE
  if($users['birthday'] != "")
  {
    $membday = explode("-", $users['birthday']);
    if($membday[2])
    {
     $age = get_age($users['birthday']);
    }
    else
    {
     $age = "";
    }
    }
    else
    {
     $age = "";
    } 
	eval("\$member .= \"".$templates->get("memberlist_row")."\";");

LeX... THANK YOU !!!

You are my man ! WinkSmile


Thank's again. I don't forget that. You help me so much.

Best regards,
Forumania
Big Grin