插件名称:使用QQ秀作为论坛头像
适用版本:2.5/2.5sp1
作 者:yfring
数据升级:有
修改文件:有(memcp.php, viewthread.php, viewpro.php)
修改模板:有(memcp_home.htm, memcp_profile.htm, viewthread.htm, viewpro.htm)
安装难度:一般
插件功能简介:会员可选择使用QQ秀作为论坛头像或默认论坛头像设置
选项控制在"控制面板"-->"编辑个人资料"中.(注:论坛用户如没有在基本资料中填写QQ号码,这个选项将不被显示.)
演示地址: http://bbs.yf163.net/viewthread.php?tid=7405
STEP1:
升级数据库结构,在cdb_members表中添加qqshow字段.升级语句如下:
- ALTER TABLE `cdb_members` ADD `qqshow` tinyint(1) DEFAULT '0' NOT NULL AFTER `avatarheight` ;
复制代码
SETP2:
修改程序文件.
打开memcp.php,查找:
- $query = $db->query("SELECT avatar, avatarwidth, avatarheight FROM $table_members WHERE uid='$discuz_uid'");
复制代码
将其替换为:
- $query = $db->query("SELECT oicq, avatar, avatarwidth, avatarheight, qqshow FROM $table_members WHERE uid='$discuz_uid'");
复制代码
查找:
- $avatar = $avatar[avatar] ? "<img src="$avatar[avatar]" width="$avatar[avatarwidth]" height="$avatar[avatarheight]" border="0">" : ' ';
复制代码
将其替换为:
- $avatar['avatar'] = $avatar['avatar'] ? "<img src="$avatar[avatar]" width="$avatar[avatarwidth]" height="$avatar[avatarheight]" border="0">" : ' ';
- //QQshow setting
- if($avatar['oicq'] && $avatar['qqshow'] == 1) {
- $avatar['qqshow'] = $avatar['qqshow'] ? "<img src="http://qqshow-user.tencent.com/$avatar[oicq]/10/00/" border="0">" : ' ';
- } else {
- $avatar['qqshow'] = '';
- }
- //QQshow setting
复制代码
再查找:
- if($member['gender'] == 1) {
- $checkmale = 'checked';
- } elseif($member['gender'] == 2) {
- $checkfemale = 'checked';
- } else {
- $checkunknown = 'checked';
- }
复制代码
在其之下加入:
- //QQshow setting
- if($member['qqshow'] == 1) {
- $checkqqshow = 'checked';
- } else {
- $checknoqqshow = 'checked';
- }
- //QQshow setting
复制代码
继续查找:
- $db->query("UPDATE $table_members SET secques='$secquesnew', gender='$gendernew', email='$emailnew', site='$sitenew', oicq='$oicqnew',
- location='$locationnew', bio='$bionew', signature='$signew', showemail='$showemailnew', timeoffset='$timeoffsetnew',
- icq='$icqnew', yahoo='$yahoonew', styleid='$styleidnew', bday='$bdaynew', tpp='$tppnew', ppp='$pppnew',
- newsletter='$newsletternew', invisible='$invisiblenew', timeformat='$timeformatnew', msn='$msnnew',
- dateformat='$dateformatnew' $avataradd $cstatusadd $newpasswdadd $identifyingadd WHERE uid='$discuz_uid'");
复制代码
将其替换为:
- $db->query("UPDATE $table_members SET secques='$secquesnew', gender='$gendernew', email='$emailnew', site='$sitenew', oicq='$oicqnew',
- qqshow='$qqshownew', location='$locationnew', bio='$bionew', signature='$signew', showemail='$showemailnew', timeoffset='$timeoffsetnew',
- icq='$icqnew', yahoo='$yahoonew', styleid='$styleidnew', bday='$bdaynew', tpp='$tppnew', ppp='$pppnew',
- newsletter='$newsletternew', invisible='$invisiblenew', timeformat='$timeformatnew', msn='$msnnew',
- dateformat='$dateformatnew' $avataradd $cstatusadd $newpasswdadd $identifyingadd WHERE uid='$discuz_uid'");
复制代码
打开viewthread.php,查找:
- $post_user_info_sql = 'm.uid, m.username, m.gender, m.groupid, m.adminid, m.regdate, m.lastactivity, m.postnum, m.money, m.bank, m.credit, m.userdigests, m.email, m.site, m.icq, m.oicq, m.yahoo, m.msn, m.location, m.avatar, m.avatarwidth, m.avatarheight, m.signature, m.customstatus, m.showemail, m.onlinetime';
复制代码
将其替换为:
- $post_user_info_sql = 'm.uid, m.username, m.gender, m.groupid, m.adminid, m.regdate, m.lastactivity, m.postnum, m.money, m.bank, m.credit, m.userdigests, m.email, m.site, m.icq, m.oicq, m.yahoo, m.msn, m.location, m.avatar, m.avatarwidth, m.avatarheight, m.qqshow, m.signature, m.customstatus, m.showemail, m.onlinetime';
复制代码
继续查找:
- $post['regdate'] = gmdate($dateformat, $post['regdate'] + $timeoffset * 3600);
复制代码
在其之下加入:
- //QQshow setting
- if($post['oicq'] && $post['qqshow'] == 1) {
- $post['qqshow'] = '<img src="http://qqshow-user.tencent.com/'.$post['oicq'].'/10/00/" border="0">';
- } else {
- $post['qqshow'] = '';
- }
- //QQshow setting
复制代码
打开viewpro.php,查找:
- $member['signature'] = postify($member['signature'], 1, 0, 0, 0, $member['allowsigbbcode'], $member['allowsigimgcode']);
复制代码
在其之下加入:
- //QQshow setting
- if($member['oicq'] && $member['qqshow'] == 1) {
- $member['qqshow'] = '<img src="http://qqshow-user.tencent.com/'.$member['oicq'].'/10/00/" border="0">';
- } else {
- $member['qqshow'] = '';
- }
- //QQshow setting
复制代码
STEP3:
修改模板.
打开memcp_home.htm,查找:
- <tr><td bgcolor="{ALTBG2}" valign="top">{lang avatar}:<br>$avatar</td></tr>
复制代码
将其替换为:
- <tr><td bgcolor="{ALTBG2}" valign="top">{lang avatar}:<br>
- <!--{if $avatar['qqshow']}-->$avatar['qqshow']
- <!--{else}-->$avatar['avatar']
- <!--{/if}-->
- </td></tr>
复制代码
打开memcp_profile.htm,查找:
- <!--{elseif $allowavatar == 3}-->
- <tr>
- <td bgcolor="{ALTBG1}" valign="top">{lang avatar}:</td>
- <td bgcolor="{ALTBG2}">
- <input type="text" name="avatarnew" size="25" value="$member[avatar]"> <input type="button" value="{lang memcp_avatar_list}" onclick="window.location=('memcp.php?action=viewavatars&sid=$sid')">
- <br><input type="file" name="customavatar" size="25">
- <br>{lang width}: <input type="text" name="avatarwidthnew" size="1" value="*">($member[avatarwidth]) {lang height}: <input type="text" name="avatarheightnew" size="1" value="*">($member[avatarheight])</td>
- </tr>
- <!--{/if}-->
复制代码
在其之下加入:
- <tr>
- <td bgcolor="{ALTBG1}" valign="middle">使用QQ秀作为论坛头像:</td>
- <td bgcolor="{ALTBG2}">
- <input name="qqshownew" type="radio" value="1" $checkqqshow> 是
- <input name="qqshownew" type="radio" value="0" $checknoqqshow> 否
- </td></tr>
- <!--{/if}-->
复制代码
打开viewthread.htm,查找:
- <!--{if $post['avatar']}-->
- <table width="95%" border="0" cellspacing="0" cellpadding="0" style="table-layout: fixed">
- <tr><td align="center">$post[avatar]</td></tr></table><br>
- <!--{else}-->
- <br><br>
- <!--{/if}-->
复制代码
将其替换为:
- <!--{if $post['qqshow']}-->
- <table width="95%" border="0" cellspacing="0" cellpadding="0" style="table-layout: fixed">
- <tr><td align="center">$post['qqshow']</td></tr></table><br>
- <!--{elseif $post['avatar']}-->
- <table width="95%" border="0" cellspacing="0" cellpadding="0" style="table-layout: fixed">
- <tr><td align="center">$post[avatar]</td></tr></table><br>
- <!--{else}-->
- <br><br>
- <!--{/if}-->
复制代码
打开viewpro.htm,查找:
- <tr bgcolor="{ALTBG2}"><td align="center" colspan="2"><br>$member[avatar]<br><br></td></tr>
复制代码
将其替换为:
- <tr bgcolor="{ALTBG2}"><td align="center" colspan="2"><br>
- <!--{if $member['qqshow']}-->$member['qqshow']<br><br>
- <!--{else}-->$member[avatar]<br><br>
- <!--{/if}-->
- </td></tr>
复制代码
完成
[ 本帖最后由 yfring 于 2005-8-26 12:30 编辑 ] |