Possible Mod? / who is online in board index and in membergroup color

Started by rowedf, April 22, 2005, 08:59:22 AM

Previous topic - Next topic

rowedf

I've looked through all the mods and attempted to search the forums here, but found nothing like it.  Is there a mod that will show in the board index where each user is browsing, and show them as their member group color?

Thanks

Thantos


rowedf

Thanks Mike, thats half of it.  The other half is to show which boards each user is browsing in.

[Unknown]

So basically you want the full who's online list on the board index?

-[Unknown]

rowedf

Kinda unkown.

It would show the usersname in the board they are browsing.  Kinda  a cool way to see who is in which board.  So it doesnt show the entire who's online list in each board, but it breaks it up by showing just the users in each boards....kinda like a "currently browsing" list.

rowedf

any other ideas on this becoming a possible mod?

ディン1031

Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

rowedf

Exactly! :)  How'd you get that?

ディン1031

#8
The fastest way i found to made this is follow :).

(a lot of thing to do)

First Source/BoardIndex.php
Search for:

if (!empty($row_board['ID_MODERATOR']))
{
$this_category[$row_board['ID_BOARD']]['moderators'][$row_board['ID_MODERATOR']] = array(
'id' => $row_board['ID_MODERATOR'],
'name' => $row_board['modRealName'],
'href' => $scripturl . '?action=profile;u=' . $row_board['ID_MODERATOR'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MODERATOR'] . '" title="' . $txt[62] . '">' . $row_board['modRealName'] . '</a>'
);
$this_category[$row_board['ID_BOARD']]['link_moderators'][] = '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MODERATOR'] . '" title="' . $txt[62] . '">' . $row_board['modRealName'] . '</a>';
}


add after


if (!empty($settings['display_who_viewing']))
{
// Start out with no one at all viewing it.
$this_category[$row_board['ID_BOARD']]['view_members'] = array();
$this_category[$row_board['ID_BOARD']]['view_members_list'] = array();
$this_category[$row_board['ID_BOARD']]['view_num_hidden'] = 0;
$this_category[$row_board['ID_BOARD']]['view_num_guests'] = 0;
// Some Varibales i need ;).
$searchwho['idcat'][$row_board['ID_BOARD']] = $row_board['ID_CAT'];
}


than search for

// This is easier to use in many cases for the theme....
$this_category[$row_board['ID_PARENT']]['link_children'][] = &$this_category[$row_board['ID_PARENT']]['children'][$row_board['ID_BOARD']]['link'];


add after



// Some Childs for the WhoIsOnline (Want use that what i have)
if (!empty($settings['display_who_viewing']))
$searchwho['children'][$row_board['ID_BOARD']] = $row_board['ID_PARENT'];


than search for


// Determine a global most recent topic.
if ($row_board['posterTime'] > $most_recent_topic['timestamp'])
$most_recent_topic = array(
'timestamp' => $row_board['posterTime'],
'ref' => &$this_category[$isChild ? $row_board['ID_PARENT'] : $row_board['ID_BOARD']]['last_post'],
);
}
mysql_free_result($result_boards);


add after


// Build Who is Online for boardindex.
if (!empty($searchwho) && !empty($settings['display_who_viewing']))
board_whoisview($searchwho);


than search for

?>


add before


function board_whoisview($searchwho) {

global $txt, $scripturl, $db_prefix, $ID_MEMBER, $user_info, $sourcedir;
global $modSettings, $context, $settings;

$requestviewtemp = db_query("
SELECT mem.ID_MEMBER, IFNULL(mem.realName, 0) AS realName, mem.showOnline, lo.url
FROM {$db_prefix}log_online AS lo
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
WHERE lo.url LIKE '%s:5:\"board\";i:%'", __FILE__, __LINE__);


while ($row_user_view = mysql_fetch_assoc($requestviewtemp)) {
if (!empty($row_user_view['ID_MEMBER'])) {
preg_match_all('~s:5:"board";i:(.+?);~eis', $row_user_view['url'], $id_board);
$id_board = $id_board[1][0];
if (isset($searchwho['children'][$id_board]))
$id_board = $searchwho['children'][$id_board];
if (isset($searchwho['idcat'][$id_board])) {
$id_cat = $searchwho['idcat'][$id_board];
//Let's fill the Context =)
if (!empty($row_user_view['showOnline']) || allowedTo('moderate_forum'))
$context['categories'][$id_cat]['boards'][$id_board]['view_members_list'][] = empty($row_user_view['showOnline']) ? '<i><a href="' . $scripturl . '?action=profile;u=' . $row_user_view['ID_MEMBER'] . '">' . $row_user_view['realName'] . '</a></i>' : '<a href="' . $scripturl . '?action=profile;u=' . $row_user_view['ID_MEMBER'] . '">' . $row_user_view['realName'] . '</a>';
$context['categories'][$id_cat]['boards'][$id_board]['view_members'][] = array(
'id' => $row_user_view['ID_MEMBER'],
'name' => $row_user_view['realName'],
'href' => $scripturl . '?action=profile;u=' . $row_user_view['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_user_view['ID_MEMBER'] . '">' . $row_user_view['realName'] . '</a>',
'hidden' => empty($row_user_view['showOnline']),
);

if (empty($row_user_view['showOnline']))
$context['categories'][$id_cat]['boards'][$id_board]['view_num_hidden']++;
}
}
//No MEMBER this must be a Guest =)
else {
preg_match_all('~s:5:"board";i:(.+?);~eis', $row_user_view['url'], $id_board);
$id_board = $id_board[1][0];
if (isset($searchwho['children'][$id_board]))
$id_board = $searchwho['children'][$id_board];
if (isset($searchwho['idcat'][$id_board])) {
$id_cat = $searchwho['idcat'][$id_board];
$context['categories'][$id_cat]['boards'][$id_board]['view_num_guests']++;
}
}
}
//Ende While
mysql_free_result($requestviewtemp);
}


So know you need some changes in the Themes/default/BoardIndex.template.php, too :)

search for


<b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b><br />
', $board['description'];


add after


// Show users online in this board. (but we're gonna use link_moderators.)
if (!empty($settings['display_who_viewing']) && $context['user']['is_logged'])
{
echo '
<i class="smalltext"><br />User on this board: ';

// Show just numbers...?
if ($settings['display_who_viewing'] == 1)
echo count($board['view_members']), ' ', count($board['view_members']) == 1 ? $txt['who_member'] : $txt[19];
// Or show the actual people viewing the topic?
else
echo empty($board['view_members_list']) ? '0 ' . $txt[19] : implode(', ', $board['view_members_list']) . (empty($board['view_num_hidden']) ? '' : ' (+ ' . $board['view_num_hidden'] . ' ' . $txt['hidden'] . ')');

// Now show how many guests are here too.
echo $txt['who_and'], $board['view_num_guests'], ' ', $board['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], '</i>';
}


so with this it should work ;).

It's the fastest way i found to build the informations for the link with only one query.

And don't forget:
Backup the Files before changing it!
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

rowedf

Thank you very much..but the last part I cant find.  Do I go to the default folder  then BoardIndex.Template.php  ?  I Tried that but cannot find that snippet of code when I search?

ディン1031

Oh i see it's a little bit diffrent in the Themes/default/BoardIndex.template.php *g*

Search for this:


<b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b><br />
', $board['description'];


add after


// Show users online in this board. (but we're gonna use link_moderators.)
if (!empty($settings['display_who_viewing']) && $context['user']['is_logged'])
{
echo '
<i class="smalltext"><br />User on this board: ';

// Show just numbers...?
if ($settings['display_who_viewing'] == 1)
echo count($board['view_members']), ' ', count($board['view_members']) == 1 ? $txt['who_member'] : $txt[19];
// Or show the actual people viewing the topic?
else
echo empty($board['view_members_list']) ? '0 ' . $txt[19] : implode(', ', $board['view_members_list']) . (empty($board['view_num_hidden']) ? '' : ' (+ ' . $board['view_num_hidden'] . ' ' . $txt['hidden'] . ')');

// Now show how many guests are here too.
echo $txt['who_and'], $board['view_num_guests'], ' ', $board['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], '</i>';
}


I hope you find it know ;).

Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

rowedf

Excellent worked great :) Now maybe im asking too much, but do you know how to integrate their member group color into this ? :)

Also what is this word..." diesem " ?

ディン1031

Quote from: rowedf on May 03, 2005, 04:07:02 PM
Excellent worked great :) Now maybe im asking too much, but do you know how to integrate their member group color into this ? :)

Also what is this word..." diesem " ?
Oh sorry the orginal Version is german XD.

User in diesem Board: -> User on this board:
or anything like that. ;).

Uff colored thats not so easy you know...
i've made many thing with the color link for members, but for who is online i don't have a working version know so i don't know how to made this fast and clean XD.
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

rowedf

Thats cool, thanks again :)  Maybe someday someone will figure that part out :)

ディン1031

Quote from: rowedf on May 03, 2005, 04:31:43 PM
Thats cool, thanks again :)  Maybe someday someone will figure that part out :)
Somehow i've a good day, i'm currently working on the color mod so made a paste and copy and it should work ;).

So replace in the (overworked) BoardIndex.php:


function board_whoisview($searchwho) {

global $txt, $scripturl, $db_prefix, $ID_MEMBER, $user_info, $sourcedir;
global $modSettings, $context, $settings;

$requestviewtemp = db_query("
SELECT mem.ID_MEMBER, IFNULL(mem.realName, 0) AS realName, mem.showOnline, lo.url
FROM {$db_prefix}log_online AS lo
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
WHERE lo.url LIKE '%s:5:\"board\";i:%'", __FILE__, __LINE__);


while ($row_user_view = mysql_fetch_assoc($requestviewtemp)) {
if (!empty($row_user_view['ID_MEMBER'])) {
preg_match_all('~s:5:"board";i:(.+?);~eis', $row_user_view['url'], $id_board);
$id_board = $id_board[1][0];
if (isset($searchwho['children'][$id_board]))
$id_board = $searchwho['children'][$id_board];
if (isset($searchwho['idcat'][$id_board])) {
$id_cat = $searchwho['idcat'][$id_board];
//Let's fill the Context =)
if (!empty($row_user_view['showOnline']) || allowedTo('moderate_forum'))
$context['categories'][$id_cat]['boards'][$id_board]['view_members_list'][] = empty($row_user_view['showOnline']) ? '<i><a href="' . $scripturl . '?action=profile;u=' . $row_user_view['ID_MEMBER'] . '">' . $row_user_view['realName'] . '</a></i>' : '<a href="' . $scripturl . '?action=profile;u=' . $row_user_view['ID_MEMBER'] . '">' . $row_user_view['realName'] . '</a>';
$context['categories'][$id_cat]['boards'][$id_board]['view_members'][] = array(
'id' => $row_user_view['ID_MEMBER'],
'name' => $row_user_view['realName'],
'href' => $scripturl . '?action=profile;u=' . $row_user_view['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_user_view['ID_MEMBER'] . '">' . $row_user_view['realName'] . '</a>',
'hidden' => empty($row_user_view['showOnline']),
);

if (empty($row_user_view['showOnline']))
$context['categories'][$id_cat]['boards'][$id_board]['view_num_hidden']++;
}
}
//No MEMBER this must be a Guest =)
else {
preg_match_all('~s:5:"board";i:(.+?);~eis', $row_user_view['url'], $id_board);
$id_board = $id_board[1][0];
if (isset($searchwho['children'][$id_board]))
$id_board = $searchwho['children'][$id_board];
if (isset($searchwho['idcat'][$id_board])) {
$id_cat = $searchwho['idcat'][$id_board];
$context['categories'][$id_cat]['boards'][$id_board]['view_num_guests']++;
}
}
}
//Ende While
mysql_free_result($requestviewtemp);
}


with this:


function board_whoisview($searchwho) {

global $txt, $scripturl, $db_prefix, $ID_MEMBER, $user_info, $sourcedir;
global $modSettings, $context, $settings;

$requestviewtemp = db_query("
SELECT mem.ID_MEMBER, IFNULL(mem.realName, 0) AS realName, mem.showOnline, lo.url
FROM {$db_prefix}log_online AS lo
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
WHERE lo.url LIKE '%s:5:\"board\";i:%'", __FILE__, __LINE__);


while ($row_user_view = mysql_fetch_assoc($requestviewtemp)) {
if (!empty($row_user_view['ID_MEMBER'])) {
preg_match_all('~s:5:"board";i:(.+?);~eis', $row_user_view['url'], $id_board);
$id_board = $id_board[1][0];
if (isset($searchwho['children'][$id_board]))
$id_board = $searchwho['children'][$id_board];
if (isset($searchwho['idcat'][$id_board])) {
$id_cat = $searchwho['idcat'][$id_board];
//Let's fill the Context =)
if (!empty($row_user_view['showOnline']) || allowedTo('moderate_forum')) {
$context['categories'][$id_cat]['boards'][$id_board]['view_members_list'][] = empty($row_user_view['showOnline']) ? '<i><a href="' . $scripturl . '?action=profile;u=' . $row_user_view['ID_MEMBER'] . '">' . $row_user_view['realName'] . '</a></i>' : '<a href="' . $scripturl . '?action=profile;u=' . $row_user_view['ID_MEMBER'] . '">' . $row_user_view['realName'] . '</a>';
$context['categories'][$id_cat]['boards'][$id_board]['view_members'][] = array(
'id' => $row_user_view['ID_MEMBER'],
'name' => $row_user_view['realName'],
'href' => $scripturl . '?action=profile;u=' . $row_user_view['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_user_view['ID_MEMBER'] . '">' . $row_user_view['realName'] . '</a>',
'hidden' => empty($row_user_view['showOnline']),
);
// Collect Data for the Color
$col_user[] = $row_user_view['ID_MEMBER'];
$col_where[$row_user_view['ID_MEMBER']] = array(
'id_board' => $id_board,
'id_cat' => $id_cat,
);
}
if (empty($row_user_view['showOnline']))
$context['categories'][$id_cat]['boards'][$id_board]['view_num_hidden']++;
}
}
//No MEMBER this must be a Guest =)
else {
preg_match_all('~s:5:"board";i:(.+?);~eis', $row_user_view['url'], $id_board);
$id_board = $id_board[1][0];
if (isset($searchwho['children'][$id_board]))
$id_board = $searchwho['children'][$id_board];
if (isset($searchwho['idcat'][$id_board])) {
$id_cat = $searchwho['idcat'][$id_board];
$context['categories'][$id_cat]['boards'][$id_board]['view_num_guests']++;
}
}
}
//Ende While
mysql_free_result($requestviewtemp);
//Someone want the colors... okay than...
if (!empty($col_user)) {
global $user_profile;
//Load the colors...
loadMemberData($col_user);

foreach($searchwho['idcat'] as $id_board => $id_cat)
if (!empty($context['categories'][$id_cat]['boards'][$id_board]['view_members']))
foreach($context['categories'][$id_cat]['boards'][$id_board]['view_members'] as $key => $value) {
$profile = &$user_profile[$value['id']];
if(!empty($profile['member_group_color']) || !empty($profile['post_group_color'])) {
//Found a color... Let's replace fill the color...
$hidden_user = $context['categories'][$id_cat]['boards'][$id_board]['view_members'][$key]['hidden'];
$context['categories'][$id_cat]['boards'][$id_board]['view_members'][$key]['link'] = '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $profile['realName'] . '"><font color="'.(!empty($profile['member_group_color']) ? $profile['member_group_color'] : $profile['post_group_color']).'">' . $profile['realName'] . '</font></a>';
$context['categories'][$id_cat]['boards'][$id_board]['view_members_list'][$key] = ($hidden_user ? '<i>' : '').'<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $profile['realName'] . '"><font color="'.(!empty($profile['member_group_color']) ? $profile['member_group_color'] : $profile['post_group_color']).'">' . $profile['realName'] . '</font></a>'.($hidden_user ? '</i>' : '');
}
}
}
}


so with this it should work ;).

And don't forget:
Backup the Files before changing it!
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

rowedf


guilliam

@din1031, hello,.. hope you wont consider my question silly or just being too lazy,.. any chance or possibility that these hack of yours can be turned into a path file instead? assuming that the board im having is a fresh install or no other mods has been made?


OT::

hello @rowedf!
----
SMF ported on Joomla:
http://www.jcip-zugbuana.org

ディン1031

Quote from: guilliam on August 27, 2005, 08:13:22 PM
@din1031, hello,.. hope you wont consider my question silly or just being too lazy,.. any chance or possibility that these hack of yours can be turned into a path file instead? assuming that the board im having is a fresh install or no other mods has been made?


OT::

hello @rowedf!

Not complete, because some changes must be made in source files, because you can not see the WIO.
I can only put the function to build the array into a extra file, but why i can not load this data without the boardIndex.php and i don't need it anywhere else...

Hmmm or did i understand somethings wrong... (The only thing i can make is a mod, but currently i've to much projects to handle so i've not much time to do this...).

Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

Advertisement: