1 (edited by trongha 2006-06-13 10:53)

Topic: mod YM Online Status

##
##
##        Mod title:  YM Online Status
##
##      Mod version:  1.0.1
##   WOrks on PunBB:  1.2.*
##     Release date:  2005-12-21
##           Author:  Dedi Marhenda (adminacs@upi.edu)
##
##      Description:  Add yahoo! messenger online / offline status to
##                    user contact links in user info
##
##   Affected files:  viewtopic.php
##                    profile.php
##
##       Affects DB:  NO
##
##            Notes:  Please remember that there is no verification on registering
##                    yahoo id on PunBB basic script. It will accept any entered
##                    text as yahoo id. This modification doesn't change that
##                    condition.
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##
##

#
#---------[ 1. OPEN ]------------------------------------------------------------
#

viewtopic.php

#
#---------[ 2. 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());


#
#---------[ 3. REPLACE WITH ]----------------------------------------------------
#

$result = $db->query('SELECT u.email, u.title, u.url, u.yahoo, 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());

#
#---------[ 4. FIND (line: 237) ]------------------------------------------------
#

            // Now let's deal with the contact links (E-mail and URL)

#
#---------[ 5. AFTER ADD ]-------------------------------------------------------
#

            if ($cur_post['yahoo'] != '' && !$pun_user['is_guest'])
                $user_contacts[] = '<a href="ymsgr:sendim?'.$cur_post['yahoo'].'"><img src="http://opi.yahoo.com/online?u='.$cur_post['yahoo'].'&m=g&t=3" border=0 alt="YM" title="Send '.$cur_post['username'].' instant message!"></a>';

#
#---------[ 6. OPEN ]------------------------------------------------------------
#

profile.php

#
#---------[ 7. FIND (line: 1004) ]-----------------------------------------------
#

                            <dd><?php echo ($user['yahoo'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['yahoo']) : $user['yahoo']) : $lang_profile['Unknown']; ?></dd>

#
#---------[ 8. REPLACE WITH ]----------------------------------------------------
#

                            <dd><?php echo ($user['yahoo'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['yahoo']) : $user['yahoo']) : $lang_profile['Unknown'];
                            if (($user['yahoo'] !='') && (!$pun_user['is_guest'])) echo ' <a href="ymsgr:sendim?'.$user['yahoo'].'"><img src="http://opi.yahoo.com/online?u='.$user['yahoo'].'&m=g&t=3" border=0 alt="YM" title="Send '.pun_htmlspecialchars($user['username']).' instant message!"></a>'; ?></dd>

#
#---------[ 9. SAVE/UPLOAD ]-----------------------------------------------------
#

see images

http://chungminhlabannhe.com/uploads/online2.JPG

i edit it.

http://chungminhlabannhe.com/uploads/online.JPG

you find code in the viewtopic.php

find

$user_contacts[] = '<a href="ymsgr:sendim?'.$cur_post['yahoo'].'"><img src="http://opi.yahoo.com/online?u='.$cur_post['yahoo'].'&m=g&t=3" border=0 alt="YM" title="Send '.$cur_post['username'].' instant message!"></a>';

replace with

$user_contacts[] = '<a href="ymsgr:sendim?'.$cur_post['yahoo'].'"><img src="http://opi.yahoo.com/online?u='.$cur_post['yahoo'].'&m=g&t=2" border=0 alt="YM" title="Send '.$cur_post['username'].' instant message!"></a></p>';

:d

I'm from Viet Nam. i speak english vey bad! Sorry.