Home Webboard ArticlesKnowledges  
ข่าวประกาศ:

:: กติกา มารยาท ในการใช้งานเว็บบอร์ด ::
กรุณากรอกอีเมล์จริงในการสมัคร และรับอีเมล์ยืนยันเพื่อใช้งานในบอร์ด

ผู้เขียน หัวข้อ: ติดตั้ง MOD MemberColorLink 302  (อ่าน 15374 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

นร...

  • บุคคลทั่วไป
ติดตั้ง MOD MemberColorLink 302
« เมื่อ: 08, สิงหาคม 2008, 01:50:35 PM »
อีกรอบกับ MOD Member Color Link 302

SMF 1.1.5

อ้างจาก ./Themes/default นะครับ



ก่อนที่จะแก้ไขไฟล์ใดๆ เพื่อเป็นการป้องกันการผิดพลาด อย่าลืมสำรองไฟล์เก่าไว้ด้วยนะครับ

กรณี วางต่อจากที่หา... ให้ขึ้นบรรทัดใหม่ก่อนนะครับ

ไฟล์ที่แก้ไข

1.  ./Sources/ModSettings.php
2.  ./Sources/Load.php
3.  ./Sources/MessageIndex.php
4.  ./Sources/BoardIndex.php
5.  ./Sources/Calendar.php
6.  ./Sources/Display.php
7.  ./Sources/Recent.php
8.  ./Sources/PersonalMessage.php
9.  ./Sources/Stats.php
10.  ./Sources/Subs.php
11.  ./Sources/Search.php
12.  ./Themes/default/Calendar.template.php
13.  ./Themes/default/BoardIndex.template.php
14.  ./Themes/default/Profile.template.php
15.  ./Sources/ManageMembergroups.php
16.  ./Themes/default/languages/Modifications.english.php
17.  ./Themes/default/languages/Modifications.thai.php



1.  ./Sources/ModSettings.php
ค้นหา...
โค๊ด: [Select]
'layout' => array(
'title' => $txt['mods_cat_layout'],
'href' => $scripturl . '?action=featuresettings;sa=layout;sesc=' . $context['session_id'],
),

วางทับแทนที่หา...
โค๊ด: [Select]
'layout' => array(
'title' => $txt['mods_cat_layout'],
'href' => $scripturl . '?action=featuresettings;sa=layout;sesc=' . $context['session_id'],
),
'MemberColorLinks' => array(
'title' => $txt['MemberColorLinkHeadline'],
'href' => $scripturl . '?action=featuresettings;sa=MemberColorLinks;sesc=' . $context['session_id'],
),

ค้นหา...
โค๊ด: [Select]
'layout' => 'ModifyLayoutSettings',
วางทับแทนที่หา...
โค๊ด: [Select]
'layout' => 'ModifyLayoutSettings',
'MemberColorLinks' => 'ModifyMemberColorLinksSettings',

ค้นหา...
โค๊ด: [Select]
$context['post_url'] = $scripturl . '?action=featuresettings2;save;sa=karma';
$context['settings_title'] = $txt['smf293'];

prepareDBSettingContext($config_vars);
}

วางต่อจากที่หา...
โค๊ด: [Select]
function ModifyMemberColorLinksSettings()
{
global $txt, $scripturl, $context, $settings, $sc;

$config_vars = array(
// Standard Membercolor?
array('check', 'MemberColorLink'),
array('check', 'MemberColorLinkOldSpanStyle'),
'',
//Some Stat Settings
array('check', 'MemberColorLatestMember'),
array('check', 'MemberColorStats'),
array('check', 'MemberColorWhoIsOnline'),
'',
//Thread and Boardsettings
array('check', 'MemberColorThreadOwner'),
array('check', 'MemberColorThreadLastPost'),
array('check', 'MemberColorThreadChild'),
'',
//Birthday and Calendar
array('check', 'MemberColorModeratorLinks'),
array('check', 'MemberColorBoardindex'),
array('check', 'MemberColorBirthday'),
'',
//Some Recent Things
array('check', 'MemberColorRecentOwner'),
array('check', 'MemberColorRecentLastPost'),
'',
// PM Colors
array('check', 'MemberColorInbox'),
array('check', 'MemberColorOutbox'),
'',
//The Heavy Member Search Option
array('check' , 'MemberColorAllSearch'),
'',
//Birthday Color
array('text', 'MemberColorBanned'),
//Guest Color
array('text', 'MemberColorGuests'),
//Birthday User Color
array('text', 'MemberColorBirthdayColor'),
);

// Saving?
if (isset($_GET['save']))
{
saveDBSettings($config_vars);
redirectexit('action=featuresettings;sa=MemberColorLinks');
}

$context['post_url'] = $scripturl . '?action=featuresettings2;save;sa=MemberColorLinks';
$context['settings_title'] = $txt['MemberColorLinkHeadline'];

prepareDBSettingContext($config_vars);
}



2.  ./Sources/Load.php
ค้นหา...
โค๊ด: [Select]
array loadMemberData(array members, bool is_name = false, string set = 'normal')
วางทับแทนที่หา...
โค๊ด: [Select]
array load_OnlineColors(array members, bool returnarray = true, bool singleuser = false)
- This function is for Modcreators who like to color the nicks if the MemberColorLink is installed
  with this function the user can check if the function exists and load the colors if needed.
  But please load so many ids as possible at one time, to reduce the database querys.
  To Check if the function exist use if(!empty($modSettings['MemberColorLinkInstalled'])) {}
- return a array with follow informations
array(id_member => array(online_color => '', colored_name => '', colored_link => '');
- The option single user will only return one user color as array, without id before.
- chache datas the global $color_profile (only the db data, not the array data above)
- return "false" on nothing loaded!

bool/string load_mod_color(bool return = false, update = null)
- Store the Moderator Color into the $context['modGroupColor']
- "return = true" will return this color as string
- This function use only one time the query to load this color
- update is for the fast update of the moderator color

bool compare_birthday(string brtihday)
- Compare Today with the Birthday, true if today his/her birthday

array loadMemberData(array members, bool is_name = false, string set = 'normal')

ค้นหา...
โค๊ด: [Select]
// UTF-8 in regular expressions is unsupported on PHP(win) versions < 4.2.3.
วางทับแทนที่หา...
โค๊ด: [Select]
//This setting should never chached, it show others that member color link is installed!
$modSettings['MemberColorLinkInstalled'] = function_exists('load_onlineColors') ? 1 : 0;
$modSettings['MemberColorLinkVersion'] = '3.0.2';

// UTF-8 in regular expressions is unsupported on PHP(win) versions < 4.2.3.

ค้นหา...
โค๊ด: [Select]
global $user_profile, $db_prefix, $modSettings, $board_info;
วางทับแทนที่หา...
โค๊ด: [Select]
global $user_profile, $db_prefix, $modSettings, $board_info;
global $color_profile; //This is for Preloaded Data, i will not load it twice you know ;)

ค้นหา...
โค๊ด: [Select]
$loaded_ids[] = $data['ID_MEMBER'];
$user_profile[$data['ID_MEMBER']] = $data;

วางทับแทนที่หา...
โค๊ด: [Select]
$loaded_ids[] = $data['ID_MEMBER'];
$user_profile[$data['ID_MEMBER']] = $data;
//Happy Birthday Color to this user :D
if(!empty($modSettings['MemberColorBirthday']) && !empty($data['birthdate']) && compare_colorBirthdate($data['birthdate'])) {
$user_profile[$row['ID_MEMBER']]['post_group_color'] = $modSettings['MemberColorBirthdayColor'];
$user_profile[$row['ID_MEMBER']]['member_group_color'] = $modSettings['MemberColorBirthdayColor'];
}
//Color Banned user, replace there color... hope they are not moderators ;P?
if(!empty($modSettings['MemberColorBanned']) && isset($data['is_activated']) && $data['is_activated'] >= 10) {
$user_profile[$row['ID_MEMBER']]['post_group_color'] = $modSettings['MemberColorBanned'];
$user_profile[$row['ID_MEMBER']]['member_group_color'] = $modSettings['MemberColorBanned'];
}
//Memeber Color Link will used Chached Data, too wheee.
if($set == 'normal' || $set == 'profile') //This are the only sets with the info the mod need.
$color_profile[$data['ID_MEMBER']] = array(
'ID_MEMBER' => $data['ID_MEMBER'],
'realName' => $data['realName'],
'member_group_color' => $user_profile[$row['ID_MEMBER']]['member_group_color'],
'post_group_color' => $user_profile[$row['ID_MEMBER']]['post_group_color'],
);

ค้นหา...
โค๊ด: [Select]
$user_profile[$row['ID_MEMBER']] = $row;
วางทับแทนที่หา...
โค๊ด: [Select]
$user_profile[$row['ID_MEMBER']] = $row;
//Happy Birthday Color ;D Hope you love it :D
if(!empty($modSettings['MemberColorBirthday']) && !empty($row['birthdate']) && compare_colorBirthdate($row['birthdate'])) {
$user_profile[$row['ID_MEMBER']]['post_group_color'] = $modSettings['MemberColorBirthdayColor'];
$user_profile[$row['ID_MEMBER']]['member_group_color'] = $modSettings['MemberColorBirthdayColor'];
}
//Color Banned user, replace there color... hope they are not moderators ;P?
if(!empty($modSettings['MemberColorBanned']) && isset($row['is_activated']) && $row['is_activated'] >= 10) {
$user_profile[$row['ID_MEMBER']]['post_group_color'] = $modSettings['MemberColorBanned'];
$user_profile[$row['ID_MEMBER']]['member_group_color'] = $modSettings['MemberColorBanned'];
}
//Memeber Color Link Data, i store them for later use
if($set == 'normal' || $set == 'profile') //This are the only sets with the infos i need.
$color_profile[$row['ID_MEMBER']] = array(
'ID_MEMBER' => $row['ID_MEMBER'],
'realName' => $row['realName'],
'member_group_color' => $user_profile[$row['ID_MEMBER']]['member_group_color'],
'post_group_color' => $user_profile[$row['ID_MEMBER']]['post_group_color'],
);

ค้นหา...
โค๊ด: [Select]
cache_put_data('moderator_group_info', $row, 480);
วางทับแทนที่หา...
โค๊ด: [Select]
cache_put_data('moderator_group_info', $row, 480);
if(isset($modSettings['MemberColorLinkModColor']) && $modSettings['MemberColorLinkModColor'] != $row['member_group_color'])
updateSettings(array('MemberColorLinkModColor' => $row['member_group_color']));

ค้นหา...
โค๊ด: [Select]
if (!empty($row['member_group_color']))
$user_profile[$id]['member_group_color'] = $row['member_group_color'];

วางทับแทนที่หา...
โค๊ด: [Select]
if (!empty($row['member_group_color'])) {
$user_profile[$id]['member_group_color'] = $row['member_group_color'];
//Replace this, too because i will not forget it ;D (Member Color Link)
$color_profile[$id]['member_group_color'] = $row['member_group_color'];
}

ค้นหา...
โค๊ด: [Select]
$profile = $user_profile[$user];
วางทับแทนที่หา...
โค๊ด: [Select]
$profile = $user_profile[$user];

//Prepare some colored Datas :D Member Color Link give some Infos back 8)
$coloredData = load_onlineColors($user, true, true);

ค้นหา...
โค๊ด: [Select]
'username' => &$profile['memberName'],
'name' => &$profile['realName'],

วางทับแทนที่หา...
โค๊ด: [Select]
'username' => &$profile['memberName'],
'name' => &$profile['realName'],
'colored_name' => $coloredData['colored_name'],
'online_color' => $coloredData['online_color'],

ค้นหา...
โค๊ด: [Select]
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $profile['realName'] . '">' . $profile['realName'] . '</a>',
วางทับแทนที่หา...
โค๊ด: [Select]
'link' => $coloredData['colored_link'],
'colorless_link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $profile['realName'] . '">' . $profile['realName'] . '</a>',

ค้นหา...
โค๊ด: [Select]
// Load a theme, by ID.
วางทับแทนที่หา...
โค๊ด: [Select]
//This is the universial load colors function, can be used by each person who need it :)
//I think it's intressting for mod Creators =D
//SMF 1.1.x Version

function load_onlineColors($users, $returnarray = true, $singleuser = false) {
global $color_profile, $db_prefix, $modSettings;
static $color_array;

//Make something for sure :)
if(!isset($color_profile))
$color_profile = array();
//This will hold the array data for later ;)
if(!isset($color_array))
$color_array = array();
//Set a standard empty array for guest errors ;) (Deleted users, which are not resetet)
if(!isset($color_profile[0]))
$color_profile[0] = array('member_group_color' => '', 'post_group_color' => '');

// Can't just look for no users :P.
if (empty($users))
return false;

// Make sure it's an array.
$users = !is_array($users) ? array($users) : array_unique($users);

//Now i will use this as a chache, too
$loaded_ids = array();
$all_loaded_ids = array_keys($color_profile);
//All the users that allready loaded
$loaded_ids = array_intersect($all_loaded_ids, $users);
//Now i need only the new users to load
$users = array_diff($users, $all_loaded_ids);

if(!empty($users)) {
// Load the data.
$request = db_query("
SELECT
mem.ID_MEMBER AS ID_MEMBER, mem.realName AS realName, mem.is_activated AS is_activated,
mem.birthdate AS birthdate,
mg.onlineColor AS member_group_color, IFNULL(mg.groupName, '') AS member_group,
pg.onlineColor AS post_group_color, IFNULL(pg.groupName, '') AS post_group
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}membergroups AS pg ON (pg.ID_GROUP = mem.ID_POST_GROUP)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP)
WHERE mem.ID_MEMBER ".(count($users) == 1 ? " = '" . current($users) . "'" : " IN ('" . implode("', '", $users) . "')"), __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request))
{
$loaded_ids[] = $row['ID_MEMBER'];
$color_profile[$row['ID_MEMBER']] = $row;
//Happy Birthday Color ;D Hope you love it :D
if(!empty($modSettings['MemberColorBirthdayColor']) && !empty($row['birthdate']) && compare_colorBirthdate($row['birthdate'])) {
$color_profile[$row['ID_MEMBER']]['post_group_color'] = $modSettings['MemberColorBirthdayColor'];
$color_profile[$row['ID_MEMBER']]['member_group_color'] = $modSettings['MemberColorBirthdayColor'];
}
//Banned User hope it is not a mod ;)
if(!empty($modSettings['MemberColorBanned']) && isset($row['is_activated']) && $row['is_activated'] >= 10) {
$color_profile[$row['ID_MEMBER']]['post_group_color'] = $modSettings['MemberColorBanned'];
$color_profile[$row['ID_MEMBER']]['member_group_color'] = $modSettings['MemberColorBanned'];
}
}
mysql_free_result($request);
}

//Build the Array ;D
$array = array();
if(!empty($loaded_ids) && $returnarray == true) {
global $txt, $scripturl, $board_info;
foreach($loaded_ids as $id) {
$mod = false;
//Rewrite Moderator Color!
if(isset($board_info['moderators'][$id]) && (empty($color_array[$id]) || !$color_array[$id]['moderator'])) {
if(isset($color_array[$id]))
unset($color_array[$id]);
if(empty($color_profile[$id]['member_group_color']))
$color_profile[$id]['member_group_color'] = load_mod_color(true);
$mod = true;
}
//Load a prepared Data?
if(!isset($color_array[$id])) {
$profile = $color_profile[$id];
$onlineColor = !empty($profile['member_group_color']) ? $profile['member_group_color'] : $profile['post_group_color'];
$color_array[$id] = array(
'id' => $id,
'online_color' => $onlineColor,
'colored_name' => (!empty($onlineColor) ? '<span style="color:'.$onlineColor.';">' : '' ) . $profile['realName'] . (!empty($onlineColor) ? '</span>' : ''),
//Make it compatible old and new style
'colored_link' => (empty($modSettings['MemberColorLinkOldSpanStyle']) ?
'<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $profile['realName'] . '"'.(!empty($onlineColor) ? ' style="color:'.$onlineColor.';"' : '').'>' . $profile['realName'] .'</a>' :
'<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $profile['realName'] . '">' . ( !empty($profile['member_group_color']) || !empty($profile['post_group_color']) ? '<span style="color:'. ( !empty($profile['member_group_color']) ? $profile['member_group_color'] : $profile['post_group_color'] ) .';">' : '' ) . $profile['realName'] . (!empty($profile['member_group_color']) || !empty($profile['post_group_color']) ? '</span>' : '' ).'</a>'),
'moderator' => $mod,
);
}
$array[$id] = $color_array[$id];
}
}

//This option return only a single user, i hope you know what you do ;)
if($singleuser === true)
$array = current($array);

//Return that what should returned XD
return (empty($loaded_ids) ? false : ($returnarray == true ? $array : $loaded_ids));
}

//Load in a fast way the Moderator color... i think i cashe it sometimes...
//$update it's only for me that the mod is fast ;)
function load_mod_color($return = false, $update = null) {
global $context, $db_prefix, $modSettings;

//Need a update?
if($update !== null && $return === false) {
updateSettings(array('MemberColorLinkModColor' => $update));
return true;
}

//This settings is loaded in the loadMemberData
if(isset($modSettings['MemberColorLinkModColor']) && !isset($context['modGroupColor']))
$context['modGroupColor'] = $modSettings['MemberColorLinkModColor'];

if(!isset($context['modGroupColor'])) {
$context['modGroupColor'] = '';
$modColor = db_query("
SELECT onlineColor AS online_color
FROM {$db_prefix}membergroups
WHERE ID_GROUP = 3
LIMIT 1", __FILE__, __LINE__);
list($context['modGroupColor']) = mysql_fetch_row($modColor);
mysql_free_result($modColor);
}

//Need a update?
if(!isset($modSettings['MemberColorLinkModColor']))
updateSettings(array('MemberColorLinkModColor' => $context['modGroupColor']));

$return = (bool) $return;
return $return ? $context['modGroupColor'] : true;
}
//Compare Birthday, return true on todays brithday
function compare_colorBirthdate($birthday = '') {
if(empty($birthday))
return false;
$d = explode('-',trim($birthday));
if(count($d) != 3)
return false;
return date('md') == date('md', mktime(0,0,0,$d['1'],$d['2'],0)) ? true : false;
}

// Load a theme, by ID.



3.  ./Sources/MessageIndex.php
ค้นหา...
โค๊ด: [Select]
// Aren't children wonderful things?
$result = db_query("

วางบนที่หา...
โค๊ด: [Select]
//Set some standard Variables for the MemberColorLink
$MemberSetColor = false;
if (!empty($modSettings['MemberColorThreadOwner']) || !empty($modSettings['MemberColorThreadLastPost']) || !empty($modSettings['MemberColorChild']) || (!empty($modSettings['MemberColorWhoIsOnline']) && !empty($settings['display_who_viewing'])))
$context['MemberColor_ID_MEMBER'] = array();

ค้นหา...
โค๊ด: [Select]
$theboards[] = $row_board['ID_BOARD'];
วางต่อจากที่หา...
โค๊ด: [Select]
//The Last Posts of the Children MemberColor.
if (!empty($modSettings['MemberColorThreadChild']) && !empty($row_board['ID_MEMBER'])) {
$context['MemberColor_ID_MEMBER'][$row_board['ID_MEMBER']] = $row_board['ID_MEMBER'];
$MemberSetColor = true;
}

ค้นหา...
โค๊ด: [Select]
if (empty($row['showOnline']))
$context['view_num_hidden']++;
}
$context['view_num_guests'] = mysql_num_rows($request) - count($context['view_members']);
mysql_free_result($request);

วางทับแทนที่หา...
โค๊ด: [Select]
if (!empty($modSettings['MemberColorWhoIsOnline'])) {
$context['MemberColor_ID_MEMBER'][$row['ID_MEMBER']] = $row['ID_MEMBER'];
$MemberSetColor = true;
}

if (empty($row['showOnline']))
$context['view_num_hidden']++;
}
$context['view_num_guests'] = mysql_num_rows($request) - count($context['view_members']);
mysql_free_result($request);

ค้นหา...
โค๊ด: [Select]
if (!$pre_query)
$topic_ids[] = $row['ID_TOPIC'];

วางต่อจากที่หา...
โค๊ด: [Select]
//I need to collect some IDs for the MemberColor :).
if (!empty($modSettings['MemberColorThreadOwner']) && !empty($row['firstID_MEMBER'])) {
$context['MemberColor_ID_MEMBER'][$row['firstID_MEMBER']] = $row['firstID_MEMBER'];
$MemberSetColor = true;
}
//Oh i need the Last Post ID, too ;)
if (!empty($modSettings['MemberColorThreadLastPost']) && !empty($row['lastID_MEMBER'])) {
$context['MemberColor_ID_MEMBER'][$row['lastID_MEMBER']] = $row['lastID_MEMBER'];
$MemberSetColor = true;
}

ค้นหา...
โค๊ด: [Select]
determineTopicClass($context['topics'][$row['ID_TOPIC']]);
}
mysql_free_result($result);

วางต่อจากที่หา...
โค๊ด: [Select]
//Now let's replace the orginal link to the Color Link ;)
if ($MemberSetColor && !empty($context['MemberColor_ID_MEMBER'])) {
$colorDatas = load_onlineColors($context['MemberColor_ID_MEMBER']);
//You are not know what you do ;P Colors allready loaded :D
if(!empty($modSettings['MemberColorModeratorLinks']) && !empty($theboards)) {
//Okay now... do a heavy serach for moderators... only jokeing... but you know... it look so ugly ;)
$onlineColor = load_mod_color(true);
foreach($theboards as $boardid_memcolor) {
//Reset it :D
$context['boards'][$boardid_memcolor]['link_moderators'] = array();
global $color_profile;
foreach($context['boards'][$boardid_memcolor]['moderators'] as $moderators) {
$cmemcolid = $moderators['id'];
//Replace "Profil of" with "Moderator" ;D
$link = str_replace($txt[92], $txt[62], $colorDatas[$cmemcolid]['colored_link']);
if(empty($colorDatas[$cmemcolid]['online_color']) && !empty($onlineColor))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $color_profile[$cmemcolid]['ID_MEMBER'] . '" title="' . $txt[62] . ' ' . $color_profile[$cmemcolid]['realName'] . '"'.(!empty($modSettings['MemberColorLinkOldSpanStyle']) ? '><span style="color:'.$onlineColor.';">' : ' style="color:'.$onlineColor.';">') . $color_profile[$cmemcolid]['realName'] . (!empty($modSettings['MemberColorLinkOldSpanStyle']) ? '</span>' : '').'</a>';
//Standard Color ;)
$context['boards'][$boardid_memcolor]['moderators'][$cmemcolid]['link'] = $link;
//Creat the new list...
$context['boards'][$boardid_memcolor]['link_moderators'][] = $link;
}
}
}
//Need the Childs some Colors XD
if (!empty($modSettings['MemberColorThreadChild']) && !empty($theboards))
foreach($theboards as $boardid_memcolor) {
//My Childs need a Member Color ;)
$cmemcolid = $context['boards'][$boardid_memcolor]['last_post']['member']['id'];
if(!empty($colorDatas[$cmemcolid]['colored_link']))
$context['boards'][$boardid_memcolor]['last_post']['member']['link'] = $colorDatas[$cmemcolid]['colored_link'];
}
//The Owner or the Last Post of the thread
if (!empty($modSettings['MemberColorThreadOwner']) || !empty($modSettings['MemberColorThreadLastPost']))
foreach($topic_ids as $topicid_memcolor) {
//First the Thread Owner Link
if (!empty($modSettings['MemberColorThreadOwner'])) {
$cmemcolid = $context['topics'][$topicid_memcolor]['first_post']['member']['id'];
if(!empty($colorDatas[$cmemcolid]['colored_link']))
$context['topics'][$topicid_memcolor]['first_post']['member']['link'] = $colorDatas[$cmemcolid]['colored_link'];
}
//Or the Last Post Link ;)
if (!empty($modSettings['MemberColorThreadLastPost'])) {
$cmemcolid = $context['topics'][$topicid_memcolor]['last_post']['member']['id'];
if(!empty($colorDatas[$cmemcolid]['colored_link']))
$context['topics'][$topicid_memcolor]['last_post']['member']['link'] = $colorDatas[$cmemcolid]['colored_link'];
}
}
if (!empty($settings['display_who_viewing']) && !empty($modSettings['MemberColorWhoIsOnline']) && !empty($context['view_members'])) {
//I need the new not numeric keys :)
$klist = array_keys($context['view_members']);
foreach($klist as $value) {
$id = $context['view_members'][$value]['id'];
//Let's replace Who is online colors...
$context['view_members'][$value]['link'] = $colorDatas[$id]['colored_link'];
//Somehow the 'view_members_list' must be the same as before *g*, i don't like the hidden users...
if (!$context['view_members'][$value]['hidden'] || allowedTo('moderate_forum'))
$context['view_members_list'][$value] = ($context['view_members'][$value]['hidden'] ? '<i>' : '').$colorDatas[$id]['colored_link'].($context['view_members'][$value]['hidden'] ? '</i>' : '');
}
}
}

ค้นหา...
โค๊ด: [Select]
if (!empty($board_info['moderators']))
{
foreach ($board_info['moderators'] as $mod)
$context['link_moderators'][] ='<a href="' . $scripturl . '?action=profile;u=' . $mod['id'] . '" title="' . $txt[62] . '">' . $mod['name'] . '</a>';

วางทับแทนที่หา...
โค๊ด: [Select]
if (!empty($board_info['moderators']))
{
//I hate it in this way... but what should i do ;)
if(!empty($modSettings['MemberColorModeratorLinks'])) {
foreach($board_info['moderators'] as $mod)
$c[$mod['id']] = $mod['id'];
$colorDatas = load_onlineColors($c);
foreach ($board_info['moderators'] as $mod)
$context['link_moderators'][] = str_replace($txt[92], $txt[62], $colorDatas[$mod['id']]['colored_link']);
}
else
foreach ($board_info['moderators'] as $mod)
$context['link_moderators'][] ='<a href="' . $scripturl . '?action=profile;u=' . $mod['id'] . '" title="' . $txt[62] . '">' . $mod['name'] . '</a>';

ค้นหา...
โค๊ด: [Select]
if (!empty($row_board['ID_MODERATOR']))
{

วางทับแทนที่หา...
โค๊ด: [Select]
if (!empty($row_board['ID_MODERATOR']))
{
//Color the Mods, too...
if(!empty($modSettings['MemberColorModeratorLinks'])) {
$MemberSetColor = true;
$context['MemberColor_ID_MEMBER'][$row_board['ID_MODERATOR']] = $row_board['ID_MODERATOR'];
}

ค้นหา...
โค๊ด: [Select]
'link' => $row_board['posterName'] != '' ? (!empty($row_board['ID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MEMBER'] . '">' . $row_board['realName'] . '</a>' : $row_board['realName']) : $txt[470],
วางทับแทนที่หา...
โค๊ด: [Select]
'link' => $row_board['posterName'] != '' ? (!empty($row_board['ID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MEMBER'] . '">' . $row_board['realName'] . '</a>' : (!empty($modSettings['MemberColorGuests']) ? '<span style="color:'.$modSettings['MemberColorGuests'].';">' : '').$row_board['realName'].(!empty($modSettings['MemberColorGuests']) ? '</span>' : '')) : $txt[470],
ค้นหา...
โค๊ด: [Select]
'link' => $row['posterName'] != '' ? (!empty($row['ID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>' : $row['realName']) : $txt[470],
วางทับแทนที่หา...
โค๊ด: [Select]
'link' => $row['posterName'] != '' ? (!empty($row['ID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>' : (!empty($modSettings['MemberColorGuests']) ? '<span style="color:'.$modSettings['MemberColorGuests'].';">' : '').$row['realName'].(!empty($modSettings['MemberColorGuests']) ? '</span>' : '')) : $txt[470],
ค้นหา...
โค๊ด: [Select]
'link' => !empty($row['firstID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['firstID_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['firstDisplayName'] . '">' . $row['firstDisplayName'] . '</a>' : $row['firstDisplayName']
วางทับแทนที่หา...
โค๊ด: [Select]
'link' => !empty($row['firstID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['firstID_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['firstDisplayName'] . '">' . $row['firstDisplayName'] . '</a>' : (!empty($modSettings['MemberColorGuests']) ? '<span style="color:'.$modSettings['MemberColorGuests'].';">' : '').$row['firstDisplayName'].(!empty($modSettings['MemberColorGuests']) ? '</span>' : '')
ค้นหา...
โค๊ด: [Select]
'link' => !empty($row['lastID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['lastID_MEMBER'] . '">' . $row['lastDisplayName'] . '</a>' : $row['lastDisplayName']
วางทับแทนที่หา...
โค๊ด: [Select]
'link' => !empty($row['lastID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['lastID_MEMBER'] . '">' . $row['lastDisplayName'] . '</a>' : (!empty($modSettings['MemberColorGuests']) ? '<span style="color:'.$modSettings['MemberColorGuests'].';">' : '').$row['lastDisplayName'].(!empty($modSettings['MemberColorGuests']) ? '</span>' : '')



นร...

  • บุคคลทั่วไป
Re: ติดตั้ง MOD MemberColorLink 302
« ตอบกลับ #1 เมื่อ: 08, สิงหาคม 2008, 01:52:39 PM »
ต่อ...

4.  ./Sources/BoardIndex.php
ค้นหา...
โค๊ด: [Select]
if (!empty($row_board['ID_MODERATOR']))
{

วางทับแทนที่หา...
โค๊ด: [Select]
if (!empty($row_board['ID_MODERATOR']))
{
//Color the Mods, too...
if(!empty($modSettings['MemberColorModeratorLinks'])) {
$context['MemberColor_ID_MEMBER'][$row_board['ID_MODERATOR']] = $row_board['ID_MODERATOR'];
$context['MemberColor_ModBoard'][$isChild ? $row_board['ID_PARENT'] : $row_board['ID_BOARD']] = array(
'bid' => ($isChild ? $row_board['ID_PARENT'] : $row_board['ID_BOARD']),
'cat' => $row_board['ID_CAT']
);
}

ค้นหา...
โค๊ด: [Select]
'link' => $row_board['posterName'] != '' ? (!empty($row_board['ID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MEMBER'] . '">' . $row_board['realName'] . '</a>' : $row_board['realName']) : $txt[470],
วางทับแทนที่หา...
โค๊ด: [Select]
'link' => $row_board['posterName'] != '' ? (!empty($row_board['ID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MEMBER'] . '">' . $row_board['realName'] . '</a>' : (!empty($modSettings['MemberColorGuests']) ? '<span style="color:'.$modSettings['MemberColorGuests'].';">' : '').$row_board['realName'].(!empty($modSettings['MemberColorGuests']) ? '</span>' : '')) : $txt[470],
ค้นหา...
โค๊ด: [Select]
'start' => 'msg' . $row_board['new_from'],
'topic' => $row_board['ID_TOPIC']
);

วางต่อจากที่หา...
โค๊ด: [Select]
if (!empty($modSettings['MemberColorBoardindex']) && !empty($row_board['ID_MEMBER'])) {
$context['MemberColor_ID_MEMBER'][$row_board['ID_MEMBER']] = $row_board['ID_MEMBER'];
$MemberColor_board[$isChild ? $row_board['ID_PARENT'] : $row_board['ID_BOARD']] = array(
'bid' => ($isChild ? $row_board['ID_PARENT'] : $row_board['ID_BOARD']),
'cat' => $row_board['ID_CAT']);
}

ค้นหา...
โค๊ด: [Select]
// Determine a global most recent topic.
if (!empty($row_board['posterTime']) && forum_time(true, $row_board['posterTime']) > $most_recent_topic['timestamp'])
$most_recent_topic = array(
'timestamp' => forum_time(true, $row_board['posterTime']),
'ref' => &$this_category[$isChild ? $row_board['ID_PARENT'] : $row_board['ID_BOARD']]['last_post'],
);
}
mysql_free_result($result_boards);

วางต่อจากที่หา...
โค๊ด: [Select]
//The latest member?
if (!empty($modSettings['latestMember']) && !empty($modSettings['MemberColorLatestMember']))
$context['MemberColor_ID_MEMBER'][$modSettings['latestMember']] = $modSettings['latestMember'];

// Know set the colors for the last post...
if (!empty($context['MemberColor_ID_MEMBER'])) {
$colorDatas = load_onlineColors($context['MemberColor_ID_MEMBER']);
$cmemcolid = null;

//So the BoardIndex need colored links
if (!empty($modSettings['MemberColorBoardindex']) && !empty($MemberColor_board))
foreach($MemberColor_board as $boardid_memcolor) {
$cmemcolid = $context['categories'][$boardid_memcolor['cat']]['boards'][$boardid_memcolor['bid']]['last_post']['member']['id'];
if(!empty($colorDatas[$cmemcolid]['colored_link']))
$context['categories'][$boardid_memcolor['cat']]['boards'][$boardid_memcolor['bid']]['last_post']['member']['link'] = $colorDatas[$cmemcolid]['colored_link'];
}

//You are not know what you do ;P Colors allready loaded :D
if(!empty($modSettings['MemberColorModeratorLinks']) && !empty($context['MemberColor_ModBoard'])) {
//This site will evertime use the correct Moderator Color, for this i need a extra query,
//because at the moment i don't know the correct color
$onlineColor = load_mod_color(true);
foreach($context['MemberColor_ModBoard'] as $boardid_memcolor) {
global $color_profile;
//Reset it :D
$context['categories'][$boardid_memcolor['cat']]['boards'][$boardid_memcolor['bid']]['link_moderators'] = array();
foreach($context['categories'][$boardid_memcolor['cat']]['boards'][$boardid_memcolor['bid']]['moderators'] as $moderators) {
$cmemcolid = $moderators['id'];
//Replace "Profil of" with "Moderator" ;D
$link = str_replace($txt[92], $txt[62], $colorDatas[$cmemcolid]['colored_link']);
if(empty($colorDatas[$cmemcolid]['online_color']) && !empty($onlineColor))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $color_profile[$cmemcolid]['ID_MEMBER'] . '" title="' . $txt[62] . ' ' . $color_profile[$cmemcolid]['realName'] . '"'.(!empty($modSettings['MemberColorLinkOldSpanStyle']) ? '><span style="color:'.$onlineColor.';">' : ' style="color:'.$onlineColor.';">') . $color_profile[$cmemcolid]['realName'] . (!empty($modSettings['MemberColorLinkOldSpanStyle']) ? '</span>' : '').'</a>';
$context['categories'][$boardid_memcolor['cat']]['boards'][$boardid_memcolor['bid']]['moderators'][$cmemcolid]['link'] = $link;
//Create the new list...
$context['categories'][$boardid_memcolor['cat']]['boards'][$boardid_memcolor['bid']]['link_moderators'][] = $link;
}
}
}
}

ค้นหา...
โค๊ด: [Select]
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline,
วางทับแทนที่หา...
โค๊ด: [Select]
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline,
mem.birthdate as birthdate, mem.is_activated as is_activated,

ค้นหา...
โค๊ด: [Select]
$context['num_users_hidden']++;
continue;
}

วางทับแทนที่หา...
โค๊ด: [Select]
$context['num_users_hidden']++;
continue;
}
//Happy Birthday Color ;D Hope you love it :D
if(!empty($modSettings['MemberColorBirthdayColor']) && !empty($row['birthdate']) && compare_colorBirthdate($row['birthdate']))
$row['onlineColor'] = $modSettings['MemberColorBirthdayColor'];
//Color Banned user, replace there color...?
if(!empty($modSettings['MemberColorBanned']) && isset($row['is_activated']) && $row['is_activated'] >= 10)
$row['onlineColor'] = $modSettings['MemberColorBanned'];



5.  ./Sources/Calendar.php
ค้นหา...
โค๊ด: [Select]
$bday = array();
วางต่อจากที่หา...
โค๊ด: [Select]
//Set some standard Variables for the MemberColorLink
$MemberSetColor = false;
if (!empty($modSettings['MemberColorBirthday'])) {
$context['MemberColor_ID_MEMBER'] = array();
}

ค้นหา...
โค๊ด: [Select]
$bday[$age_year . substr($row['birthdate'], 4)][] = array(
'id' => $row['ID_MEMBER'],
'name' => $row['realName'],
'age' => $row['birthYear'] > 4 && $row['birthYear'] <= $age_year ? $age_year - $row['birthYear'] : null,
'is_last' => false
);
}
mysql_free_result($result);

วางทับแทนที่หา...
โค๊ด: [Select]
$bday[$age_year . substr($row['birthdate'], 4)][] = array(
'id' => $row['ID_MEMBER'],
'name' => $row['realName'],
'age' => $row['birthYear'] > 4 && $row['birthYear'] <= $age_year ? $age_year - $row['birthYear'] : null,
'is_last' => false
);

//I need to collect some IDs for the MemberColor :).
if (!empty($modSettings['MemberColorBirthday']) && !empty($row['ID_MEMBER'])) {
$context['MemberColor_ID_MEMBER'][$row['ID_MEMBER']] = $row['ID_MEMBER'];
$MemberSetColor = true;
}
}
mysql_free_result($result);

if ($MemberSetColor && !empty($context['MemberColor_ID_MEMBER'])) {
$colorDatas = load_onlineColors($context['MemberColor_ID_MEMBER']);
$cmemcolid = null;

//So i need only the colors... Sorry this must changed in the theme, too
if (!empty($modSettings['MemberColorBirthday']))
if (is_array($bday))
foreach ($bday as $memcalkv => $memcalva)
foreach ($memcalva as $memcalidkv => $memcalid) {
//Old Version Compatible...
$bday[$memcalkv][$memcalidkv]['color'] = $colorDatas[$memcalid['id']]['online_color'];
//New Style
$bday[$memcalkv][$memcalidkv]['colored_link'] = $colorDatas[$memcalid['id']]['colored_link'];
}
}



6.  ./Sources/Display.php
ค้นหา...
โค๊ด: [Select]
if (!empty($board_info['moderators']))
{
// Add a link for each moderator...
foreach ($board_info['moderators'] as $mod)
$context['link_moderators'][] = '<a href="' . $scripturl . '?action=profile;u=' . $mod['id'] . '" title="' . $txt[62] . '">' . $mod['name'] . '</a>';

วางทับแทนที่หา...
โค๊ด: [Select]
if (!empty($board_info['moderators']))
{
//I hate it in this way... but what should i do ;)
if(!empty($modSettings['MemberColorModeratorLinks'])) {
foreach($board_info['moderators'] as $mod)
$c[$mod['id']] = $mod['id'];
$colorDatas = load_onlineColors($c);
foreach ($board_info['moderators'] as $mod)
$context['link_moderators'][] = str_replace($txt[92], $txt[62], $colorDatas[$mod['id']]['colored_link']);
}
else
foreach ($board_info['moderators'] as $mod)
$context['link_moderators'][] ='<a href="' . $scripturl . '?action=profile;u=' . $mod['id'] . '" title="' . $txt[62] . '">' . $mod['name'] . '</a>';

ค้นหา...
โค๊ด: [Select]
$memberContext[$message['ID_MEMBER']]['group'] = $txt[28];
$memberContext[$message['ID_MEMBER']]['link'] = $message['posterName'];

วางทับแทนที่หา...
โค๊ด: [Select]
$memberContext[$message['ID_MEMBER']]['group'] = $txt[28];
$memberContext[$message['ID_MEMBER']]['link'] = (!empty($modSettings['MemberColorGuests']) ? '<span style="color:'.$modSettings['MemberColorGuests'].';">' : '').$message['posterName'].(!empty($modSettings['MemberColorGuests']) ? '</span>' : '');

ค้นหา...
โค๊ด: [Select]
if (empty($row['showOnline']))
$context['view_num_hidden']++;
}

// The number of guests is equal to the rows minus the ones we actually used ;).
$context['view_num_guests'] = mysql_num_rows($request) - count($context['view_members']);
mysql_free_result($request);

วางทับแทนที่หา...
โค๊ด: [Select]
if (!empty($modSettings['MemberColorWhoIsOnline'])) {
$context['MemberColor_ID_MEMBER'][$row['ID_MEMBER']] = $row['ID_MEMBER'];
}

if (empty($row['showOnline']))
$context['view_num_hidden']++;
}

// The number of guests is equal to the rows minus the ones we actually used ;).
$context['view_num_guests'] = mysql_num_rows($request) - count($context['view_members']);
mysql_free_result($request);

ค้นหา...
โค๊ด: [Select]
// Sort the list.
krsort($context['view_members']);
krsort($context['view_members_list']);
}

วางต่อจากที่หา...
โค๊ด: [Select]
// Somehow i can do the colors for this in two steps... because the split between first part and the messages...
if (!empty($context['MemberColor_ID_MEMBER'])) {
$colorDatas = load_onlineColors($context['MemberColor_ID_MEMBER']);
//Color for the who is online ;)
if (!empty($settings['display_who_viewing']) && !empty($modSettings['MemberColorWhoIsOnline']) && !empty($context['view_members'])) {
//I need the new not numeric keys :)
$klist = array_keys($context['view_members']);
foreach($klist as $value) {
$id = $context['view_members'][$value]['id'];
//Let's replace Who is online colors...
$context['view_members'][$value]['link'] = $colorDatas[$id]['colored_link'];
//Somehow the 'view_members_list' must be the same as before *g*, i don't like the hidden users...
if (!$context['view_members'][$value]['hidden'] || allowedTo('moderate_forum'))
$context['view_members_list'][$value] = ($context['view_members'][$value]['hidden'] ? '<i>' : '').$colorDatas[$id]['colored_link'].($context['view_members'][$value]['hidden'] ? '</i>' : '');
}
}
}



7.  ./Sources/Recent.php
ค้นหา...
โค๊ด: [Select]
$posts = array();
วางต่อจากที่หา...
โค๊ด: [Select]
if (!empty($modSettings['MemberColorRecentLastPost']))
$context['MemberColor_ID_MEMBER'] = array();

ค้นหา...
โค๊ด: [Select]
);
}
mysql_free_result($request);

return $posts;
}

วางทับแทนที่หา...
โค๊ด: [Select]
);
//The Last Posters id for the MemberColor.
if (!empty($modSettings['MemberColorRecentLastPost']) && !empty($row['ID_MEMBER']))
$context['MemberColor_ID_MEMBER'][$row['ID_MEMBER']] = $row['ID_MEMBER'];
}
mysql_free_result($request);

// Know set the colors for the Recent posts...
if (!empty($context['MemberColor_ID_MEMBER'])) {
$colorDatas = load_onlineColors($context['MemberColor_ID_MEMBER']);
if (!empty($modSettings['MemberColorRecentLastPost']) && is_array($posts))
foreach($posts as $postkey => $postid_memcolor)
if(!empty($colorDatas[$postid_memcolor['poster']['id']]['colored_link']))
$posts[$postkey]['poster']['link'] = $colorDatas[$postid_memcolor['poster']['id']]['colored_link'];
}

return $posts;
}

ค้นหา...
โค๊ด: [Select]
$counter = $_REQUEST['start'] + 1;
$context['posts'] = array();

วางต่อจากที่หา...
โค๊ด: [Select]
if (!empty($modSettings['MemberColorRecentOwner']) || !empty($modSettings['MemberColorRecentLastPost']))
$context['MemberColor_ID_MEMBER'] = array();

ค้นหา...
โค๊ด: [Select]
if ($ID_MEMBER == $row['ID_FIRST_MEMBER'])
$board_ids['own'][$row['ID_BOARD']][] = $row['ID_MSG'];
$board_ids['any'][$row['ID_BOARD']][] = $row['ID_MSG'];
}
mysql_free_result($request);

วางทับแทนที่หา...
โค๊ด: [Select]
if ($ID_MEMBER == $row['ID_FIRST_MEMBER'])
$board_ids['own'][$row['ID_BOARD']][] = $row['ID_MSG'];
$board_ids['any'][$row['ID_BOARD']][] = $row['ID_MSG'];

//The Thread Owners id for the MemberColor.
if (!empty($modSettings['MemberColorRecentOwner']) && !empty($row['ID_FIRST_MEMBER']))
$context['MemberColor_ID_MEMBER'][$row['ID_FIRST_MEMBER']] = $row['ID_FIRST_MEMBER'];
//The Last Posters id for the MemberColor.
if (!empty($modSettings['MemberColorRecentLastPost']) && !empty($row['ID_MEMBER']))
$context['MemberColor_ID_MEMBER'][$row['ID_MEMBER']] = $row['ID_MEMBER'];
}
mysql_free_result($request);

// Know set the colors for the Recent posts...
if (!empty($context['MemberColor_ID_MEMBER']) && is_array($context['posts'])) {
$colorDatas = load_onlineColors($context['MemberColor_ID_MEMBER']);
foreach($context['posts'] as $postkey => $postid_memcolor) {
if (!empty($modSettings['MemberColorRecentLastPost']) && !empty($colorDatas[$postid_memcolor['poster']['id']]['colored_link']))
$context['posts'][$postkey]['poster']['link'] = $colorDatas[$postid_memcolor['poster']['id']]['colored_link'];
if (!empty($modSettings['MemberColorRecentOwner']) && !empty($colorDatas[$postid_memcolor['first_poster']['id']]['colored_link']))
$context['posts'][$postkey]['first_poster']['link'] = $colorDatas[$postid_memcolor['first_poster']['id']]['colored_link'];
}
}

ค้นหา...
โค๊ด: [Select]
$context['topics'] = array();
$topic_ids = array();

วางต่อจากที่หา...
โค๊ด: [Select]
if (!empty($modSettings['MemberColorRecentOwner']) || !empty($modSettings['MemberColorRecentLastPost']))
$context['MemberColor_ID_MEMBER'] = array();

ค้นหา...
โค๊ด: [Select]
);

determineTopicClass($context['topics'][$row['ID_TOPIC']]);
}
mysql_free_result($request);

if ($is_topics && !empty($modSettings['enableParticipation']) && !empty($topic_ids))

วางทับแทนที่หา...
โค๊ด: [Select]
);

//The Thread Owners id for the MemberColor.
if (!empty($modSettings['MemberColorRecentOwner']) && !empty($row['ID_FIRST_MEMBER']))
$context['MemberColor_ID_MEMBER'][$row['ID_FIRST_MEMBER']] = $row['ID_FIRST_MEMBER'];
//The Last Posters id for the MemberColor.
if (!empty($modSettings['MemberColorRecentLastPost']) && !empty($row['ID_LAST_MEMBER']))
$context['MemberColor_ID_MEMBER'][$row['ID_LAST_MEMBER']] = $row['ID_LAST_MEMBER'];

determineTopicClass($context['topics'][$row['ID_TOPIC']]);
}
mysql_free_result($request);

// Know set the colors for the Recent posts...
if (!empty($context['MemberColor_ID_MEMBER']) && is_array($context['topics'])) {
$colorDatas = load_onlineColors($context['MemberColor_ID_MEMBER']);
foreach($context['topics'] as $postkey => $postid_memcolor) {
if (!empty($modSettings['MemberColorRecentLastPost']) && !empty($colorDatas[ $postid_memcolor['last_post']['member']['id']]['colored_link']))
$context['topics'][$postkey]['last_post']['member']['link'] = $colorDatas[$postid_memcolor['last_post']['member']['id']]['colored_link'];
if (!empty($modSettings['MemberColorRecentOwner']) && !empty($colorDatas[ $postid_memcolor['first_post']['member']['id']]['colored_link']))
$context['topics'][$postkey]['first_post']['member']['link'] = $colorDatas[ $postid_memcolor['first_post']['member']['id']]['colored_link'];
}
}

if ($is_topics && !empty($modSettings['enableParticipation']) && !empty($topic_ids))

ค้นหา...
โค๊ด: [Select]
'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>'
),
'subject' => $row['subject'],

วางทับแทนที่หา...
โค๊ด: [Select]
'link' => empty($row['ID_MEMBER']) ? (!empty($modSettings['MemberColorGuests']) ? '<span style="color:'.$modSettings['MemberColorGuests'].';">' : '').$row['posterName'].(!empty($modSettings['MemberColorGuests']) ? '</span>' : '') : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>'
),
'subject' => $row['subject'],

ค้นหา...
โค๊ด: [Select]
'link' => empty($row['ID_FIRST_MEMBER']) ? $row['firstPosterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_FIRST_MEMBER'] . '">' . $row['firstPosterName'] . '</a>'
วางทับแทนที่หา...
โค๊ด: [Select]
'link' => empty($row['ID_FIRST_MEMBER']) ? (!empty($modSettings['MemberColorGuests']) ? '<span style="color:'.$modSettings['MemberColorGuests'].';">' : '').$row['firstPosterName'].(!empty($modSettings['MemberColorGuests']) ? '</span>' : '') : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_FIRST_MEMBER'] . '">' . $row['firstPosterName'] . '</a>'
ค้นหา...
โค๊ด: [Select]
'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>'
),
'message' => $row['body'],

วางทับแทนที่หา...
โค๊ด: [Select]
'link' => empty($row['ID_MEMBER']) ? (!empty($modSettings['MemberColorGuests']) ? '<span style="color:'.$modSettings['MemberColorGuests'].';">' : '').$row['posterName'].(!empty($modSettings['MemberColorGuests']) ? '</span>' : '') : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>'
),
'message' => $row['body'],

นร...

  • บุคคลทั่วไป
Re: ติดตั้ง MOD MemberColorLink 302
« ตอบกลับ #2 เมื่อ: 08, สิงหาคม 2008, 01:56:09 PM »
จบ...

8.  ./Sources/PersonalMessage.php
ค้นหา...
โค๊ด: [Select]
$context['allow_hide_email'] = !empty($modSettings['allow_hideEmail']);
$context['from_or_to'] = $context['folder'] != 'outbox' ? 'from' : 'to';
$context['get_pmessage'] = 'prepareMessageContext';

$labelQuery = $context['folder'] != 'outbox' ? "
AND FIND_IN_SET('$context[current_label_id]', pmr.labels)" : '';

วางต่อจากที่หา...
โค๊ด: [Select]
//Correct a Modsettings sometime there is a problem, and load variables if i need them ;).
$colormodcheck = $context['folder'] == 'outbox' ? 'MemberColorOutbox' : 'MemberColorInbox';
$MemberSetColor = false;
if (empty($modSettings[$colormodcheck]) && !empty($modSettings['MemberColorLink']))
$modSettings['MemberColorLink'] = 0;
if (!empty($modSettings[$colormodcheck])) {
$context['MemberColor_ID_MEMBER'] = array();
$context['MemberColor_IM_ID'] = array();
}

ค้นหา...
โค๊ด: [Select]
}
mysql_free_result($request);

// Load any users....
$posters = array_unique($posters);
if (!empty($posters))
loadMemberData($posters);

วางทับแทนที่หา...
โค๊ด: [Select]
if (!empty($row['ID_MEMBER_TO']) && !empty($modSettings[$colormodcheck])) {
$MemberSetColor = true;
$posters[] = $row['ID_MEMBER_TO'];
// Hmmm somehow i must know what i should replace... i hope i do it right...
$context['MemberColor_IM_ID'][$row['ID_PM']][empty($row['bcc']) ? 'to' : 'bcc'][] = $row['ID_MEMBER_TO'];
}
elseif (empty($row['ID_MEMBER_TO']) && (!empty($modSettings['MemberColorOutbox']) || !empty($modSettings['MemberColorInbox'])))
$context['MemberColor_IM_ID'][$row['ID_PM']][empty($row['bcc']) ? 'to' : 'bcc'][] = NULL;
}

// Load any users....
$posters = array_unique($posters);
if (!empty($posters))
loadMemberData($posters);

//So i must correct the link ;) i need only the membercontext for this (a little bit faster)
if ($MemberSetColor && !empty($context['MemberColor_IM_ID'])) {
//Now i can Load the Missing global :)
global $user_profile;

//So let's replace the links...
foreach($context['MemberColor_IM_ID'] as $pmid => $pmidarray) {
if (!empty($pmidarray['to']))
foreach($pmidarray['to'] as $pm_meber_key => $pm_member_id) {
if(!empty($recipients[$pmid]['to'][$pm_meber_key]) && (!empty($user_profile[$pm_member_id]['member_group_color']) || !empty($user_profile[$pm_member_id]['post_group_color']))) {
$profile = $user_profile[$pm_member_id];
$recipients[$pmid]['to'][$pm_meber_key] = '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $profile['realName'] . '"><span style="color:'.(!empty($profile['member_group_color']) ? $profile['member_group_color'] : $profile['post_group_color']).';">' . $profile['realName'] . '</span></a>';
}
}
if (!empty($pmidarray['bcc']))
foreach($pmidarray['bcc']  as $pm_meber_key => $pm_member_id) {
if(!empty($recipients[$pmid]['bcc'][$pm_meber_key]) && (!empty($user_profile[$pm_member_id]['member_group_color']) || !empty($user_profile[$pm_member_id]['post_group_color']))) {
$profile = $user_profile[$pm_member_id];
$recipients[$pmid]['bcc'][$pm_meber_key] = '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $profile['realName'] . '"><span style="color:'.(!empty($profile['member_group_color']) ? $profile['member_group_color'] : $profile['post_group_color']).';">' . $profile['realName'] . '</span></a>';
}
}
}
}



9.  ./Sources/Stats.php
ค้นหา...
โค๊ด: [Select]
$context['top_posters'][] = array(
'name' => $row_members['realName'],
'id' => $row_members['ID_MEMBER'],
'num_posts' => $row_members['posts'],
'href' => $scripturl . '?action=profile;u=' . $row_members['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['ID_MEMBER'] . '">' . $row_members['realName'] . '</a>'
);

วางต่อจากที่หา...
โค๊ด: [Select]

if (!empty($modSettings['MemberColorStats']))
$context['MemberColor_ID_MEMBER'][$row_members['ID_MEMBER']] = $row_members['ID_MEMBER'];

ค้นหา...
โค๊ด: [Select]
$context['top_boards'][] = array(
'id' => $row_board['ID_BOARD'],
'name' => $row_board['name'],
'num_posts' => $row_board['numPosts'],
'href' => $scripturl . '?board=' . $row_board['ID_BOARD'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row_board['ID_BOARD'] . '.0">' . $row_board['name'] . '</a>'
);

วางต่อจากที่หา...
โค๊ด: [Select]
if (!empty($modSettings['MemberColorStats']))
$context['MemberColor_ID_MEMBER'][$row_members['ID_MEMBER_STARTED']] = $row_members['ID_MEMBER_STARTED'];

ค้นหา...
โค๊ด: [Select]
$context['top_time_online'][] = array(
'id' => $row_members['ID_MEMBER'],
'name' => $row_members['realName'],
'time_online' => $timelogged,
'seconds_online' => $row_members['totalTimeLoggedIn'],
'href' => $scripturl . '?action=profile;u=' . $row_members['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['ID_MEMBER'] . '">' . $row_members['realName'] . '</a>'
);

วางต่อจากที่หา...
โค๊ด: [Select]
if (!empty($modSettings['MemberColorStats']))
$context['MemberColor_ID_MEMBER'][$row_members['ID_MEMBER']] = $row_members['ID_MEMBER'];

ค้นหา...
โค๊ด: [Select]
foreach ($context['top_time_online'] as $i => $member)
$context['top_time_online'][$i]['time_percent'] = round(($member['seconds_online'] * 100) / $max_time_online);

วางต่อจากที่หา...
โค๊ด: [Select]

if (!empty($modSettings['latestMember']) && !empty($modSettings['MemberColorLatestMember']))
$context['MemberColor_ID_MEMBER'][$modSettings['latestMember']] = $modSettings['latestMember'];

//Yeah baby give me some colors =) .oO(sometimes who read this ;D).
if (!empty($context['MemberColor_ID_MEMBER'])) {
$colorDatas = load_onlineColors($context['MemberColor_ID_MEMBER']);
if (!empty($modSettings['MemberColorStats'])) {
// First the Top Posters =)
foreach($context['top_posters'] as $key => $value) {
if(!empty($colorDatas[$context['top_posters'][$key]['id']]['colored_link']))
$context['top_posters'][$key]['link'] = $colorDatas[$context['top_posters'][$key]['id']]['colored_link'];
}
// First the Top Starter =)
foreach($context['top_starters'] as $key => $value) {
if(!empty($colorDatas[$context['top_starters'][$key]['id']]['colored_link']))
$context['top_starters'][$key]['link'] = $colorDatas[$context['top_starters'][$key]['id']]['colored_link'];
}
// First the Top Onliner =)
foreach($context['top_time_online'] as $key => $value) {
if(!empty($colorDatas[$context['top_time_online'][$key]['id']]['colored_link']))
$context['top_time_online'][$key]['link'] = $colorDatas[$context['top_time_online'][$key]['id']]['colored_link'];
}
}
if (!empty($modSettings['latestMember']) && !empty($modSettings['MemberColorLatestMember']))
$context['latest_member']['link'] = $colorDatas[$modSettings['latestMember']]['colored_link'];
}



10.  ./Sources/Subs.php
ค้นหา...
โค๊ด: [Select]
// This looks weird, but it's because BoardIndex.php references the variable.
$context['common_stats']['latest_member'] = array(
'id' => $modSettings['latestMember'],
'name' => $modSettings['latestRealName'],
'href' => $scripturl . '?action=profile;u=' . $modSettings['latestMember'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $modSettings['latestMember'] . '">' . $modSettings['latestRealName'] . '</a>',
);

วางต่อจากที่หา...
โค๊ด: [Select]
//Latest user need some colors... How could you put this into this file... i hate you... i hope no one read this :P
if (!empty($modSettings['latestMember']) && !empty($modSettings['MemberColorLatestMember'])) {
$data = load_onlineColors($modSettings['latestMember'], true, true); //I'm sure this is single user
$context['common_stats']['latest_member']['link'] = $data['colored_link'];
}



11.  ./Sources/Search.php
ค้นหา...
โค๊ด: [Select]
$memberContext[$message['ID_MEMBER']]['link'] = $message['posterName'];
วางทับแทนที่หา...
โค๊ด: [Select]
$memberContext[$message['ID_MEMBER']]['link'] = (!empty($modSettings['MemberColorGuests']) ? '<span style="color:'.$modSettings['MemberColorGuests'].';">' : '').$message['posterName'].(!empty($modSettings['MemberColorGuests']) ? '</span>' : '');
ค้นหา...
โค๊ด: [Select]
$output = array_merge($context['topics'][$message['ID_MSG']], array(
วางทับแทนที่หา...
โค๊ด: [Select]
//Generate the Started By Search Link... This is not fine, because i need to load each sepperate...
//Ah and add correct Guest links ;D
$first_post_link = !empty($message['first_member_id']) ? '<a href="' . $scripturl . '?action=profile;u=' . $message['first_member_id'] . '" title="' . $txt[92] . ' ' . $message['first_member_name'] . '">' . $message['first_member_name'] . '</a>' : (!empty($modSettings['MemberColorGuests']) ? '<span style="color:'.$modSettings['MemberColorGuests'].';">' : '').$message['first_member_name'].(!empty($modSettings['MemberColorGuests']) ? '</span>' : '');
$last_post_link = !empty($message['last_member_id']) ? '<a href="' . $scripturl . '?action=profile;u=' . $message['last_member_id'] . '" title="' . $txt[92] . ' ' . $message['last_member_name'] . '">' . $message['last_member_name'] . '</a>' : (!empty($modSettings['MemberColorGuests']) ? '<span style="color:'.$modSettings['MemberColorGuests'].';">' : '').$message['last_member_name'].(!empty($modSettings['MemberColorGuests']) ? '</span>' : '');
if(!empty($modSettings['MemberColorAllSearch'])) {
$load = array();
if(!empty($message['first_member_id']))
$load[] = $message['first_member_id'];
if(!empty($message['first_member_id']))
$load[] = $message['last_member_id'];
if(!empty($load)) {
$colorDatas = load_onlineColors($load);
if(!empty($colorDatas[$message['first_member_id']]['colored_link']))
$first_post_link = $colorDatas[$message['first_member_id']]['colored_link'];
if(!empty($colorDatas[$message['last_member_id']]['colored_link']))
$last_post_link = $colorDatas[$message['last_member_id']]['colored_link'];
}
}

$output = array_merge($context['topics'][$message['ID_MSG']], array(

ค้นหา...
โค๊ด: [Select]
'link' => !empty($message['first_member_id']) ? '<a href="' . $scripturl . '?action=profile;u=' . $message['first_member_id'] . '" title="' . $txt[92] . ' ' . $message['first_member_name'] . '">' . $message['first_member_name'] . '</a>' : $message['first_member_name']
วางทับแทนที่หา...
โค๊ด: [Select]
'link' => $first_post_link
ค้นหา...
โค๊ด: [Select]
'link' => !empty($message['last_member_id']) ? '<a href="' . $scripturl . '?action=profile;u=' . $message['last_member_id'] . '" title="' . $txt[92] . ' ' . $message['last_member_name'] . '">' . $message['last_member_name'] . '</a>' : $message['last_member_name']
วางทับแทนที่หา...
โค๊ด: [Select]
'link' => $last_post_link


12.  ./Themes/default/Calendar.template.php
ค้นหา...
โค๊ด: [Select]
<a href="', $scripturl, '?action=profile;u=', $member['id'], '">', $member['name'], isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] ? '' : ', ';
วางทับแทนที่หา...
โค๊ด: [Select]
<a href="', $scripturl, '?action=profile;u=', $member['id'], '"'. (!empty($member['color']) ? (empty($modSettings['MemberColorLinkOldSpanStyle']) ? ' style="color:'.$member['color'].'">' : '><span style="color:'.$member['color'].';">') : ''), $member['name'], isset($member['age']) ? ' (' . $member['age'] . ')' : '', (!empty($member['color']) && !empty($modSettings['MemberColorLinkOldSpanStyle']) ? '</span>' : ''), '</a>', $member['is_last'] ? '' : ', ';


13.  ./Themes/default/BoardIndex.template.php
ค้นหา...
โค๊ด: [Select]
<a href="', $scripturl, '?action=profile;u=', $member['id'], '">', $member['is_today'] ? '<b>' : '', $member['name'], $member['is_today'] ? '</b>' : '', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] ? '<br />' : ', ';
วางทับแทนที่หา...
โค๊ด: [Select]
', ($member['is_today'] ? '<b>' : ''), '<a href="', $scripturl, '?action=profile;u=', $member['id'], '"'. (!empty($member['color']) ? (empty($modSettings['MemberColorLinkOldSpanStyle']) ? ' style="color:'.$member['color'].'">' : '><span style="color:'.$member['color'].';">') : ''), $member['name'], isset($member['age']) ? ' (' . $member['age'] . ')' : '', (!empty($member['color']) && !empty($modSettings['MemberColorLinkOldSpanStyle']) ? '</span>' : ''), '</a>', ($member['is_today'] ? '</b>' : ''), $member['is_last'] ? '' : ', ';


14.  ./Themes/default/Profile.template.php
ค้นหา...
โค๊ด: [Select]
<td><b>', $txt[68], ': </b></td>
<td>', $context['member']['name'], '</td>

วางทับแทนที่หา...
โค๊ด: [Select]
<td><b>', $txt[68], ': </b></td>
<td>', $context['member']['colored_name'], '</td>



15.  ./Sources/ManageMembergroups.php
ค้นหา...
โค๊ด: [Select]
$context['groups'][$temp][$id]['link'] = '<a href="' . $data['href'] . '">' . $data['name'] . '</a>';

วางทับแทนที่หา...
โค๊ด: [Select]
//Fix a mistake, for Member color Link it is better to see this color here!
$context['groups'][$temp][$id]['link'] = '<a href="' . $data['href'] . '"'. (!empty($data['color']) ? ' style="color:'.$data['color'].'"' : '').'>' . $data['name'] . '</a>';



16.  ./Themes/default/languages/Modifications.english.php
ค้นหา...
โค๊ด: [Select]
?>
วางบนที่หา...
โค๊ด: [Select]
//Member Color Link
$txt['MemberColorLinkHeadline'] = 'Member Color Link';
$txt['MemberColorLink'] = 'The display of the threadindex';
$txt['MemberColorLinkOldSpanStyle'] = 'Use a span html tag for the color (Old Style of the Mod)';
$txt['MemberColorThreadOwner'] = 'The thread owner at the boardindex';
$txt['MemberColorThreadLastPost'] = 'The last post member at the messageindex';
$txt['MemberColorThreadChild'] = 'The last post member at the childboard';
$txt['MemberColorModeratorLinks'] = 'Color the Moderator Links';
$txt['MemberColorBoardindex'] = 'The last post member at the boardindex';
$txt['MemberColorBirthday'] = 'The Birthday Links of the Members (Calendar and Boardindex)';
$txt['MemberColorRecentOwner'] = 'Recent posts, threadowner';
$txt['MemberColorRecentLastPost'] = 'Recent posts, the last poster';
$txt['MemberColorInbox'] = 'Change colors in the Instant Messages Inbox';
$txt['MemberColorOutbox'] = 'Change colors in the Instant Messages Outbox';
$txt['MemberColorLatestMember'] = 'Color the Latest Member';
$txt['MemberColorStats'] = 'Change color in the Boardstats.';
$txt['MemberColorWhoIsOnline'] = 'Color the Who is Online (Messagesindex and Threadindex)';
$txt['MemberColorGuests'] = 'Color for Guest nicknames<br /><span class="smalltext">Boradindex, Messageindex and Theaddisplay</span>';
$txt['MemberColorBanned'] = 'Color for Banned nicknames';
$txt['MemberColorBirthdayColor'] = 'Color for Brithday nicknames';
$txt['MemberColorModCenter'] = 'Color links for the Moderation Center';
$txt['MemberColorIssuePList'] = 'Color links of the profile issued warning list';
$txt['MemberColorAllSearch'] = 'Extend Color in Search to all Field (Heavy load needed)';



17.  ./Themes/default/languages/Modifications.thai.php
ค้นหา...
โค๊ด: [Select]
?>
วางบนที่หา...
โค๊ด: [Select]
//Member Color Link
$txt['MemberColorLinkHeadline'] = 'Member Color Link';
$txt['MemberColorLink'] = 'The display of the threadindex';
$txt['MemberColorLinkOldSpanStyle'] = 'Use a span html tag for the color (Old Style of the Mod)';
$txt['MemberColorThreadOwner'] = 'The thread owner at the boardindex';
$txt['MemberColorThreadLastPost'] = 'The last post member at the messageindex';
$txt['MemberColorThreadChild'] = 'The last post member at the childboard';
$txt['MemberColorModeratorLinks'] = 'Color the Moderator Links';
$txt['MemberColorBoardindex'] = 'The last post member at the boardindex';
$txt['MemberColorBirthday'] = 'The Birthday Links of the Members (Calendar and Boardindex)';
$txt['MemberColorRecentOwner'] = 'Recent posts, threadowner';
$txt['MemberColorRecentLastPost'] = 'Recent posts, the last poster';
$txt['MemberColorInbox'] = 'Change colors in the Instant Messages Inbox';
$txt['MemberColorOutbox'] = 'Change colors in the Instant Messages Outbox';
$txt['MemberColorLatestMember'] = 'Color the Latest Member';
$txt['MemberColorStats'] = 'Change color in the Boardstats.';
$txt['MemberColorWhoIsOnline'] = 'Color the Who is Online (Messagesindex and Threadindex)';
$txt['MemberColorGuests'] = 'Color for Guest nicknames<br /><span class="smalltext">Boradindex, Messageindex and Theaddisplay</span>';
$txt['MemberColorBanned'] = 'Color for Banned nicknames';
$txt['MemberColorBirthdayColor'] = 'Color for Brithday nicknames';
$txt['MemberColorModCenter'] = 'Color links for the Moderation Center';
$txt['MemberColorIssuePList'] = 'Color links of the profile issued warning list';
$txt['MemberColorAllSearch'] = 'Extend Color in Search to all Field (Heavy load needed)';

*** หลังจากแก้ไขไฟล์ อัพขึ้นโฮสต์แล้ว
**อย่าลืม 1. ไปตั้งค่าที่ ผู้ดูแล => ปรับแต่งบอร์ด... => ส่วนปรับแต่งค่าการใช้งาน => Member Color Link =>ติ๊กเครื่องหมายถูกทุกช่อง
แล้วคลิกบันทึก

**อย่างลืม 2. ไปตั้งค่าสีของสมาชิกที่ ผู้ดูแล => ควบคุมสมาชิก => แก้ไขกลุ่มของสมาชิก => คลิกแก้ไขของแต่ละกลุ่ม => ใส่ค่าสีของแต่ละกลุ่มสมาชิกตรง => สีรายชื่อขณะออนไลน์:

กลับไปดูผลงานหน้าบอร์ด  :haha:

ขอให้มีความสุขครับ...  :azn:

นร...

ออฟไลน์ kon accord99

  • J
  • กระทู้: 34
  • เห็นด้วย&ขอบคุณ: 1
Re: ติดตั้ง MOD MemberColorLink 302
« ตอบกลับ #3 เมื่อ: 07, กันยายน 2012, 09:18:49 PM »
ผมทำทุกอย่างแล้วแต่เมื่อกดไปที่
ผู้ดูแล ----> ส่วนปรับแต่งค่าการใช้งาน ----> MEMBER COLOR LINK ไม่มีอะไรเกิดขึ้น (หมายถึงว่ากดแล้วไม่มีให้เข้าไปติ้กค่าเลย)

แสดงว่าส่วนไหนไม่ถูกต้องครับ

บอร์ด SMF 1.1.16

 

Sitemap 1 2 3 4 5 6 7 8 9 10 
Back to top