举例看我的论坛
http://www.young100.net
简单版本的只需修改模板 见这里
http://www.molyx.com/showthread.php?t=14033
步骤
A.增加字段
在后台数据库执行语句
代码:
alter table mxb_user add qq_avatar int(2);
B.修改程序
showthread.php
242行
搜索代码:
$post = $DB->query( "SELECT up.*, p.*, u.id,u.name,u.usergroupid,u.gender,u.qq,u.uc,u.popo,u.email,u.joindate,u.quintessence, u.posts, u.lastvisit, u.lastactivity,u.options,u.customtitle,u.options, u.signature, u.location, u.award_data, u.avatarlocation, u.avatartype, u.avatarsize, u.cash, u.bank, u.mkaccount, u.reputation, u.onlinetime, g.canblog, e.loanamount
替换成
代码:
$post = $DB->query( "SELECT up.*, p.*, u.id,u.name,u.usergroupid,u.gender,u.qq,u.qq_avatar,u.uc,u.popo,u.email,u.joindate,u.quintessence, u.posts, u.lastvisit, u.lastactivity,u.options,u.customtitle,u.options, u.signature, u.location, u.award_data, u.avatarlocation, u.avatartype, u.avatarsize, u.cash, u.bank, u.mkaccount, u.reputation, u.onlinetime, u.birthday, g.canblog, e.loanamount
300行
搜索代码:
$return['attachment'] = $attachment[$row['pid']];
}
换行增加
代码:
$return['qq_avatar']=$row['qq_avatar'];
usercp.php
278行
搜索代码:
else $default_check = 'checked="checked"';
后换行增加
代码:
if($bbuserinfo['qq_avatar']){
$qq_ava_checked='checked';
}else{$qq_ava_checked=NULL;}
代码:
$title = ", customtitle = '".addslashes($userinfo['customtitle'])."'";
}
693/694行
搜索代码:
$title = ", customtitle = '".addslashes($userinfo['customtitle'])."'";
}
后换行增加
代码:
if($_INPUT['qq_avatar'] && $userinfo['qq']){
$userinfo['qq_avatar']=1;
}else{$userinfo['qq_avatar']=0;}
搜索代码:
$DB->shutdown_query( "UPDATE ".TABLE_PREFIX."user SET birthday= '".$userinfo['birthday']."', gender= ".$userinfo['gender'].", website = '".addslashes($userinfo['website'])."', qq = '".$userinfo['qq']."', uc = '".$userinfo['uc']."', skype = '".$userinfo['skype']."', popo = '".$userinfo['popo']."', icq = '".$userinfo['icq']."', aim = '".addslashes($userinfo['aim'])."', yahoo = '".addslashes($userinfo['yahoo'])."', msn = '".addslashes($userinfo['msn'])."', location = '".addslashes($this->parser->censoredwords($userinfo['location']))."'$title WHERE id='".$bbuserinfo['id']."'" );
替换为
代码:
$DB->shutdown_query( "UPDATE ".TABLE_PREFIX."user SET birthday= '".$userinfo['birthday']."', gender= ".$userinfo['gender'].", website = '".addslashes($userinfo['website'])."', qq = '".$userinfo['qq']."', uc = '".$userinfo['uc']."', skype = '".$userinfo['skype']."', popo = '".$userinfo['popo']."', icq = '".$userinfo['icq']."', aim = '".addslashes($userinfo['aim'])."', yahoo = '".addslashes($userinfo['yahoo'])."', msn = '".addslashes($userinfo['msn'])."',qq_avatar=".$userinfo['qq_avatar'].", location = '".addslashes($this->parser->censoredwords($userinfo['location']))."'$title WHERE id='".$bbuserinfo['id']."'" );
C.修改模板
后台->风格管理->编辑模板->showthread->showthread_post
搜索代码:
<if="$post['poster']['avatar']">
<if="$post['poster']['avatar']['type']=='img'">
<img class='avatar' src='./../../&'#039;{$post['poster']['avatar']['src']}' width='{$post['poster']['avatar']['width']}' height='{$post['poster']['avatar']['height']}' border='0' alt='' />
<elseif='$post['poster']['avatar']['type']=='object''>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width='{$post['poster']['avatar']['width']}' height='{$post['poster']['avatar']['height']}'>
<param name='movie' value='{$bboptions['uploadurl']}/avatar/{$post['poster']['avatar']['value']}'>
<param name='play' value='true'>
<param name='loop' value='true'>
<param name='quality' value='high'>
<embed src='{$bboptions['uploadurl']}/avatar/{$post['poster']['avatar']['value']}' width='{$post['poster']['avatar']['width']}' height='{$post['poster']['avatar']['height']}' play='true' loop='true' quality='high'></embed>
</object>
<elseif='$post['poster']['avatar']['type']=='sysimg''>
<img class='avatar' src='./../../&'#039;{$post['poster']['avatar']['src']}' border='0' alt='' />
</if>
</if>
把以上替换成
代码:
<script type="text/javascript">
function avatar(a_id,h_id) {
document.getElementById(a_id).innerHTML=document.getElementById(h_id).innerHTML;
}
function qqshow(qq_num,a_id) {
var qqshow_html="<<span style='color:blue'>img src='./../../h'ttp://qqshow-user.tencent.com/"+qq_num+"/10/00/ border=0 align=absmiddle></span>"
document.getElementById(a_id).innerHTML=qqshow_html;
}
</script>
<if="$post['poster']['avatar']">
<div id='avatar_{$post['row']['pid']}'>
<if="$post['poster']['qq_avatar']">
<img src=http://qqshow-user.tencent.com/{$post['poster']['qq']}/10/00/ border=0 align=absmiddle>
<else>
<if="$post['poster']['avatar']['type']=='img'">
<img class='avatar' src='./../../&'#039;{$post['poster']['avatar']['src']}' width='{$post['poster']['avatar']['width']}' height='{$post['poster']['avatar']['height']}' border='0' alt='' />
<elseif='$post['poster']['avatar']['type']=='object''>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width='{$post['poster']['avatar']['width']}' height='{$post['poster']['avatar']['height']}'>
<param name='movie' value='{$bboptions['uploadurl']}/avatar/{$post['poster']['avatar']['value']}'>
<param name='play' value='true'>
<param name='loop' value='true'>
<param name='quality' value='high'>
<embed src='{$bboptions['uploadurl']}/avatar/{$post['poster']['avatar']['value']}' width='{$post['poster']['avatar']['width']}' height='{$post['poster']['avatar']['height']}' play='true' loop='true' quality='high'></embed>
</object>
<elseif='$post['poster']['avatar']['type']=='sysimg''>
<img class='avatar' src='./../../&'#039;{$post['poster']['avatar']['src']}' border='0' alt='' />
</if>
</if>
</div>
<div style="visibility: hidden;height:1px;overflow:hidden;" id='h_{$post['row']['pid']}'>
<if="$post['poster']['avatar']['type']=='img'">
<img class='avatar' src='./../../&'#039;{$post['poster']['avatar']['src']}' width='{$post['poster']['avatar']['width']}' height='{$post['poster']['avatar']['height']}' border='0' alt='' />
<elseif='$post['poster']['avatar']['type']=='object''>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width='{$post['poster']['avatar']['width']}' height='{$post['poster']['avatar']['height']}'>
<param name='movie' value='{$bboptions['uploadurl']}/avatar/{$post['poster']['avatar']['value']}'>
<param name='play' value='true'>
<param name='loop' value='true'>
<param name='quality' value='high'>
<embed src='{$bboptions['uploadurl']}/avatar/{$post['poster']['avatar']['value']}' width='{$post['poster']['avatar']['width']}' height='{$post['poster']['avatar']['height']}' play='true' loop='true' quality='high'></embed>
</object>
<elseif='$post['poster']['avatar']['type']=='sysimg''>
<img class='avatar' src='./../../&'#039;{$post['poster']['avatar']['src']}' border='0' alt='' />
</if>
</div>
<if="$bboptions['qqshowavatar']==1">
<if="$post['poster']['qq']">
<div><span style="cursor:hand;" onclick="javascript:avatar('avatar_{$post['row']['pid']}','h_{$post['row']['pid']}');">头像</span>|<span style="cursor:hand;" onclick="javascript:qqshow('{$post['poster']['qq']}','avatar_{$post['row']['pid']}');">QQ秀</span></div>
</if>
</if>
</if>
usercp->usercp_profile
搜索
代码:
<input type='text' size='40' maxlength='20' name='qq' value='{$bbuserinfo['qq']}' class="bginput" />
后面增加
代码:
<input type="checkbox" value="1" {$qq_ava_checked} name="qq_avatar">把QQ秀作为头像
D.增加控制开关
(如果你已经装了显示QQshow此步跳过)
[quote]在“常规设置->添加常规选项”中,添加一个用户参数:
标题:是否允许使用QQ秀?
显示顺序: (这一项自动生成)
所在设置组:用户参数
类型:是或否按钮
变量值:qqshowavatar
当前值:0 (“1”代表默认打开此功能,“0”代表默认关闭此功能)
添加这个选项到 setting 缓冲 CACHE 文件?:选择“是”[/quote]
到此结束,收工.
如果论坛开启允许用户使用QQshow做头像,并且用户填写了QQ号码,则可以显示QQ秀;
如果钩选了QQ秀作为默认头像,则会默认头像为QQ秀.
此帖由 YiYoRain 在 2007-02-28 19:36 进行编辑...