日志推送到群组方法For UCH2.0

实现用户将自己的日志推送到已加入的某个群组,和群组关联。具体修改法如下:

1.1 打开function_blog.php文件:
查找:

	//空间更新
	if($isself) {


上面加:

	$tagid = $_POST['tagid'];
	if($tagid){
			//投稿到圈子
			$tsetarr = array(
					'tagid' => $tagid,
					'uid' => $_SGLOBAL['supe_uid'],
					'username' => $_SGLOBAL['supe_username'],
					'dateline' => $_SGLOBAL['timestamp'],
					'subject' => $POST['subject'],
					'lastpost' => $_SGLOBAL['timestamp'],
					'lastauthor' => $_SGLOBAL['supe_username'],
					'lastauthorid' => $_SGLOBAL['supe_uid'],
					'topicid' => 0
			);
			$tid = inserttable('thread', $tsetarr, 1);

			$psetarr = array(
					'tagid' => $tagid,
					'tid' => $tid,
					'uid' => $_SGLOBAL['supe_uid'],
					'username' => $_SGLOBAL['supe_username'],
					'ip' => getonlineip(),
					'dateline' => $_SGLOBAL['timestamp'],
					'message' => $message,
					'isthread' => 1
			);
			//添加
			inserttable('post', $psetarr);
			
			//更新圈子统计
			$_SGLOBAL['db']->query("UPDATE ".tname("mtag")." SET threadnum=threadnum+1 WHERE tagid='$tagid'");
	}

1.2 打开cp_blog.php文件:
查找:

include_once template("cp_blog");

上面加:

//关联群组
$mtags = array();
if(!$blogid || $blog['uid'] == $_SGLOBAL['supe_uid']) {
        $query = $_SGLOBAL['db']->query("SELECT mtag.* FROM ".tname("tagspace")." st LEFT JOIN ".tname("mtag")." mtag ON st.tagid=mtag.tagid WHERE st.uid='$_SGLOBAL[supe_uid]' ");
        while($value=$_SGLOBAL['db']->fetch_array($query)) {
                $mtags[] = $value;
        }
}

2.如果使用的不是默认模板,则:

找到cp_blog.htm模板,在

			
			
			
				请回答验证问题
				
					

请填写验证码

请输入上面的4位字母或数字,看不清可更换一张

后面添加:

            
            
                    投稿到圈子
                    
                            
                    
            
            

最后,创建群组或加入其它群组,发布日志时即可选择同时将日志推送到目标群组。

转载请注明出处:https://www.onexin.net/log-pushed-to-group-method-for-uch2/

相关文章:

1、UCH远程图片本地化添加水印
https://www.onexin.net/localization-of-uch-remote-image-watermark/

2、UCH日志增加系统分类技巧
https://www.onexin.net/increase-in-uch-log-taxonomy-coup/

3、给你的UCH插件文章加上TAG(通用方法)
https://www.onexin.net/uch-plug-ins-to-your-article-with-tag-general-method/

4、UCH会员动态Google Maps API幻灯切换效果
https://www.onexin.net/uch-member-dynamic-google-maps-api-slide-transition-effects/

5、UCH群组栏目新增无限级子分类功能
https://www.onexin.net/part-of-uch-group-new-infinite-level-sub-classification-of-functions/

Leave a Reply