News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Help on flags mod

Started by FragaCampos, October 22, 2008, 06:40:13 PM

Previous topic - Next topic

FragaCampos

Hello there.
Dunno if this is the right place to ask, but i hope it's ok  O:)

Can anyone check if this 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.

D M G

The memberlist is a real pain to mess with!

[SiNaN]

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.
Former SMF Core Developer | My Mods | SimplePortal

FragaCampos

#3
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


[SiNaN]

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>
Former SMF Core Developer | My Mods | SimplePortal

FragaCampos

Thanks a million [SiNaN]. For your help and readiness.
I'lll share this piece of code of yours in the mod section.

CraigPal

#6
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

FragaCampos

It's true, i didn't notice that...

[SiNaN]

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')" : '') . "
Former SMF Core Developer | My Mods | SimplePortal

FragaCampos

Works great, thanks once more [SiNaN]!

PS: Hope that depression goes away soon...

Andrijachi

Thanks for this ... working perfectly!

Advertisement: