聯(lián)系官方銷售客服
1835022288
028-61286886
想在前臺(tái)會(huì)員中心,顯示同用戶組發(fā)布的內(nèi)容。我參照這個(gè)解答:http://223987.com/wenda/23914.html,《table類增加列表查詢條件》
修改了/dayrui/App/Demo/Controllers/Member/Home.php文件,
<?php namespace Phpcmf\Controllers\Member; class Home extends \Phpcmf\Member\Module { // 內(nèi)容列表 public function index() { if ($this->member['groupid']) { $where = " uid in (select uid from ".\Phpcmf\Service::M()->dbprefix('member_group_index')." where gid in(".implode(",", $this->member['groupid'])."))"; if ($this->init['where_list']) { $this->init['where_list'].= ' or '.$where; // 考慮到父類也許有可能會(huì)自帶條件,防止被覆蓋默認(rèn)條件,所以追加一個(gè) AND } else { $this->init['where_list'] = $where; } } $this->_Member_List(); } public function add() { $this->_Member_Add(); } public function edit() { if ($this->member['groupid']) { $where = " uid in (select uid from ".\Phpcmf\Service::M()->dbprefix('member_group_index')." where gid in(".implode(",", $this->member['groupid'])."))"; if ($this->init['where_list']) { $this->init['where_list'].= ' or '.$where; // 考慮到父類也許有可能會(huì)自帶條件,防止被覆蓋默認(rèn)條件,所以追加一個(gè) AND } else { $this->init['where_list'] = $where; } } $this->_Member_Edit(); } public function del() { $this->_Member_Del(); } }
我用同用戶組賬號(hào)登錄,內(nèi)容列表是顯示出來了,但是點(diǎn)擊編輯的時(shí)候,提示“數(shù)據(jù)#1不存在”
說明id=1的記錄不滿足條件了
你自己可以研究一下原理,思路就是這個(gè)方向
用發(fā)布賬號(hào)登錄是能編輯的,而且我看了編輯的鏈接是一樣的。。。/index.php?s=member&app=zccx&c=home&m=edit&id=1
回復(fù)迅??蚣軇?chuàng)始人
這個(gè)edit,除了/dayrui/App/Demo/Controllers/Member/Home.php,是不是還有其他地方有關(guān)聯(lián)?比如del我也按照上面的代碼添加了,但是提示不能刪除別人的內(nèi)容,這個(gè)不是這里控自的,應(yīng)該還有其他地方在控自
回復(fù)迅??蚣軇?chuàng)始人
where_list用于列表顯示,刪除不能用這種
老大,會(huì)員中心同會(huì)員組能查看了,但是同會(huì)員組不能編輯其他人發(fā)布的內(nèi)容,這個(gè)幫忙研究一下,我沒搞定啊
回復(fù)迅睿框架創(chuàng)始人
同理啊
where_list用于列表顯示,編輯不能用這種
點(diǎn)編輯還是提示數(shù)據(jù)#2不存在,
/index.php?s=member&app=zccx&c=home&m=edit&id=2
這個(gè)id=2是同會(huì)員組另外的賬號(hào)發(fā)布的,id=1是自己發(fā)布的,沒問題
回復(fù)迅??蚣軇?chuàng)始人
這句話的意思是,編輯自己的文章,并且是同一個(gè)用戶組的文章,
記住,用戶中心直接編輯自己的文章,不能編輯其他人的
那想實(shí)現(xiàn)同會(huì)員組的都能編輯,有沒有什么辦法?
回復(fù)迅??蚣軇?chuàng)始人
用戶中心不能編輯別人的內(nèi)容
想在會(huì)員中心編輯他們的文章 這是犯程序的大忌呀。。。。
去修改核心的類 把那句判斷刪掉吧
回復(fù)@草木人