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 的会员编辑删除函数。
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'";
完整代码如下:
/** * 编辑内容 */ 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 在附件添加处调用 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); } }
版权声明: 本站资源均来自互联网或会员发布,如果侵犯了您的权益请与我们联系,我们将在24小时内删除!谢谢!
转载请注明: PHPCMS V9 会员投稿可编辑删除