Aikimaniac wrote:Hmmm....its something like this for the newest version ?
No, but here's a little mod I just wrote that lets users hide their online status from the privacy page in their profile:
Run the following query in phpmyadmin, or the db managment plugin:
ALTER TABLE `users` ADD `hide_online` TINYINT( 1 ) DEFAULT '0' AFTER `activate_key` ;
Open ./index.php
Find, line 182:
$result = $db->query('SELECT user_id, ident FROM '.$db->prefix.'online WHERE idle=0 ORDER BY ident', true) or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());
Replace with:
$result = $db->query('SELECT o.user_id, o.ident, u.hide_online FROM '.$db->prefix.'online AS o LEFT JOIN '.$db->prefix.'users AS u ON o.user_id=u.id WHERE idle=0 AND u.hide_online=0 ORDER BY o.ident', true) or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());
Open ./profile.php
Find, line 802:
$form = extract_elements(array('email_setting', 'save_pass', 'notify_with_post'));
Replace with:
$form = extract_elements(array('email_setting', 'save_pass', 'notify_with_post', 'hide_online'));
Find, line 808:
if (!isset($form['notify_with_post']) || $form['notify_with_post'] != '1') $form['notify_with_post'] = '0';
Add after:
if (!isset($form['hide_online']) || $form['hide_online'] != '1') $form['hide_online'] = '0';
Find, line 877:
$result = $db->query('SELECT u.username, u.email, u.title, u.realname, u.url, u.jabber, u.icq, u.msn, u.aim, u.yahoo, u.location, u.use_avatar, u.signature, u.disp_topics, u.disp_posts, u.email_setting, u.save_pass, u.notify_with_post, u.show_smilies, u.show_img, u.show_img_sig, u.show_avatars, u.show_sig, u.timezone, u.language, u.style, u.num_posts, u.last_post, u.registered, u.registration_ip, u.admin_note, g.g_id, g.g_user_title FROM '.$db->prefix.'users AS u LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
Replace with:
$result = $db->query('SELECT u.username, u.email, u.title, u.realname, u.url, u.jabber, u.icq, u.msn, u.aim, u.yahoo, u.location, u.use_avatar, u.signature, u.disp_topics, u.disp_posts, u.email_setting, u.save_pass, u.notify_with_post, u.show_smilies, u.show_img, u.show_img_sig, u.show_avatars, u.show_sig, u.timezone, u.language, u.style, u.num_posts, u.last_post, u.registered, u.registration_ip, u.admin_note, g.g_id, g.g_user_title, u.hide_online FROM '.$db->prefix.'users AS u LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
Find, line 1452:
<div class="rbox">
<label><input type="checkbox" name="form[notify_with_post]" value="1"<?php if ($user['notify_with_post'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_profile['Notify full'] ?><br /></label>
</div>
Add after:
<p>Enabling this setting will hide you from the online users information on the index page</p>
<div class="rbox">
<label><input type="checkbox" name="form[hide_online]" value="1"<?php if ($user['hide_online'] == '1') echo ' checked="checked"' ?> /><?php echo 'Hide online status?' ?><br /></label>
</div>
Open ./viewtopic.php
Find, line 186:
$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id='.$id.' ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
Replace with:
$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, u.hide_online, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id='.$id.' ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
Find, line 207:
$is_online = ($cur_post['is_online'] == $cur_post['poster_id']) ? '<strong>'.$lang_topic['Online'].'</strong>' : $lang_topic['Offline'];
Replace with:
$is_online = ($cur_post['is_online'] == $cur_post['poster_id'] && $cur_post['hide_online'] == 0) ? '<strong>'.$lang_topic['Online'].'</strong>' : $lang_topic['Offline'];
Save & upload.
Tested on punbb 1.2.7.
Enjoy!
EDIT: In case anyone wants it, here's the .patch file: [Right-click & save as...]
How to use:
patch -ul -d <your forum directory> -p1 < online_mod.patch