SMF Support > SMF 1.1.x Support

Memberlist changes

(1/3) > >>

Redeye:
Is it possible to change the "Position" field to show "Location" in the memberlist, and if so some tips please.

TIA

Oldiesmann:
Sure... You could do that...

Open Sources/Memberlist.php
Search for:

--- Code: --- 'ID_GROUP' => array(
'label' => $txt[87]
),
--- End code ---

Replace with:

--- Code: --- 'location' => array(
'label' => $txt[227]
),
--- End code ---

Open Themes/Memberlist.template.php
Search for:

--- Code: --- <td class="windowbg" align="left">', $member['group'], '</td>
--- End code ---

Replace with:

--- Code: --- <td class="windowbg" align="left">', $member['location'], '</td>
--- End code ---

Enjoy

Redeye:
Oldiesmann, this is the only instance of ID_GROUP in memberlist.php


--- Quote ---'ID_GROUP' => array(
         'down' => 'ISNULL(mg.groupName) ASC, mg.groupName ASC',
         'up' => 'ISNULL(mg.groupName) DESC, mg.groupName DESC'
      ),
--- End quote ---

So is it still a straight replacement?

Oldiesmann:
Actually, that's not the only one. Look further up in the file, in the columns array. However, now that you mention it, I see there are a bunch of other things that need replacing as well. So, in addition to the changes I mentioned above, in Memberlist.php...

Search for:

--- Code: --- 'ID_GROUP' => array(
'down' => 'ISNULL(mg.groupName) ASC, mg.groupName ASC',
'up' => 'ISNULL(mg.groupName) DESC, mg.groupName DESC'
),
--- End code ---

Replace with:

--- Code: --- 'location' => array(
'down' => 'ISNULL(mem.location) ASC, mem.location ASC',
'up' => 'ISNULL(mem.location) DESC, mem.location DESC'
),
--- End code ---

Search for:

--- Code: --- $request = db_query("
SELECT
mem.memberName, mem.realName, mem.websiteTitle, mem.websiteUrl, mem.posts,
mem.ID_GROUP, mem.ICQ, mem.AIM, mem.YIM, mem.MSN, mem.emailAddress,
mem.hideEmail, mem.ID_MEMBER, IFNULL(lo.logTime, 0) AS isOnline,
IFNULL(mg.groupName, '') AS groupName, mem.showOnline, mem.dateRegistered
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 = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))
ORDER BY " . $sort_methods[$_REQUEST['sort']][$context['sort_direction']] . "
LIMIT $_REQUEST[start], $modSettings[defaultMaxMembers]", __FILE__, __LINE__);
--- End code ---

Replace with:

--- Code: --- $request = db_query("
SELECT
mem.memberName, mem.realName, mem.websiteTitle, mem.websiteUrl, mem.posts,
mem.ID_GROUP, mem.ICQ, mem.AIM, mem.YIM, mem.MSN, mem.emailAddress,
mem.hideEmail, mem.ID_MEMBER, IFNULL(lo.logTime, 0) AS isOnline,
mem.location, mem.showOnline, mem.dateRegistered
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
ORDER BY " . $sort_methods[$_REQUEST['sort']][$context['sort_direction']] . "
LIMIT $_REQUEST[start], $modSettings[defaultMaxMembers]", __FILE__, __LINE__);
--- End code ---

Search for:

--- Code: --- // Search for groups.
if (in_array('group', $_POST['fields']))
$fields += array(9 => 'IFNULL(groupName, \'\')');
--- End code ---

Replace with:

--- Code: --- // Search for locations.
if (in_array('location', $_POST['fields']))
$fields += array(9 => 'IFNULL(location, \'\')');
--- End code ---

Search for:

--- Code: --- $request = db_query("
SELECT COUNT(ID_MEMBER)
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))
WHERE " . implode(" $query OR ", $fields) . " $query$condition", __FILE__, __LINE__);
--- End code ---

Replace with:

--- Code: --- $request = db_query("
SELECT COUNT(ID_MEMBER)
FROM {$db_prefix}members AS mem
WHERE " . implode(" $query OR ", $fields) . " $query$condition", __FILE__, __LINE__);
--- End code ---

Search for:

--- Code: --- // Find the members from the database.
$request = db_query("
SELECT
memberName, realName, websiteTitle, websiteUrl, posts, mem.ID_GROUP, ICQ, AIM, YIM, MSN, emailAddress,
hideEmail, mem.ID_MEMBER, IFNULL(lo.logTime, 0) AS isOnline, IFNULL(mg.groupName, '') AS groupName,
mem.dateRegistered
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 = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))
WHERE " . implode(" $query OR ", $fields) . " $query$condition
LIMIT $_REQUEST[start], $modSettings[defaultMaxMembers]", __FILE__, __LINE__);
--- End code ---

Replace with:

--- Code: --- // Find the members from the database.
$request = db_query("
SELECT
memberName, realName, websiteTitle, websiteUrl, posts, mem.ID_GROUP, ICQ, AIM, YIM, MSN, emailAddress,
hideEmail, mem.ID_MEMBER, IFNULL(lo.logTime, 0) AS isOnline, mem.location,
mem.dateRegistered
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
WHERE " . implode(" $query OR ", $fields) . " $query$condition
LIMIT $_REQUEST[start], $modSettings[defaultMaxMembers]", __FILE__, __LINE__);
--- End code ---

Search for:

--- Code: --- 'group' => $row['groupName'],
--- End code ---

Replace with:

--- Code: --- 'location' => $row['location'],
--- End code ---

Redeye:
So just the odd one or two eh!  :D

Navigation

[0] Message Index

[#] Next page

Go to full version