欢迎光临 - 我的站长站,本站所有资源仅供学习与参考,禁止用于商业用途或从事违法行为!

phpcms教程

PHPCMS V9 会员投稿可编辑删除

phpcms教程 我的站长站 2019-06-05 共178人阅读

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><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);
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); 
}
}


相关推荐
  • 网站会员
  • 网站投稿
  • dedecms文章审核后给会员增加积分或者金币的办法

    dedecms一般都是在会员发表完之后就把积分加上去了,因此我们需要对这套系统进行修改,具体修改方法如下:第一步是在会员发表完文章之后不加积分,方法为:找到/member/article_add.php,找到//增加积分,将下面的代码注释掉。//增加积分 //$dsql->ExecuteNoneQue...

    织梦cms教程 136 4年前
  • 帝国CMS取消会员注册时候的邮箱必填

    帝国CMS会员注册的时候,邮箱是必填项,但有时候,我们希望注册时不需要填写邮箱,但帝国CMS并没有给这样一个可以关闭的设置项。通过本教程就可以实现取消邮箱必填。以帝国CMS7.2为例:打开 /e/member/class/member_registerfun.php 文件1、查找:if(!chemail($...

    帝国cms教程 133 4年前
  • 帝国CMS会员中心如何动态提示未读消息

    登陆帝国后台------模板------动态页面模板管理------头部模板在模型下面添加下面代码部分<?//模型$tgetmid=(int)$_GET[&#39;mid&#39;];if($tmgetuserid){$member=$empire->fetch1("select userpic from phome_enewsmemberadd where userid=&#39;$t...

    帝国cms教程 129 4年前
  • PHPCMS V9 会员投稿可编辑删除

    1、修改会员中心投稿列表模板 phpcms\templates\default\member/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=co...

    phpcms教程 178 4年前
  • 织梦后台直接添加会员功能开发方法

    开发方法1、需要新增两个文件: huiyuan_add.php 和 huiyuan.htm。huiyuan_add.php放在 /dede/文件夹下,huiyuan_add.htm放在/dede/templets/文件夹下。huiyuan_add.php 代码如下:<?phprequire(dirname(__FILE__)."/config.php");$ENV_GOBACK_URL = "mem...

    织梦cms教程 200 4年前
  • 前台用户投稿自动提取简介的办法

    帝国CMS默认自动生成简介功能只支持后台有效,前台是没办法的,只能手填。让用户投稿手写简介是不可能的,所以只能用其他办法了。我的站长站www.wdzzz.com为大家推荐利用自定义函数配合系统模型的“前台增加信息处理函数”来达到自动提取正文中的内容到简...

    帝国cms教程 184 4年前
  • 帝国cms新手教程禁止前台投稿内容带超链接的方法

    帝国CMS论坛看到有朋友提问如何禁止前台投稿内容带超链接?其实方法很简单,帝国CMS就自带投稿屏蔽字符功能,我们只需要用这个功能就能轻松实现帝国cms禁止前台投稿内容带超链接了。教程方法进入帝国CMS后台-系统参数设置-模型设置-信息投稿屏蔽设置-屏蔽...

    帝国cms教程 352 5年前
  • 帝国CMS自定义投稿表单教程

    如何开启帝国CMS投稿功能1、登录后台->系统设置->系统参数设置->用户设置->前台设置”开启投稿功能。2. 点击“系统->数据表与系统模型->管理数据表->选择要投稿的系统模型->勾选需要投稿的字段。帝国CMS如何自定义投稿表单下面是一段演示代码,注意修...

    帝国cms教程 374 5年前
  • 帝国cms7.5会员投稿邮件通知管理员

    帝国cms7.5会员投稿邮件通知管理员修改方法1、打开e/class/qinforfun.php文件2、查找代码:printerror("AddQinfoSuccess",$reurl,1);3、在其前增加:$email=$empire->gettotal("select fromemail as total from {$dbtbpre}enewspublic ");@include(ECMS...

    帝国cms教程 190 5年前
  • 帝国cms二次开发如何调用会员名及投稿数量排名
    帝国cms二次开发如何调用会员名及投稿数量排名

    <table>[e:loop={&#39;SELECT userid, username, COUNT( userid ) AS total FROM phome_ecms_news GROUP BY userid&#39;,10,24,0,&#39;&#39;,&#39;total DESC&#39;}]<tr><td><?=$bqno?></td><td...

    帝国cms教程 371 8年前