打開:
apps/home/controller 找到:MemberController.php
搜索:// 會員投稿
找到添加數(shù)據(jù)的代碼。
// 構(gòu)建數(shù)據(jù) $data = array( 'acode' => get_lg(), 'scode' => $scode, 'subscode' => $subscode, 'title' => $title, 'titlecolor' => $titlecolor, 'subtitle' => $subtitle, 'filename' => $filename, 'author' => $author, 'source' => $source, 'outlink' => $outlink, 'date' => $date, 'ico' => $ico, 'pics' => $pics, 'picstitle' => $picstitle, 'content' => $content, 'tags' => $tags, 'enclosure' => $enclosure, 'seotitle' => $seotitle, 'keywords' => $keywords, 'description' => clear_html_blank($description), 'sorting' => 255, 'status' => 0, 'istop' => 0, 'isrecommend' => 0, 'isheadline' => 0, 'gid' => 0, 'gtype' => 4, 'gnote' => '', 'tpl' => '', 'isfront' => 1, 'visits' => 0, 'likes' => 0, 'oppose' => 0, 'create_user' => $username, 'update_user' => $username );
如果只是指定一個欄目的話,我們將數(shù)據(jù)修改一下:
'status' => ($scode == 20 ? 1 : 0), // ★ 當投稿欄目為20的時候,直接發(fā)布。不用審核
如果要指定多個欄目的話,我們可以使用數(shù)組。修改成以下方式。
// 定義允許自動審核的欄目ID數(shù)組 $autoPassScodes = [18, 20, 25]; // 這里寫需要自動審核的欄目ID // 構(gòu)建數(shù)據(jù) $data = array( 'acode' => get_lg(), 'scode' => $scode, 'subscode' => $subscode, 'title' => $title, 'titlecolor' => $titlecolor, 'subtitle' => $subtitle, 'filename' => $filename, 'author' => $author, 'source' => $source, 'outlink' => $outlink, 'date' => $date, 'ico' => $ico, 'pics' => $pics, 'picstitle' => $picstitle, 'content' => $content, 'tags' => $tags, 'enclosure' => $enclosure, 'seotitle' => $seotitle, 'keywords' => $keywords, 'description' => clear_html_blank($description), 'sorting' => 255, 'status' => (in_array($scode, $autoPassScodes) ? 1 : 0), // ★ 數(shù)組方式判斷 'istop' => 0, 'isrecommend' => 0, 'isheadline' => 0, 'gid' => 0, 'gtype' => 4, 'gnote' => '', 'tpl' => '', 'isfront' => 1, 'visits' => 0, 'likes' => 0, 'oppose' => 0, 'create_user' => $username, 'update_user' => $username );
這樣就實現(xiàn)了某些欄目不用審核投稿就成功了。