Memberlist Xrevolution

Started by Marcus Forsberg, December 21, 2008, 05:03:38 PM

Previous topic - Next topic

Xavi-Nena

Is there a way to display members in the order of last active?

Marcus Forsberg

Not that I know off just now, but I can have a look at it.


Acans

"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not
  dead yet, the time was soon to come to pass when mysql_query shall be gone and no more

Marcus Forsberg


Antechinus

#85
Quote from: NenaGb on February 04, 2009, 05:49:25 AM
Is there a way to display members in the order of last active?
Yes, there surely is. You do it like this:

Themes/default/languages/index.english.php

Find: ?>

Add before: $txt['lastLoggedIn'] = 'Last Active';


Sources/Memberlist.php

Find: $context['num_members'] = $modSettings['totalMembers'];

// Set up the columns...
$context['columns'] = array(
'isOnline' => array(
'label' => $txt['online8'],
'width' => '20'
),
'realName' => array(
'label' => $txt[35]
),
'emailAddress' => array(
'label' => $txt[307],
'width' => '25'
),
'websiteUrl' => array(
'label' => $txt[96],
'width' => '25'
),
'ICQ' => array(
'label' => $txt[513],
'width' => '25'
),
'AIM' => array(
'label' => $txt[603],
'width' => '25'
),
'YIM' => array(
'label' => $txt[604],
'width' => '25'
),
'MSN' => array(
'label' => $txt['MSN'],
'width' => '25'
),
'ID_GROUP' => array(
'label' => $txt[87]
),
'registered' => array(
'label' => $txt[233]
),
'posts' => array(
'label' => $txt[21],
'width' => '115',
'colspan' => '2'
)
);


Replace with: $context['num_members'] = $modSettings['totalMembers'];

// Set up the columns...
$context['columns'] = array(
'isOnline' => array(
'label' => $txt['online8'],
),
'realName' => array(
'label' => $txt[35]
),
'emailAddress' => array(
'label' => $txt[307],
),
'websiteUrl' => array(
'label' => $txt[96],
),
'ICQ' => array(
'label' => $txt[513],
),
'AIM' => array(
'label' => $txt[603],
),
'YIM' => array(
'label' => $txt[604],
),
'MSN' => array(
'label' => $txt['MSN'],
),
'ID_GROUP' => array(
'label' => $txt[87]
),
'registered' => array(
'label' => $txt[233]
),
'last_login' => array(
'label' => $txt['lastLoggedIn']
),
'posts' => array(
'label' => $txt[21],
)
);


Find: // List out the different sorting methods...
$sort_methods = array(
'isOnline' => array(
'down' => '(ISNULL(lo.logTime)' . (!allowedTo('moderate_forum') ? ' OR NOT mem.showOnline' : '') . ') ASC, realName ASC',
'up' => '(ISNULL(lo.logTime)' . (!allowedTo('moderate_forum') ? ' OR NOT mem.showOnline' : '') . ') DESC, realName DESC'
),
'realName' => array(
'down' => 'mem.realName ASC',
'up' => 'mem.realName DESC'
),
'emailAddress' => array(
'down' => (allowedTo('moderate_forum') || empty($modSettings['allow_hideEmail'])) ? 'mem.emailAddress ASC' : 'mem.hideEmail ASC, mem.emailAddress ASC',
'up' => (allowedTo('moderate_forum') || empty($modSettings['allow_hideEmail'])) ? 'mem.emailAddress DESC' : 'mem.hideEmail DESC, mem.emailAddress DESC'
),
'websiteUrl' => array(
'down' => 'LENGTH(mem.websiteURL) > 0 DESC, ISNULL(mem.websiteURL) ASC, mem.websiteURL ASC',
'up' => 'LENGTH(mem.websiteURL) > 0 ASC, ISNULL(mem.websiteURL) DESC, mem.websiteURL DESC'
),
'ICQ' => array(
'down' => 'LENGTH(mem.ICQ) > 0 DESC, ISNULL(mem.ICQ) OR mem.ICQ = 0 ASC, mem.ICQ ASC',
'up' => 'LENGTH(mem.ICQ) > 0 ASC, ISNULL(mem.ICQ) OR mem.ICQ = 0 DESC, mem.ICQ DESC'
),
'AIM' => array(
'down' => 'LENGTH(mem.AIM) > 0 DESC, ISNULL(mem.AIM) ASC, mem.AIM ASC',
'up' => 'LENGTH(mem.AIM) > 0 ASC, ISNULL(mem.AIM) DESC, mem.AIM DESC'
),
'YIM' => array(
'down' => 'LENGTH(mem.YIM) > 0 DESC, ISNULL(mem.YIM) ASC, mem.YIM ASC',
'up' => 'LENGTH(mem.YIM) > 0 ASC, ISNULL(mem.YIM) DESC, mem.YIM DESC'
),
'MSN' => array(
'down' => 'LENGTH(mem.MSN) > 0 DESC, ISNULL(mem.MSN) ASC, mem.MSN ASC',
'up' => 'LENGTH(mem.MSN) > 0 ASC, ISNULL(mem.MSN) DESC, mem.MSN DESC'
),
'registered' => array(
'down' => 'mem.dateRegistered ASC',
'up' => 'mem.dateRegistered DESC'
),
'ID_GROUP' => array(
'down' => 'ISNULL(mg.groupName) ASC, mg.groupName ASC',
'up' => 'ISNULL(mg.groupName) DESC, mg.groupName DESC'
),
'posts' => array(
'down' => 'mem.posts DESC',
'up' => 'mem.posts ASC'
)
);


Replace with: // List out the different sorting methods...
$sort_methods = array(
'isOnline' => array(
'down' => '(ISNULL(lo.logTime)' . (!allowedTo('moderate_forum') ? ' OR NOT mem.showOnline' : '') . ') ASC, realName ASC',
'up' => '(ISNULL(lo.logTime)' . (!allowedTo('moderate_forum') ? ' OR NOT mem.showOnline' : '') . ') DESC, realName DESC'
),
'realName' => array(
'down' => 'mem.realName ASC',
'up' => 'mem.realName DESC'
),
'emailAddress' => array(
'down' => (allowedTo('moderate_forum') || empty($modSettings['allow_hideEmail'])) ? 'mem.emailAddress ASC' : 'mem.hideEmail ASC, mem.emailAddress ASC',
'up' => (allowedTo('moderate_forum') || empty($modSettings['allow_hideEmail'])) ? 'mem.emailAddress DESC' : 'mem.hideEmail DESC, mem.emailAddress DESC'
),
'websiteUrl' => array(
'down' => 'LENGTH(mem.websiteURL) > 0 DESC, ISNULL(mem.websiteURL) ASC, mem.websiteURL ASC',
'up' => 'LENGTH(mem.websiteURL) > 0 ASC, ISNULL(mem.websiteURL) DESC, mem.websiteURL DESC'
),
'ICQ' => array(
'down' => 'LENGTH(mem.ICQ) > 0 DESC, ISNULL(mem.ICQ) OR mem.ICQ = 0 ASC, mem.ICQ ASC',
'up' => 'LENGTH(mem.ICQ) > 0 ASC, ISNULL(mem.ICQ) OR mem.ICQ = 0 DESC, mem.ICQ DESC'
),
'AIM' => array(
'down' => 'LENGTH(mem.AIM) > 0 DESC, ISNULL(mem.AIM) ASC, mem.AIM ASC',
'up' => 'LENGTH(mem.AIM) > 0 ASC, ISNULL(mem.AIM) DESC, mem.AIM DESC'
),
'YIM' => array(
'down' => 'LENGTH(mem.YIM) > 0 DESC, ISNULL(mem.YIM) ASC, mem.YIM ASC',
'up' => 'LENGTH(mem.YIM) > 0 ASC, ISNULL(mem.YIM) DESC, mem.YIM DESC'
),
'MSN' => array(
'down' => 'LENGTH(mem.MSN) > 0 DESC, ISNULL(mem.MSN) ASC, mem.MSN ASC',
'up' => 'LENGTH(mem.MSN) > 0 ASC, ISNULL(mem.MSN) DESC, mem.MSN DESC'
),
'registered' => array(
'down' => 'mem.dateRegistered ASC',
'up' => 'mem.dateRegistered DESC'
),
'last_login' => array(
'down' => 'mem.lastLogin ASC',
'up' => 'mem.lastLogin DESC'
),
'ID_GROUP' => array(
'down' => 'ISNULL(mg.groupName) ASC, mg.groupName ASC',
'up' => 'ISNULL(mg.groupName) DESC, mg.groupName DESC'
),
'posts' => array(
'down' => 'mem.posts DESC',
'up' => 'mem.posts ASC'
)
);



Themes/default/Memberlist.template.php

Find: // Display page numbers and the a-z links for sorting by name if not a result of a search.
if (!isset($context['old_search']))
echo '
<table width="100%" cellpadding="3" cellspacing="1" border="0">
<tr>
<td colspan="5">&nbsp;', $txt[139], ': ', $context['page_index'], '</td>
<td colspan="7" align="right">', $context['letter_links'] . '&nbsp;</td>
</tr>
</table>';

// If this is a result of a search then just show the page numbers.
        else
echo '
', $txt[139], ': ', $context['page_index'];


Replace with: // Display page numbers and the a-z links for sorting by name if not a result of a search.
if (!isset($context['old_search']))
echo '
<table width="100%" cellpadding="3" cellspacing="1" border="0">
<tr>
<td colspan="5">&nbsp;', $txt[139], ': ', $context['page_index'], '</td>
<td colspan="7" align="right">', $context['letter_links'] . '&nbsp;</td>
</tr>
<tr class="', empty($settings['use_tabs']) ? 'titlebg' : 'catbg3',' ">';
        if (!isset($context['old_search']))
// Display each of the column headers of the table.
foreach ($context['columns'] as $column)
{
// We're not able (through the template) to sort the search results right now...
if (isset($context['old_search']))
echo '
<td', isset($column['width']) ? ' width="' . $column['width'] . '"' : '', isset($column['colspan']) ? ' colspan="' . $column['colspan'] . '"' : '', '>
', $column['label'], '</td>';
// This is a selected solumn, so underline it or some such.
elseif ($column['selected'])
echo '
<td style="width: auto;"' . (isset($column['colspan']) ? ' colspan="' . $column['colspan'] . '"' : '') . ' nowrap="nowrap">
<a href="' . $column['href'] . '">' . $column['label'] . ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" /></a></td>';
// This is just some column... show the link and be done with it.
else
echo '
<td', isset($column['width']) ? ' width="' . $column['width'] . '"' : '', isset($column['colspan']) ? ' colspan="' . $column['colspan'] . '"' : '', '>
', $column['link'], '</td>';
}
if (!isset($context['old_search']))
echo '
</tr>
</table>';
// If this is a result of a search then just show the page numbers.
if (isset($context['old_search']))
echo '
', $txt[139], ': ', $context['page_index'];


This will re-insert the entire sorting bar from the original default theme template, plus the non-standard "Sort by last activity" option.

And after all that code it'd bloody well want to. :D

Xavi-Nena

I followed step by step and it still shows in ABC order?

Antechinus

Shouldn't do because it works on my box. I might have forgot to post one edit. Hang on while I check.

Antechinus

Nope. Haven't missed anything. You are still using 1.1.8 aren't you? Or have you gone to SMF 2?


Antechinus

Ok, I've been so busy hacking things that I forgot (or didn't notice) that Nas' template didn't have the sorting bar. I've edited my earlier post to display all the code needed for reinstating it. 

Xavi-Nena

Quote from: Antechinus on March 16, 2009, 03:15:54 AM
This will re-insert the entire sorting bar from the original default theme template, plus the non-standard "Sort by last activity" option.

And after all that code it'd bloody well want to. :D

Thank ya sweets  :)

now dont strike me but is there a way to make the last active display as default? If not I dont suppose its a HUGE deal but just curious. :)

Thanks again. muaa

Antechinus

I'd say there would be, because it's just another setting like alphabetical, but I'm not looking at it tonight.

Ferrin

#93
QuoteHow can we make the avatars clickable in the memberlist?


Themes/default/Memberlist.template.php

Find:
// The avatar
echo'
', $member['avatar']['image'], '<br />';



Replace with:
// The avatar
if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) && !empty($member['avatar']['image']))
echo '<a href="'.$scripturl.'?action=profile;u='.$member['id']. '" title="', $txt[92] ,' ', $member['name'],' ">', $member['avatar']['image'], '</a><br />';



Or if you have permission set for guests. Thus the list of members can see. However, not per click to get profile. Will be redirected to registration.


Replace with:
// The avatar
if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) && !empty($member['avatar']['image']))
{
if ($context['user']['is_logged'])
echo '<a href="'.$scripturl.'?action=profile;u='.$member['id']. '" title="', $txt[92] ,' ', $member['name'],' ">', $member['avatar']['image'], '</a><br />';
elseif ($context['user']['is_guest'])
echo '<a href="'.$scripturl.'?action=register">', $member['avatar']['image'], '</a><br />';
echo '<br />';
}



UPDATE:

[20.03.09] - Added "View the profile of" title by mouseover the avatar



greets  ;)

My English is not the best. German is more my language.

Xavi-Nena

Ferrin,
Awesome I love it! Thanks so much.

busterone


Marcus Forsberg

Thanks. And sorry for the lack of support.
Antechinus has created a incredible, extraordinary, fantastic version of my idea for SMF 2.0 RC1 and it's waiting to get approved.
Therefor, and because of the fact that I'm no longer going to support the old 1.1 version, I'm leaving this mod to be able to create new ones. Better ones.
If anyone wants to take over, tell me.

Thanks for all comments.

Ferrin

Perhaps. I will take over this mod and continue to develop.  ;)



UPDATE: (My post)

[20.03.09] - Added "View the profile of" title by mouseover the avatar
My English is not the best. German is more my language.

Marcus Forsberg

Ferrin has decided not to take over this mod.
Is anyone else interested?

robbie93

How come the download for this has gone from the mod page?

Advertisement: