Hello there.
Dunno if this is the right place to ask, but i hope it's ok O:)
Can anyone check if this (http://www.simplemachines.org/community/index.php?topic=106060.0) mod can be modified to had a column in the memberlist with the flag of each member? Does anyone knows if this is "easy" to implement?
Thanks anyhow.
The memberlist is a real pain to mess with!
Memberlist.php
Find:
'posts' => array(
Replace:
'country' => array(
'label' => 'Country'
),
'posts' => array(
This will add the column to the template.
Memberlist.template.php
Find:
// Assuming there are members loop through each one displaying their data.
Replace:
$flags = CountryFlag();
// Assuming there are members loop through each one displaying their data.
This will load all the flags and their information.
Find:
<td class="windowbg2" width="15">', $member['posts'], '</td>
Replace:
<td class="windowbg2" width="15">', $member['posts'], '</td>
<td class="windowbg2" width="15">', !empty($member['options']['country']) ? '<img src="' . $settings['default_theme_url'] . '/images/flags/' . $member['options']['country'] . '.png" alt="' . $flags[$member['options']['country']] . '" />' : '', '</td>
This will output the info for every user.
Find:
<td colspan="12">';
Replace:
<td colspan="13">';
Find:
<td colspan="12" class="', empty($settings['use_tabs']) ? 'catbg' : 'titlebg', '">';
Replace:
<td colspan="13" class="', empty($settings['use_tabs']) ? 'catbg' : 'titlebg', '">';
Find:
<td colspan="12" class="windowbg">', $txt[170], '</td>
Replace:
<td colspan="13" class="windowbg">', $txt[170], '</td>
Find:
<td class="titlebg" colspan="12">', $txt[139], ': ', $context['page_index'], '</td>
Replace:
<td class="titlebg" colspan="13">', $txt[139], ': ', $context['page_index'], '</td>
Above are the template colspan fixes.
First of all, thank you very much for helping on this ;D
I made all the changes and it works, but with a minor problem. As you can see in the screenshot, the columns "country" and "posts" are switched. Help? :P
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg232.imageshack.us%2Fimg232%2F7412%2Fsemttulozk9.th.jpg&hash=8820fc36a70d48a6946e85763be8012e9bc3d4fe) (http://img232.imageshack.us/my.php?image=semttulozk9.jpg)(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg232.imageshack.us%2Fimages%2Fthpix.gif&hash=d27b408464bb450c652915767fef18b87f5ade7d) (http://g.imageshack.us/thpix.php)
Sorry.
Now,
MemberList.template.php
Find:
<td class="windowbg2" width="15">', $member['posts'], '</td>
<td class="windowbg2" width="15">', !empty($member['options']['country']) ? '<img src="' . $settings['default_theme_url'] . '/images/flags/' . $member['options']['country'] . '.png" alt="' . $flags[$member['options']['country']] . '" />' : '', '</td>
Replace:
<td class="windowbg2" width="15">', !empty($member['options']['country']) ? '<img src="' . $settings['default_theme_url'] . '/images/flags/' . $member['options']['country'] . '.png" alt="' . $flags[$member['options']['country']] . '" />' : '', '</td>
<td class="windowbg2" width="15">', $member['posts'], '</td>
Thanks a million [SiNaN]. For your help and readiness.
I'lll share this piece of code of yours in the mod section.
Thanks bunches!
The only problem I have is that I get an error when trying to sort by country:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 0, 50' at line 5
File: /home1/rawpaleo/public_html/Sources/Memberlist.php
Line: 345
Craig
_________________
Raw Paleolithic Diet (http://www.rawpaleodiet.com)
It's true, i didn't notice that...
Missed that, sorry.
Memberlist.php
Find:
'posts' => array(
'down' => 'mem.posts DESC',
Replace:
'country' => array(
'down' => 'ISNULL(tc.value) ASC, tc.value ASC',
'up' => 'ISNULL(tc.value) DESC, tc.value DESC'
),
'posts' => array(
'down' => 'mem.posts DESC',
Find:
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))" : '') . "
Replace:
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))" : '') . ($_REQUEST['sort'] === 'country' ? "
LEFT JOIN {$db_prefix}themes AS tc ON (tc.ID_MEMBER = mem.ID_MEMBER AND tc.variable = 'country')" : '') . "
Works great, thanks once more [SiNaN]!
PS: Hope that depression goes away soon...
Thanks for this ... working perfectly!