News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

CountryFlags

Started by SMFHacks.com Team, August 14, 2006, 01:07:43 PM

Previous topic - Next topic

karlbenson

This is a gr8 mod. I never like the flags tho.  On my forum I've switched the ones in here for a set 99% from FamFamFam.com by Mark James.

Preview Screenshot:
http://famfamfam.com/lab/icons/flags/flags_preview_large.png

Attached a zip of them.

trackman

#201
Quote from: trackman on January 06, 2007, 07:01:56 AM
I'm using a different theme from the default and the flags won't display in the posts even tho I have set the options in the Admin CPanel. I read that you need to edit Display.Template but I don't know what to add into my theme to make it work.

Any help please :(

Do I add the same code in the default theme into mine :)

karlbenson

open up the mod (zip) and look at the changes it make and manually make the edits to the files in your custom theme

japanlinked

Hello I have installed your flag mod and am was excited to see it working...but...

When new registers arive it asks for there country selection and the flag shows.

But the flags do not show up in the posts.

Also People who where already registered before the mod have no selection in the profile area.

In admin I have selected both ect.
any help
here is the forum hxxp:www.japanlinked.com/forum/ [nonactive]

JayBachatero

I just clicked the link and flags show up for me.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

japanlinked

The flags shop up in the posts ? I can't see any and as the administrator I have no option to choose one. Only  new users can get the option to select, but after that where do they go I dont see any on the board?

japanlinked

HELP! I decided to uninstall and reinstall the flag mod but as soon as I uninstaled it I got a fatal error and can no longer use the forum at all.

I went and manualy tried to delete the mod but now get a parse error as follows:

Parse error: parse error, unexpected T_STRING, expecting ')' in /home/content/J/a/s/JasonLinked/html/forum/Sources/Subs.php on line 3441

I hope you guys can help me I am in dire need of help! Let me know if you need files and where to send them

trackman

Help please I have the following text at the top of my Forum page when I installed the mod:

// Country Flag mod $txt['country_flag_label'] = 'Please select your country'; $txt['country_flag_error_required'] = 'You must select the country that you visit us from'; $txt['country_flag_ask'] = 'Ask for country flag on'; $txt['country_flag_disabled'] = 'Don\'t show (Disabled)'; $txt['country_flag_profile'] = 'Profile'; $txt['country_flag_registration'] = 'Registration'; $txt['country_flag_both'] = 'Both'; $txt['country_flag_required'] = 'Require a member to select a location?'; $txt['country_flag_show'] = 'Show flags on Display page (Where posts are shown).'; $txt['country_flag'] = 'Country'; >:(

txleo

I installed the mod and it worked fine on my board.  I'm using latest version of SMF.

RoarinRow

Quote from: trackman on January 15, 2007, 02:28:51 PM
Help please I have the following text at the top of my Forum page when I installed the mod:

// Country Flag mod $txt['country_flag_label'] = 'Please select your country'; $txt['country_flag_error_required'] = 'You must select the country that you visit us from'; $txt['country_flag_ask'] = 'Ask for country flag on'; $txt['country_flag_disabled'] = 'Don\'t show (Disabled)'; $txt['country_flag_profile'] = 'Profile'; $txt['country_flag_registration'] = 'Registration'; $txt['country_flag_both'] = 'Both'; $txt['country_flag_required'] = 'Require a member to select a location?'; $txt['country_flag_show'] = 'Show flags on Display page (Where posts are shown).'; $txt['country_flag'] = 'Country'; >:(

you have to open up your Themes/default/languages/modification.english.php file and scroll to the bottom.  Move all that code before the '?>' and make sure there is a semicolon separating this code with the last one in your file.   At least that's what I did.

SMF 2.0
TP 1.0 RC1.1
Wordpress 3.1.3

Dhekelian

Quote from: txleo on January 18, 2007, 01:46:52 AM
I installed the mod and it worked fine on my board.  I'm using latest version of SMF.

What version you using? Can you get this working on 1.1.1?

txleo

Forum version: SMF 1.1.1




Quote from: Dhekelian on January 21, 2007, 06:02:24 PM
Quote from: txleo on January 18, 2007, 01:46:52 AM
I installed the mod and it worked fine on my board.  I'm using latest version of SMF.

What version you using? Can you get this working on 1.1.1?

Dhekelian

I have just installed it, made the settings change to include England and the other home countries, uploaded the flags and now I can't even see my forum, it has disappeared.

Dhekelian

I am having real bother not with this mod. I added Eng and some others then three flags started showing in the reg and forum posts so I uninstalled it thinking it was me so I re applied but the same, what gives? Hope you can help.

JayBachatero

Post the changes that you made.  Might have a parse error somewhere.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Dhekelian

I solved that but got another problem. I kept getting three flags. I looked in the modified entries to find there was multiple text refering to the mod, 3 duplicate blocks of code. I can't work out how it happened. It has taken me all night to do it. I have one other mod installed and that is the streaming 3 one. I using the default template and then set the forum to another template either pirates or Leviathen. I was trouble using both together and have just managed, I just hope it stays like it. If I set a test Admin up would you be so kind as to have a quick look, no hurry if your busy. Thanks.

sportographer

Quote from: MrPrise on December 29, 2006, 01:03:21 PM
Well, I did it myself ;-) These are the necessary changes to display the country flags on the memberlist page:

in Memberlist.template.php, in the template_main() add $modSettings in the global line.
Later, before the line
// Old style tabs?
add this:
$colnums=count($context['columns'])+1;

(Note: this is just for our comfort. It counts automatically the colspan value for the tables)

Later there will be four
<td colspan="12">

You should change all the 12 in them to ',$colnums,' so the td will look like this:
<td colspan="',$colnums,'">

And now the real thing. We are going to add a new column for the table. Find this:
<td class="windowbg" align="left">', $member['link'], '</td>

and after that insert these lines:

<td class="windowbg" >';
// Did they select a flag?
if(isset($member['options']['country']) && !empty($modSettings['country_flag_show']) && !empty($member['options']['country']))
{
$flags = CountryFlag();
echo '<img src="', $settings['default_theme_url'], '/images/flags/', $member['options']['country'], '.png" alt="', $flags[$member['options']['country']], '" title="', $flags[$member['options']['country']], '" />';
}
echo '</td>



in Sources/Memberlist.php find

'realName' => array(
'label' => $txt[35]
),


and after it add that:
'location' => array(
'label' => $txt['country_flag'],
'width' => '10'
),


find that:
'realName' => array(
'down' => 'mem.realName ASC',
'up' => 'mem.realName DESC'
),


and after it add that:

'location' => array(
'down' => 'opt.value ASC',
'up' => 'opt.value DESC'
),


Find the line

// Select the members from the database.

and before it add these:

if ($_REQUEST['sort'] === 'location') $where ='opt.variable="country"';

Replace that line

LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))" : '') . "

with that

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'] === 'location' ? " LEFT JOIN {$db_prefix}themes AS opt ON (opt.ID_MEMBER = mem.ID_MEMBER)" : '') . "



Before the line

// Search for messengers...

insert that:

// Search for location.
if (in_array('location', $_POST['fields']))
$fields += array(7 => 'locationTitle', 'location');
            

There is one known bug. If you sort the list by location only those members will be visible who already enter his/her location (country) information. This is because the opt.variable="country" WHERE clause. I'm not an SQL expert, I dont know how to get all the people who has the country value set in the smf_themes table and those who hasn't. Any feedback or fix for that are welcomed!
followed that but it didnt work =\

sportographer

im using black22TP btw, here is my code
memberlist.template.php
<?php
// Version: 1.1; Memberlist

// Displays a sortable listing of all members registered on the forum.
function template_main() $modSettings
{
global $context$settings$options$scripturl$txt;

// Show the link tree.
echo '
<div style="padding: 3px;">'
theme_linktree(), '</div>';

// shall we use the tabs?
if (!empty($settings['use_tabs']))
{
// Display links to view all/search.
echo '
<table cellpadding="0" cellspacing="0" border="0" style="margin-left: 10px;">
<tr>
<td class="mirrortab_first">&nbsp;</td>'
;

foreach ($context['sort_links'] as $link)
{
if ($link['selected'])
echo '
<td class="mirrortab_active_first">&nbsp;</td>
<td valign="top" class="mirrortab_active_back">
<a href="' 
$scripturl '?action=mlist' . (!empty($link['action']) ? ';sa=' $link['action'] : '') . '">'$link['label'], '</a>
</td>
<td class="mirrortab_active_last">&nbsp;</td>'
;
else
echo '
<td valign="top" class="mirrortab_back">
<a href="' 
$scripturl '?action=mlist' . (!empty($link['action']) ? ';sa=' $link['action'] : '') . '">'$link['label'], '</a>
</td>'
;
}

echo '
<td class="mirrortab_last">&nbsp;</td>
</tr>
</table>'
;
}

echo '
<table border="0" cellspacing="1" cellpadding="4" align="center" width="100%" class="bordercolor">'
;

// Old style tabs?
$colnums=count($context['columns'])+1;
if (empty(
$settings['use_tabs']))

{
echo '
<tr class="titlebg">
<td colspan=",$colnums">'
;
$links = array();
foreach ($context['sort_links'] as $link)
$links[] = ($link['selected'] ? '<img src="' $settings['images_url'] . '/selected.gif" alt="&gt;" /> ' '') . '<a href="' $scripturl '?action=mlist' . (!empty($link['action']) ? ';sa=' $link['action'] : '') . '">' $link['label'] . '</a>';

echo '
'
implode(' | '$links), '
</td>
</tr>'
;
}
echo '
<tr>
<td colspan=",$colnums" class="'
, empty($settings['use_tabs']) ? 'catbg' 'titlebg''">';

// 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="0" cellspacing="0" border="0">
<tr>
<td>'
$txt[139], ': '$context['page_index'], '</td>
<td align="right">'
$context['letter_links'] . '</td>
</tr>
</table>'
;
// If this is a result of a search then just show the page numbers.
else
echo '
'
$txt[139], ': '$context['page_index'];

echo '
</td>
</tr>
<tr class="'
, empty($settings['use_tabs']) ? 'titlebg' 'catbg3''">';

// 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>';
}
echo '
</tr>'
;

// Assuming there are members loop through each one displaying their data.
if (!empty($context['members']))
{
foreach ($context['members'] as $member)
echo '
<tr style="text-align: center;"'
, empty($member['sort_letter']) ? '' ' id="letter' $member['sort_letter'] . '"''>
<td class="windowbg2">
'
$context['can_send_pm'] ? '<a href="' $member['online']['href'] . '" title="' $member['online']['text'] . '">' ''$settings['use_image_buttons'] ? '<img src="' $member['online']['image_href'] . '" alt="' $member['online']['text'] . '" align="middle" />' $member['online']['label'], $context['can_send_pm'] ? '</a>' '''
</td>
<td class="windowbg" align="left">'
$member['link'], '</td>
<td class="windowbg" >'
;
// Did they select a flag?
if(isset($member['options']['country']) && !empty($modSettings['country_flag_show']) && !empty($member['options']['country']))
{

$flags CountryFlag();
echo 
'<img src="'$settings['default_theme_url'], '/images/flags/'$member['options']['country'], '.png" alt="'$flags[$member['options']['country']], '" title="'$flags[$member['options']['country']], '" />';

echo 
'</td>
<td class="windowbg2">'
$member['hide_email'] ? '' '<a href="mailto:' $member['email'] . '"><img src="' $settings['images_url'] . '/email_sm.gif" alt="' $txt[69] . '" title="' $txt[69] . ' ' $member['name'] . '" /></a>''</td>
<td class="windowbg">'
$member['website']['url'] != '' '<a href="' $member['website']['url'] . '" target="_blank"><img src="' $settings['images_url'] . '/www.gif" alt="' $member['website']['title'] . '" title="' $member['website']['title'] . '" /></a>' '''</td>
<td class="windowbg2">'
$member['icq']['link'], '</td>
<td class="windowbg2">'
$member['aim']['link'], '</td>
<td class="windowbg2">'
$member['yim']['link'], '</td>
<td class="windowbg2">'
$member['msn']['link'], '</td>
<td class="windowbg" align="left">'
, empty($member['group']) ? $member['post_group'] : $member['group'], '</td>
<td class="windowbg" align="left">'
$member['registered_date'], '</td>
<td class="windowbg2" width="15">'
$member['posts'], '</td>
<td class="windowbg" width="100" align="left">
'
$member['posts'] > '<img src="' $settings['images_url'] . '/bar.gif" width="' $member['post_percent'] . '" height="15" alt="" />' '''
</td>
</tr>'
;
}
// No members?
else
echo '
<tr>
<td colspan=",$colnums" class="windowbg">'
$txt[170], '</td>
</tr>'
;

// Show the page numbers again. (makes 'em easier to find!)
echo '
<tr>
<td class="titlebg" colspan=",$colnums">'
$txt[139], ': '$context['page_index'], '</td>
</tr>
</table>'
;

// If it is displaying the result of a search show a "search again" link to edit their criteria.
if (isset($context['old_search']))
echo '
<br />
<a href="'
$scripturl'?action=mlist;sa=search;search='$context['old_search_value'], '">'$txt['mlist_search2'], '</a>';
}

// A page allowing people to search the member list.
function template_search()
{
global $context$settings$options$scripturl$txt;

// Start the submission form for the search!
echo '
<form action="'
$scripturl'?action=mlist;sa=search" method="post" accept-charset="'$context['character_set'], '">';

// Display that link tree...
echo '
<div style="padding: 3px;">'
theme_linktree(), '</div>';

// Display links to view all/search.
if (!empty($settings['use_tabs']))
{
echo '
<table cellpadding="0" cellspacing="0" border="0" style="margin-left: 10px;">
<tr>
<td class="mirrortab_first">&nbsp;</td>'
;

foreach ($context['sort_links'] as $link)
{
if ($link['selected'])
echo '
<td class="mirrortab_active_first">&nbsp;</td>
<td valign="top" class="mirrortab_active_back">
<a href="' 
$scripturl '?action=mlist' . (!empty($link['action']) ? ';sa=' $link['action'] : '') . '">'$link['label'], '</a>
</td>
<td class="mirrortab_active_last">&nbsp;</td>'
;
else
echo '
<td valign="top" class="mirrortab_back">
<a href="' 
$scripturl '?action=mlist' . (!empty($link['action']) ? ';sa=' $link['action'] : '') . '">'$link['label'], '</a>
</td>'
;
}

echo '
<td class="mirrortab_last">&nbsp;</td>
</tr>
</table>
<div class="tborder">'
;
}
else
{
echo '
<div class="bordercolor" style="padding: 1px;">
<div class="titlebg" style="padding: 4px 4px 4px 10px;">'
;
$links = array();
foreach ($context['sort_links'] as $link)
$links[] = ($link['selected'] ? '<img src="' $settings['images_url'] . '/selected.gif" alt="&gt;" /> ' '') . '<a href="' $scripturl '?action=mlist' . (!empty($link['action']) ? ';sa=' $link['action'] : '') . '">' $link['label'] . '</a>';

echo '
'
implode(' | '$links), '
</div>
</div>
<div class="bordercolor" style="padding: 1px">'
;
}

// Display the input boxes for the form.
echo '

<div class="windowbg" align="center" style="padding-bottom: 1ex;">
<table width="440" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" align="left">
<br />
<b>'
$txt[582], ':</b> <input type="text" name="search" value="'$context['old_search'], '" size="35" /> <input type="submit" name="submit" value="' $txt[182] . '" style="margin-left: 20px;" /><br />
<br />
</td>
</tr>
<tr>
<td align="left">
<label for="fields-email"><input type="checkbox" name="fields[]" id="fields-email" value="email" checked="checked" class="check" /> '
$txt['mlist_search_email'], '</label><br />
<label for="fields-messenger"><input type="checkbox" name="fields[]" id="fields-messenger" value="messenger" class="check" /> '
$txt['mlist_search_messenger'], '</label><br />
<label for="fields-group"><input type="checkbox" name="fields[]" id="fields-group" value="group" class="check" /> '
$txt['mlist_search_group'], '</label>
</td>
<td align="left" valign="top">
<label for="fields-name"><input type="checkbox" name="fields[]" id="fields-name" value="name" checked="checked" class="check" /> '
$txt['mlist_search_name'], '</label><br />
<label for="fields-website"><input type="checkbox" name="fields[]" id="fields-website" value="website" class="check" /> '
$txt['mlist_search_website'], '</label>
</td>
</tr>
</table>
</div>
</div>
</form>'
;
}

?>


memberlist.php

<?php
/**********************************************************************************
* Memberlist.php                                                                  *
***********************************************************************************
* SMF: Simple Machines Forum                                                      *
* Open-Source Project Inspired by Zef Hemel ([email protected])                    *
* =============================================================================== *
* Software Version:           SMF 1.1                                             *
* Software by:                Simple Machines (http://www.simplemachines.org)     *
* Copyright 2006 by:          Simple Machines LLC (http://www.simplemachines.org) *
*           2001-2006 by:     Lewis Media (http://www.lewismedia.com)             *
* Support, News, Updates at:  http://www.simplemachines.org                       *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under   *
* the terms of the provided license as published by Simple Machines LLC.          *
*                                                                                 *
* This program is distributed in the hope that it is and will be useful, but      *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY    *
* or FITNESS FOR A PARTICULAR PURPOSE.                                            *
*                                                                                 *
* See the "license.txt" file for details of the Simple Machines license.          *
* The latest version can always be found at http://www.simplemachines.org.        *
**********************************************************************************/
if (!defined('SMF'))
die('Hacking attempt...');

/* This file contains the functions for displaying and searching in the
members list.  It does so with these functions:

void MemberList()
- shows a list of registered members.
- if a subaction is not specified, lists all registered members.
- allows searching for members with the 'search' sub action.
- calls MLAll or MLSearch depending on the sub action.
- uses the Memberlist template with the main sub template.
- requires the view_mlist permission.
- is accessed via ?action=mlist.

void MLAll()
- used to display all members on a page by page basis with sorting.
- called from MemberList().
- can be passed a sort parameter, to order the display of members.
- calls printMemberListRows to retrieve the results of the query.

void MLSearch()
- used to search for members or display search results.
- called by MemberList().
- if variable 'search' is empty displays search dialog box, using the
  search sub template.
- calls printMemberListRows to retrieve the results of the query.

void printMemberListRows(resource request)
- retrieves results of the request passed to it
- puts results of request into the context for the sub template.
*/

// Show a listing of the registered members.
function Memberlist()
{
global $scripturl$txt$modSettings$context$settings;

// Make sure they can view the memberlist.
isAllowedTo('view_mlist');

loadTemplate('Memberlist');

$context['listing_by'] = !empty($_GET['sa']) ? $_GET['sa'] : 'all';

// $subActions array format:
// 'subaction' => array('label', 'function', 'is_selected')
$subActions = array(
'all' => array(&$txt[303], 'MLAll'$context['listing_by'] == 'all'),
'search' => array(&$txt['mlist_search'], 'MLSearch'$context['listing_by'] == 'search'),
);

// Set up the sort links.
$context['sort_links'] = array();
foreach ($subActions as $act => $text)
$context['sort_links'][] = array(
'label' => $text[0],
'action' => $act,
'selected' => $text[2],
);

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

// Set up the columns...
$context['columns'] = array(
'isOnline' => array(
'label' => $txt['online8'],
'width' => '20'
),
'realName' => array(
'label' => $txt[35]

),
'location' => array(
'label' => $txt['country_flag'],
'width' => '10'
),
'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'
)
);

$context['linktree'][] = array(
'url' => $scripturl '?action=mlist',
'name' => &$txt[332]
);

$context['can_send_pm'] = allowedTo('pm_send');

// Jump to the sub action.
if (isset($subActions[$context['listing_by']]))
$subActions[$context['listing_by']][1]();
else
$subActions['all'][1]();
}

// List all members, page by page.
function MLAll()
{
global $txt$scripturl$db_prefix$user_info;
global $modSettings$context$func;

// The chunk size for the cached index.
$cache_step_size 500;

// Only use caching if:
// 1. there are at least 2k members,
// 2. the default sorting method (realName) is being used,
// 3. the page shown is high enough to make a DB filesort unprofitable.
$use_cache $modSettings['totalMembers'] > 2000 && (!isset($_REQUEST['sort']) || $_REQUEST['sort'] === 'realName') && isset($_REQUEST['start']) && $_REQUEST['start'] > $cache_step_size;

if ($use_cache)
{
// Maybe there's something cached already.
if (!empty($modSettings['memberlist_cache']))
$memberlist_cache = @unserialize($modSettings['memberlist_cache']);

// Only update the cache if something changed or no cache existed yet.
if (empty($memberlist_cache) || empty($modSettings['memberlist_updated']) || $memberlist_cache['last_update'] < $modSettings['memberlist_updated'])
{
$request db_query("
SELECT realName
FROM 
{$db_prefix}members
WHERE is_activated = 1
ORDER BY realName"
__FILE____LINE__);

$memberlist_cache = array(
'last_update' => time(),
'num_members' => mysql_num_rows($request),
'index' => array(),
);

for ($i 0$n mysql_num_rows($request); $i $n$i += $cache_step_size)
{
mysql_data_seek($request$i);
list($memberlist_cache['index'][$i]) = mysql_fetch_row($request);
}
mysql_data_seek($request$memberlist_cache['num_members'] - 1);
list($memberlist_cache['index'][$i]) = mysql_fetch_row($request);
mysql_free_result($request);

// Now we've got the cache...store it.
updateSettings(array('memberlist_cache' => addslashes(serialize($memberlist_cache))));
}

$context['num_members'] = $memberlist_cache['num_members'];
}

// Without cache we need an extra query to get the amount of members.
else
{
$request db_query("
SELECT COUNT(*)
FROM 
{$db_prefix}members
WHERE is_activated = 1"
__FILE____LINE__);
list ($context['num_members']) = mysql_fetch_row($request);
mysql_free_result($request);
}

// Set defaults for sort (realName) and start. (0)
if (!isset($_REQUEST['sort']) || !isset($context['columns'][$_REQUEST['sort']]))
$_REQUEST['sort'] = 'realName';

if (!is_numeric($_REQUEST['start']))
{
if (preg_match('~^[^\'\\\\/]~' . ($context['utf8'] ? 'u' ''), $func['strtolower']($_REQUEST['start']), $match) === 0)
fatal_error('Hacker?'false);

$_REQUEST['start'] = $match[0];

$request db_query("
SELECT COUNT(*)
FROM 
{$db_prefix}members
WHERE LOWER(SUBSTRING(realName, 1, 1)) < '
$_REQUEST[start]'
AND is_activated = 1"
__FILE____LINE__);
list ($_REQUEST['start']) = mysql_fetch_row($request);
mysql_free_result($request);
}

$context['letter_links'] = '';
for ($i 97$i 123$i++)
$context['letter_links'] .= '<a href="' $scripturl '?action=mlist;sa=all;start=' chr($i) . '#letter' chr($i) . '">' strtoupper(chr($i)) . '</a> ';

// Sort out the column information.
foreach ($context['columns'] as $col => $dummy)
{
$context['columns'][$col]['href'] = $scripturl '?action=mlist;sort=' $col ';start=0';

if (!isset($_REQUEST['desc']) && $col == $_REQUEST['sort'])
$context['columns'][$col]['href'] .= ';desc';

$context['columns'][$col]['link'] = '<a href="' $context['columns'][$col]['href'] . '">' $context['columns'][$col]['label'] . '</a>';
$context['columns'][$col]['selected'] = $_REQUEST['sort'] == $col;
}

$context['sort_by'] = $_REQUEST['sort'];
$context['sort_direction'] = !isset($_REQUEST['desc']) ? 'down' 'up';

// Construct the page index.
$context['page_index'] = constructPageIndex($scripturl '?action=mlist;sort=' $_REQUEST['sort'] . (isset($_REQUEST['desc']) ? ';desc' ''), $_REQUEST['start'], $context['num_members'], $modSettings['defaultMaxMembers']);

// Send the data to the template.
$context['start'] = $_REQUEST['start'] + 1;
$context['end'] = min($_REQUEST['start'] + $modSettings['defaultMaxMembers'], $context['num_members']);

$context['page_title'] = $txt[308] . ' ' $context['start'] . ' ' $txt[311] . ' ' $context['end'];
$context['linktree'][] = array(
'url' => $scripturl '?action=mlist;sort=' $_REQUEST['sort'] . ';start=' $_REQUEST['start'],
'name' => &$context['page_title'],
'extra_after' => ' (' $txt[309] . ' ' $context['num_members'] . ' ' $txt[310] . ')'
);

// 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'
),
'location' => array(
'down' => 'opt.value ASC',
'up' => 'opt.value 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'
)
);

$limit $_REQUEST['start'];

// Using cache allows to narrow down the list to be retrieved.
if ($use_cache && $_REQUEST['sort'] === 'realName' && !isset($_REQUEST['desc']))
{
$first_offset $_REQUEST['start'] - ($_REQUEST['start'] % $cache_step_size);
$second_offset ceil(($_REQUEST['start'] + $modSettings['defaultMaxMembers']) / $cache_step_size) * $cache_step_size;
$where "mem.realName BETWEEN '" addslashes($memberlist_cache['index'][$first_offset]) . "' AND '" addslashes($memberlist_cache['index'][$second_offset]) . "'";
$limit -= $first_offset;
}

// Reverse sorting is a bit more complicated...
elseif ($use_cache && $_REQUEST['sort'] === 'realName')
{
$first_offset floor(($memberlist_cache['num_members'] - $modSettings['defaultMaxMembers'] - $_REQUEST['start']) / $cache_step_size) * $cache_step_size;
if ($first_offset 0)
$first_offset 0;
$second_offset ceil(($memberlist_cache['num_members'] - $_REQUEST['start']) / $cache_step_size) * $cache_step_size;
$where "mem.realName BETWEEN '" addslashes($memberlist_cache['index'][$first_offset]) . "' AND '" addslashes($memberlist_cache['index'][$second_offset]) . "'";
$limit $second_offset - ($memberlist_cache['num_members'] - $_REQUEST['start']) - ($second_offset $memberlist_cache['num_members'] ? $cache_step_size - ($memberlist_cache['num_members'] % $cache_step_size) : 0);
}
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP 0mem.ID_POST_GROUPmem.ID_GROUP))" : '') . 
(
$_REQUEST['sort'] === 'location' ? " LEFT JOIN {$db_prefix}themes AS opt ON (opt.ID_MEMBER mem.ID_MEMBER)" : '') . "// Select the members from the database.
$request db_query("
SELECT mem.ID_MEMBER
FROM 
{$db_prefix}members AS mem" . ($_REQUEST['sort'] === 'isOnline' "
LEFT JOIN 
{$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)" '') . ($_REQUEST['sort'] === 'ID_GROUP' "
LEFT JOIN 
{$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))" '') . "
WHERE mem.is_activated = 1" 
. (empty($where) ? '' "
AND 
$where") . "
ORDER BY " 
$sort_methods[$_REQUEST['sort']][$context['sort_direction']] . "
LIMIT 
$limit$modSettings[defaultMaxMembers]"__FILE____LINE__);
printMemberListRows($request);
mysql_free_result($request);

// Add anchors at the start of each letter.
if ($_REQUEST['sort'] == 'realName')
{
$last_letter '';
foreach ($context['members'] as $i => $dummy)
{
$this_letter $func['strtolower']($func['substr']($context['members'][$i]['name'], 01));

if ($this_letter != $last_letter && preg_match('~[a-z]~'$this_letter) === 1)
{
$context['members'][$i]['sort_letter'] = htmlspecialchars($this_letter);
$last_letter $this_letter;
}
}
}
}

// Search for members...
function MLSearch()
{
global $txt$scripturl$db_prefix$context$user_info$modSettings;

$context['page_title'] = $txt['mlist_search'];

// They're searching..
if (isset($_REQUEST['search']) && isset($_REQUEST['fields']))
{
$_POST['search'] = trim(isset($_GET['search']) ? $_GET['search'] : $_POST['search']);
$_POST['fields'] = isset($_GET['fields']) ? explode(','$_GET['fields']) : $_POST['fields'];

$context['old_search'] = $_REQUEST['search'];
$context['old_search_value'] = urlencode($_REQUEST['search']);

// No fields?  Use default...
if (empty($_POST['fields']))
$_POST['fields'] = array('name');

// Search for a name?
if (in_array('name'$_POST['fields']))
$fields = array('memberName''realName');
else
$fields = array();
// Search for location.
if (in_array('location'$_POST['fields']))
$fields += array(=> 'locationTitle''location');
// Search for messengers...
if (in_array('messenger'$_POST['fields']) && (!$user_info['is_guest'] || empty($modSettings['guest_hideContacts'])))
$fields += array(=> 'MSN''AIM''ICQ''YIM')
;
// Search for websites.
if (in_array('website'$_POST['fields']))
$fields += array(=> 'websiteTitle''websiteUrl');
// Search for groups.
if (in_array('group'$_POST['fields']))
$fields += array(=> 'IFNULL(groupName, \'\')');
// Search for an email address?
if (in_array('email'$_POST['fields']))
{
$fields += array(=> allowedTo('moderate_forum') ? 'emailAddress' '(hideEmail = 0 AND emailAddress');
$condition allowedTo('moderate_forum') ? '' ')';
}
else
$condition '';

$query $_POST['search'] == '' "= ''" "LIKE '%" strtr($_POST['search'], array('_' => '\\_''%' => '\\%''*' => '%')) . "%'";

$request db_query("
SELECT COUNT(*)
FROM 
{$db_prefix}members AS mem
LEFT JOIN 
{$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))
WHERE " 
implode($query OR "$fields) . $query$condition
AND is_activated = 1"
__FILE____LINE__);
list ($numResults) = mysql_fetch_row($request);
mysql_free_result($request);

$context['page_index'] = constructPageIndex($scripturl '?action=mlist;sa=search;search=' $_POST['search'] . ';fields=' implode(','$_POST['fields']), $_REQUEST['start'], $numResults$modSettings['defaultMaxMembers']);

// Find the members from the database.
// !!!SLOW This query is slow.
$request db_query("
SELECT mem.ID_MEMBER
FROM 
{$db_prefix}members AS mem
LEFT JOIN 
{$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN 
{$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))
WHERE " 
implode($query OR "$fields) . $query$condition
AND is_activated = 1
LIMIT 
$_REQUEST[start]$modSettings[defaultMaxMembers]"__FILE____LINE__);
printMemberListRows($request);
mysql_free_result($request);
}
else
{
$context['sub_template'] = 'search';
$context['old_search'] = isset($_REQUEST['search']) ? htmlspecialchars($_REQUEST['search']) : '';
}

$context['linktree'][] = array(
'url' => $scripturl '?action=mlist;sa=search',
'name' => &$context['page_title']
);
}

function 
printMemberListRows($request)
{
global $scripturl$txt$db_prefix$user_info$modSettings;
global $context$settings$memberContext;

// Get the most posts.
$result db_query("
SELECT MAX(posts)
FROM 
{$db_prefix}members"__FILE____LINE__);
list ($MOST_POSTS) = mysql_fetch_row($result);
mysql_free_result($result);

// Avoid division by zero...
if ($MOST_POSTS == 0)
$MOST_POSTS 1;

$members = array();
while ($row mysql_fetch_assoc($request))
$members[] = $row['ID_MEMBER'];

// Load all the members for display.
loadMemberData($members);

$context['members'] = array();
foreach ($members as $member)
{
if (!loadMemberContext($member))
continue;

$context['members'][$member] = $memberContext[$member];
$context['members'][$member]['post_percent'] = round(($context['members'][$member]['real_posts'] * 100) / $MOST_POSTS);
$context['members'][$member]['registered_date'] = strftime('%Y-%m-%d'$context['members'][$member]['registered_timestamp']);
}
}

?>
[/code[

Dhekelian

Hi, I have edited some more files because of the multiple entries but I cannot get rid of the 3 countries entry on the registration page. Could you tell me what file I need to edit. I have looked in the register.template.php and did that I think.

linders

Hello,

Just installed this mod/package and it works fine when the default language is English, as it shows:
Country:      "country name" "flag"

When I change the language to Spanish, there is no word to replace "Country" with (i.e., "País" does not appear).

Anything that can be fixed simply?

Thanks.

Advertisement: