第一步:
按系统自带这的地区名,建立相应群组名。
如演示站点的群组www.55yuan.com
第二步:
修改文件/source/cp_profile.php
加入代码- //自动加入出生地区省市群组
- if($_SGLOBAL['supe_uid'] AND $setarr['birthprovince']){
- $sql = "SELECT * FROM ".tname('mtag')." WHERE tagname = '".$setarr['birthprovince']."'"; //群组
- $query = $_SGLOBAL['db']->query($sql);
- $rs=($_SGLOBAL['db']->fetch_array($query));
- if($rs) { //如果有该群组
- $tagid = $rs['tagid']; //先查找当前用户是否已经加入了该群组
- $sql = "SELECT * FROM `" .tname('tagspace'). "` WHERE tagid=$tagid AND uid=".$_SGLOBAL[supe_uid];
- $query = $_SGLOBAL['db']->query($sql);
- $found_user_tagspace=($_SGLOBAL['db']->fetch_array($query));
- if(!$found_user_tagspace) { //如果没有加入,
- $setarr_tag=array('membernum'=>$rs['membernum']+1);//更新群组人数
- updatetable('mtag',$setarr_tag,array('tagid'=>$tagid));
- unset($setarr_tag);
- $setarr_tag = array( 'tagid' => $tagid, 'uid' => $_SGLOBAL[supe_uid], 'username' => $_SGLOBAL[supe_username], 'grade' => 0 );
- $tagspaceid=inserttable('tagspace',$setarr_tag,1); //加入群组
- }
- }
- }
-
- //自动加入所在地区省市群组
- if($_SGLOBAL['supe_uid'] AND $setarr['resideprovince']){
- $sql = "SELECT * FROM ".tname('mtag')." WHERE tagname = '".$setarr['resideprovince']."'"; //群组
- $query = $_SGLOBAL['db']->query($sql);
- $rs=($_SGLOBAL['db']->fetch_array($query));
- if($rs) { //如果有该群组
- $tagid = $rs['tagid']; //先查找当前用户是否已经加入了该群组
- $sql = "SELECT * FROM `" .tname('tagspace'). "` WHERE tagid=$tagid AND uid=".$_SGLOBAL[supe_uid];
- $query = $_SGLOBAL['db']->query($sql);
- $found_user_tagspace=($_SGLOBAL['db']->fetch_array($query));
- if(!$found_user_tagspace) { //如果没有加入,
- $setarr_tag=array('membernum'=>$rs['membernum']+1);//更新群组人数
- updatetable('mtag',$setarr_tag,array('tagid'=>$tagid));
- unset($setarr_tag);
- $setarr_tag = array( 'tagid' => $tagid, 'uid' => $_SGLOBAL[supe_uid], 'username' => $_SGLOBAL[supe_username], 'grade' => 0 );
- $tagspaceid=inserttable('tagspace',$setarr_tag,1); //加入群组
- }
- }
- }
复制代码 |