1、修改會員中心投稿列表模板 phpcmstemplatesdefaultmember/content_published.html
將操作列改為 如下:
<a href="index.php?m=member&c=content&a=edit&catid={$info[catid]}&id={$info[id]}">編輯</a> | <a href="index.php?m=member&c=content&a=delete&catid={$info[catid]}&id={$info[id]}">刪除
2、修改 phpcms/modules/member/content.php 的會員編輯刪除函數(shù)。
2.1、注釋 public function edit() 中的 if($r['status']==99) showmessage(L('has_been_verified'));
2.2、修改 public function delete() 的 $where = " checkid='$checkid' and username='$username' and status!=99 "; 改為 $where = " checkid='$checkid' and username='$username'";
完整代碼如下:
/** * 編輯內(nèi)容 */ public function edit() { $_username = $this->memberinfo['username']; if(isset($_POST['dosubmit'])) { $catid = $_POST['info']['catid'] = intval($_POST['info']['catid']); $siteids = getcache('category_content', 'commons'); $siteid = $siteids[$catid]; $CATEGORYS = getcache('category_content_'.$siteid, 'commons'); $category = $CATEGORYS[$catid]; if($category['type']==0) { $id = intval($_POST['id']); $catid = $_POST['info']['catid'] = intval($_POST['info']['catid']); $this->content_db = pc_base::load_model('content_model'); $modelid = $category['modelid']; $this->content_db->set_model($modelid); //判斷會員組投稿是否需要審核 $memberinfo = $this->memberinfo; $grouplist = getcache('grouplist'); $setting = string2array($category['setting']); if(!$grouplist[$memberinfo['groupid']]['allowpostverify'] || $setting['workflowid']) { $_POST['info']['status'] = 1; } $info = array(); foreach($_POST['info'] as $_k=>$_v) { if($_k == 'content') { $_POST['info'][$_k] = strip_tags($_v, '<p><a><br><img><ul><li><p>'); } elseif(in_array($_k, $fields)) { $_POST['info'][$_k] = new_html_special_chars(trim_script($_v)); } } $_POST['linkurl'] = str_replace(array('"','(',')',",",' ','%'),'',new_html_special_chars(strip_tags($_POST['linkurl']))); $this->content_db->edit_content($_POST['info'],$id); $forward = $_POST['forward']; showmessage(L('update_success'),$forward); } } else { $show_header = $show_dialog = $show_validator = ''; $temp_language = L('news','','content'); //設置cookie 在附件添加處調(diào)用 param::set_cookie('module', 'content'); $id = intval($_GET['id']); if(isset($_GET['catid']) && $_GET['catid']) { $catid = $_GET['catid'] = intval($_GET['catid']); param::set_cookie('catid', $catid); $siteids = getcache('category_content', 'commons'); $siteid = $siteids[$catid]; $CATEGORYS = getcache('category_content_'.$siteid, 'commons'); $category = $CATEGORYS[$catid]; if($category['type']==0) { $modelid = $category['modelid']; $this->model = getcache('model', 'commons'); $this->content_db = pc_base::load_model('content_model'); $this->content_db->set_model($modelid); $this->content_db->table_name = $this->content_db->db_tablepre.$this->model[$modelid]['tablename']; $r = $this->content_db->get_one(array('id'=>$id,'username'=>$_username,'sysadd'=>0)); if(!$r) showmessage(L('illegal_operation')); #if($r['status']==99) showmessage(L('has_been_verified')); $this->content_db->table_name = $this->content_db->table_name.'_data'; $r2 = $this->content_db->get_one(array('id'=>$id)); $data = array_merge($r,$r2); require CACHE_MODEL_PATH.'content_form.class.php'; $content_form = new content_form($modelid,$catid,$CATEGORYS); $forminfos_data = $content_form->get($data); $forminfos = array(); foreach($forminfos_data as $_fk=>$_fv) { if($_fv['isomnipotent']) continue; if($_fv['formtype']=='omnipotent') { foreach($forminfos_data as $_fm=>$_fm_value) { if($_fm_value['isomnipotent']) { $_fv['form'] = str_replace('{'.$_fm.'}',$_fm_value['form'],$_fv['form']); } } } $forminfos[$_fk] = $_fv; } $formValidator = $content_form->formValidator; include template('member', 'content_publish'); } } header("Cache-control: private"); } } /** * * 會員刪除投稿 ... */ public function delete(){ $id = intval($_GET['id']); if(!$id){ return false; } //判斷該文章是否待審,并且屬于該會員 $username = param::get_cookie('_username'); $userid = param::get_cookie('_userid'); $siteid = get_siteid(); $catid = intval($_GET['catid']); $siteids = getcache('category_content', 'commons'); $siteid = $siteids[$catid]; $CATEGORYS = getcache('category_content_'.$siteid, 'commons'); $category = $CATEGORYS[$catid]; if(!$category){ showmessage(L('operation_failure'), HTTP_REFERER); } $modelid = $category['modelid']; $checkid = 'c-'.$id.'-'.$modelid; #$where = " checkid='$checkid' and username='$username' and status!=99 "; $where = " checkid='$checkid' and username='$username'"; $check_pushed_db = pc_base::load_model('content_check_model'); $array = $check_pushed_db->get_one($where); if(!$array){ showmessage(L('operation_failure'), HTTP_REFERER); }else{ $content_db = pc_base::load_model('content_model'); $content_db->set_model($modelid); $table_name = $content_db->table_name; $content_db->delete_content($id,"",$catid); //刪除文章 $check_pushed_db->delete(array('checkid'=>$checkid));//刪除對應投稿表 showmessage(L('operation_success'), HTTP_REFERER); } }
版權聲明: 本站資源均來自互聯(lián)網(wǎng)或會員發(fā)布,如果侵犯了您的權益請與我們聯(lián)系,我們將在24小時內(nèi)刪除!謝謝!
轉(zhuǎn)載請注明: PHPCMS V9 會員投稿可編輯刪除