菜鸡源码,专注精品下载!
当前位置:首页 > 建站教程 > 建站知识

PHPCMS V9 允许会员编辑和删除投稿

发布时间:2024-01-05  栏目:建站知识   浏览:   分类:phpcms教程 网站会员 网站投稿

PHPCMS V9 会员投稿可编辑删除是指在 PHPCMS V9 系统中,会员可以对自己提交的稿件进行编辑和删除操作。这意味着,如果会员在提交稿件后发现其中存在错误或需要修改,他们可以直接登录系统并编辑自己的稿件。此外,如果会员不再需要某个稿件,他们也可以选择将其删除。这种功能为用户提供了更大的灵活性和便利性,使他们能够更好地管理自己的内容。总之,PHPCMS V9 会员投稿可编辑删除是一项非常实用的功能,能够满足用户对内容管理的需求。

1、修改会员中心投稿列表模板phpcmstemplatesdefaultmember/content_published.html

将操作列改为 如下:

<ahref="index.php?m=member&c=content&a=edit&catid={$info[catid]}&id={$info[id]}">编辑</a>|<ahref="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'";

完整代码如下:

/***编辑内容*/publicfunctionedit(){$_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><div>');}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);requireCACHE_MODEL_PATH.'content_form.class.php';$content_form=newcontent_form($modelid,$catid,$CATEGORYS);$forminfos_data=$content_form->get($data);$forminfos=array();foreach($forminfos_dataas$_fk=>$_fv){if($_fv['isomnipotent'])continue;if($_fv['formtype']=='omnipotent'){foreach($forminfos_dataas$_fm=>$_fm_value){if($_fm_value['isomnipotent']){$_fv['form']=str_replace('{'.$_fm.'}',$_fm_value['form'],$_fv['form']);}}}$forminfos[$_fk]=$_fv;}$formValidator=$content_form->formValidator;includetemplate('member','content_publish');}}header("Cache-control:private");}}/****会员删除投稿...*/publicfunctiondelete(){$id=intval($_GET['id']);if(!$id){returnfalse;}//判断该文章是否待审,并且属于该会员$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'andusername='$username'andstatus!=99";$where="checkid='$checkid'andusername='$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);}}


相关文章

    无相关信息
评论
建站知识
建站知识
使用技巧
调试安装
运营推广