sNews Forum

sNews 1.6 (previous version) => sNewsMU (sNews Multi User version) => MU Mods => Topic started by: Keyrocks on November 08, 2009, 07:17:30 pm

Title: Approve Editors Content Before Publishing
Post by: Keyrocks on November 08, 2009, 07:17:30 pm
THIS MOD APPLIES ONLY TO: a default (un-modified) sNewsMU 1.6.3 package as issued by Bakercad, as last updated Jan.11.08 and available on the downloads page (

The sNewsMU 1.6.3 (multiple-users) package is based on the sNews 1.6 (single-user) package. It provides four user account-types:
Level 1: Admin - access to all administration panels'
Level2: Super Editor - privileges controlled by Admin, access to all but site settings;
Level 3: Editor - can generate and edit own content;
Level 4: User - no privileges other than viewing hidden or member-access-only content (if such mods are used).


The Admin enables this mod using two new settings in the Settings > Contents panel, as shown within the orange-bordered block below.

1) If the 1st check-box is checked, all content authored by Editors will be held for Admin approval before publishing.
   If it is un-checked, Editors will be able to publish their content immediately when it is saved.

2) If the 2nd check-box is checked, Super Editors (level 3 accounts) will also be able to approve content.
   If it is un-checked, on the Admin will be able to approve content.


When un-approved content published by Editors is waiting for approval, it will be listed in a new panel, visible below the "Comments waiting for approval" panel (if any), where the Admin will be able to see what's waiting, edit and approve it (or not). If the "Allow Super-Editors to approve content: check-box is enabled in the Settings > Contents panel, then all Super Editors will also see the panel and approve content.


With this mod enabled, once the Editor has "Posted Content for Approval" (article, extra or page), the content gets saved into the articles table with 'published' status of '1' and 'approved' status of 'NO'.

When the Editor views the Articles, Pages or Extras list from the main content Admin panel, his content is listed as shown:




When the Admin (or approving Super-Editors) view the Articles (extras or pages) lists, the un-published content is labelled as such there as well,
so that they can also be viewed, edited, approved or deleted from here.



1)  Download, install and test-run a fresh copy of MU 1.6.3 on your localhost (your computer).
    This step should include getting your database operational.

2)  Copy the revised articles & settings table script into a new file and save it as approve_content.sql.
     IMPORT this file, using phpMyAdmin (or other d-base management application) to alter your existing articles & settings tables.
     NOTE: This will over-write your esisting tables so be sure to back-up your existing database before this step to save any important data.
     (do not copy the PHP-tags)

Code: [Select]

-- For 
Bob Baker's default sNews MU 1.6.3 installation
-- MOD: Content Approval Mod
-- Created by Keyrocks, November 07.09
-- This file modifies the DEFAULT articles and settings tables by:
--  adding "approved" status value before "auth_id" in articles table.
--      adding "approve_content" (16) & "supera_approve" (17) (+ re-numbering) to settings table.
-- IMPORT this file in phpMyAdmin to alter your existing articles & settings tables.
-- -----------------------------------------------------------------------------------

-- create articles table


CREATE TABLE articles (
id int(11) primary key auto_increment,
title varchar(100) default NULL,
seftitle varchar(100) default NULL,
   `text` longtext,
   `date` datetime default NULL,
   category int(8) NOT NULL default '
   position int(6) default NULL,
   displaytitle char(3) NOT NULL default '
   displayinfo char(3) NOT NULL default '
   commentable varchar(5) NOT NULL default '',
   published int(3) NOT NULL default '
   description_meta varchar(255) default NULL,
   keywords_meta varchar(255) default NULL,
   approved char(3) NOT NULL default '
   author_id int(11) NOT NULL default '
   allow_edit char(3) NOT NULL default '

-- -------------------------------------------------------------
-- create settings table


CREATE TABLE settings (
  id int(8) primary key auto_increment,
  name varchar(20) NOT NULL,
  `value` varchar(60) NOT NULL

INSERT INTO `settings` VALUES (1, '
website_title', 'sNews 1.6 MU (Multiple Users)');
INSERT INTO `settings` VALUES (2, '
home_sef', 'home');
INSERT INTO `settings` VALUES (3, '
website_description', 'sNews 1.6 MU');
INSERT INTO `settings` VALUES (4, '
website_keywords', 'new, sitesnewsMU');
INSERT INTO `settings` VALUES (5, '
website_email', '');
INSERT INTO `settings` VALUES (6, '
contact_subject', 'Contact Form');
INSERT INTO `settings` VALUES (7, '
language', 'EN');
INSERT INTO `settings` VALUES (8, '
charset', 'UTF-8');
INSERT INTO `settings` VALUES (9, '
date_format', 'F j(g:iA)');
INSERT INTO `settings` VALUES (10, '
article_limit', '3');
INSERT INTO `settings` VALUES (11, '
rss_limit', '5');
INSERT INTO `settings` VALUES (12, '
display_page', '0');
INSERT INTO `settings` VALUES (13, '
display_new_on_home', '');
INSERT INTO `settings` VALUES (14, '
display_pagination', 'on');
INSERT INTO `settings` VALUES (15, '
num_categories', 'on');
INSERT INTO `settings` VALUES (16, '
approve_content', 'on');
INSERT INTO `settings` VALUES (17, '
supera_approve', 'on');
INSERT INTO `settings` VALUES (18, '
approve_comments', 'off');
INSERT INTO `settings` VALUES (19, '
comments_order', 'DESC');
INSERT INTO `settings` VALUES (20, '
comment_limit', '30');
INSERT INTO `settings` VALUES (21, '
word_filter_enable', '');
INSERT INTO `settings` VALUES (22, '
word_filter_file', '');
INSERT INTO `settings` VALUES (23, '
word_filter_change', '');
INSERT INTO `settings` VALUES (24, '
comments_reg', '');
INSERT INTO `settings` VALUES (25, '
added_by', 'on');
INSERT INTO `settings` VALUES (26, '
alert_register', '');
INSERT INTO `settings` VALUES (27, '
alert_emailusr', '');
INSERT INTO `settings` VALUES (28, '
length_password', '9');
INSERT INTO `settings` VALUES (29, '
registration_off', '');
INSERT INTO `settings` VALUES (30, '
users_online', 'on');


3)  Open the style.css file add the following to the end of the file. These are span-class color declarations used in the new language variable values
     to color text in the Profile and "Waiting for Approval" content lists. You can change them to any color you wish once you see where they are used:

   /* Content approval mod - span class colors */
   .blue { color: blue; }
   .green { color: green; }
   .orange { color: orange; }
   .red { color: red; }

4)  Preparing for modifications to the snewsMU.php file.
     While making these modifications, it's a good idea to add them to an 'active' copy of the file and re-name the 'master' (un-touched) file,
     and have it open in your code editor at the same time for reference purposes.

    - Copy the snewsMU.php file to some other location on your hard-drive.
    - Re-name it to snewsMU_DEF.php (the default, un-modded file).
    - Move this file back into your project directory along with the rest of your project's files.
    - Open snewsMU.php and snewsMU_DEF.php in your code editor.
    - Make your modifications to snewsMU.php so they will apply to your project for testing purposes.
    - Use snewsMU_DEF.php to find mod locations by line number as we proceed.
    - If your snewsMU.php file mods don't work out, you can always delete it and re-name a fresh copy of snewsMU_DEF.php to replace it.



There are 28 modification locations throughout the snewsMU.php engine file. Each mod (below) is preceded by a common individually-numbered comment string so that you can use - # Content approval mod - or the mod: (xx) number - to locate all mod locations later on.
These modifications will only increase the size of the 'engine' file from 154KB to 163KB.


a)  Mod location 1:
     Locate by searching the file for:  #customize article  and add the following above it.
     Note that the last 6 strings contain (apply) the span-class colors we added to the style.css file:
     (do not copy the PHP-tags)

Code: [Select]

# Content approval mod: (1) - 3 strings
$l['unapproved_content'] = 'Content - Approval Required';
$l['wait_approval_content'] = 'Item(s) waiting for approval';
$l['send_for_approval'] = 'Post content for approval';
$l['pos_status_1'] = '<span class="blue">article</span>';
$l['pos_status_2'] = '<span class="blue">extra</span>';
$l['pos_status_3'] = '<span class="blue">page</span>';
$l['pub_status_1'] = '<span class="green">published</span>';
$l['pub_status_2'] = '<span class="orange">future date</span>';
$l['pub_status_3'] = '<span class="red">needs approval</span>';


b)  Mod location 2: Locate:  #comments and add the following below it:

Code: [Select]

# Content approval mod: (2)
$l['comments_to_approve'] = 'Comments - Approval Required';


c)  Mod location 3: Locate:  ## MULTI_USER LANGUAGE VARIABLES and add the following below it:

Code: [Select]

# Content approval mod: (3)
$l['mu_approve_content'] = 'Approve content by Editors before publishing';
$l['mu_supera_approve'] = 'Allow Super-Editor to approve content';


2)  // DISPLAY CATEGORIES  function:

Mod location 4: Locate the query string that queries the articles table. It starts with:  $calc_num_query = "SELECT . It is the 7th line down in the function, line 496 in the default snewsMU.php file. Replace the query string with:

Code: [Select]

# Content approval mod: (4) - AND approved = 'YES' - added to query string.
$calc_num_query "SELECT * FROM ".db('prefix')."articles WHERE position = 1 AND approved = 'YES' AND category = $r[id] AND published = 1";


3)  // DISPLAY PAGES function:

Mod location 5:
Locate the query string that queries the articles table. It starts with:  $query = "SELECT * FROM and it is the 6th line down in the function (line 512 in the default snewsMU.php file). Replace the query string with:

Code: [Select]

# Content approval mod: (5) - added to query string: AND approved = 'YES'
$query "SELECT * FROM ".db('prefix')."articles WHERE position = 3 AND approved = 'YES' ORDER BY id";


4)  //EXTRA CONTENT function:

Mod location 6:
Locate the query string that queries the articles table. It starts with:  $query = "SELECT * FROM and it is the 5th line down in the function (line 539 in the default snewsMU.php file). Replace the query string with:

Code: [Select]

# Content approval mod: (6)- added to query string: AND approved = 'YES'
$query "SELECT * FROM ".db('prefix')."articles WHERE SUBSTRING(position, 1, 1) = '2' AND published = 1 AND approved = 'YES' ORDER BY id DESC";


5)  // CENTER function:

Mod location 7:
Locate (search for):  case '404': error404(); break; and, 8 lines down you'll find the query string that starts with:  $query_articles = "SELECT * FROM - (line 685 in the default snewsMU.php file). Replace the query string with:

Code: [Select]

# Content approval mod: (7) - added to query string: AND approved = 'YES'
$query_articles "SELECT * FROM ".db('prefix')."articles WHERE published = 1 AND approved = 'YES' AND SUBSTRING(position, 1, 1) != '2'";


6)  function profile()

a)  Mod location 8: Locate these 3 strings (lines 1189 to 1191 in the default snewsMU.php file):
Code: [Select]

"SELECT * FROM ".db('prefix')."articles WHERE author_id = '$id'";
$result mysql_query($query);
$num mysql_num_rows($result);


Add the following comment section below it. Use this as a reference to change which users can view their own content list in their Profile panel.
The string below it uses  < '4'  which means "less than level 4 (level 4 is a user account).

Code: [Select]

/* # Content approval mod: (8) -------------------------------------------------------------------------------
     If User level is less that 4 (not 4), show user's content items list to Admin-1, Super Editor-2, Editor-3.
     If User level is less that 3 (not 4 & 3'), show user's content items list to Admin-1, Super Editor-2.
     If User level is less that 2 (not 4, 3 & 2'), show user's content items list to Admin-1 only.


b)  Mod location 9: Seven lines below that, locate:  while ($r = mysql_fetch_array($result)) { and add the following under it:
Code: [Select]

# Content approval mod: (9) 4 strings
$position $r['position']; // pull 'position' #
if ($position == '1') { $content_type l('pos_status_1'); } else if ($position == '2') { $content_type l('pos_status_2'); } else if ($position == '3') { $content_type l('pos_status_3'); } // translate content-type to text value
$published $r['published']; // pull 'published' #
if ($published == '1') { $pub_status l('pub_status_1'); } else if ($published == '2') { $pub_status l('pub_status_2'); } else if ($published == '3') { $pub_status l('pub_status_3'); } // translate published status to text value


c)  Mod location 10:
     Below that, locate:  $articleSEF = $contents != 'extra_view' ? $r['seftitle'].'/' : '';
     (line 1199 in the default snewsMU.php file). Below it, replace the echo string with a new one:

Code: [Select]

# Content approval mod: (10) added - ('.$content_type.', '.$pub_status.') '.l('divider').'
echo '<p><strong><a href="'.db('website').find_cat_sef($r['category']).'/'.$articleSEF.'">'.$r['title'].'</a></strong> '.l('divider').' ('.$content_type.', '.$pub_status.') '.l('divider').' '.date(s('date_format'), strtotime($r['date'])).'';


7)  // ARCHIVE function:

Mod location 11:
Locate the 2nd line in the function, which starts with:  $query = "SELECT * FROM and replace it with a new string:
Code: [Select]

# Content approval mod: (11) - added to query string: AND approved = 'YES'
$query "SELECT * FROM ".db('prefix')."articles WHERE position = 1 AND published = 1 AND approved = 'YES' ORDER BY date DESC";


8 )  //SITEMAP function:

a)  Mod location 12: Locate the 7th line down in the function, which also strts with:  $query = "SELECT * FROM
     and replace it with a new string:
Code: [Select]

# Content approval mod: (12) - added to query string: AND approved = 'YES'
$query "SELECT * FROM ".db('prefix')."articles WHERE position = 3 AND published = '1' AND approved = 'YES' ORDER BY date";


b)  Mod location 13:
     13 more lines down, locate the next query string that starts with:  $art_query = "SELECT * FROM and replace it with the following:
Code: [Select]

# Content approval mod: (13) - added to query string: AND approved = 'YES'
$art_query "SELECT * FROM ".db('prefix')."articles WHERE position = 1 AND published = '1' AND approved = 'YES'";


9)  // MENU ARTICLES function:

Mod location 14: The first line in the function queries the articles table (line 1581 in the default snewsMU.php file) and starts with:  $query = "SELECT * FROM - Replace it with:
Code: [Select]

# Content approval mod: (14) - added to query string: AND approved = 'YES'
$query "SELECT * FROM ".db('prefix')."articles WHERE position = 1 AND published = 1 AND approved = 'YES' ORDER BY date DESC LIMIT $start$size";


10)  //SEARCH ENGINE function:

Mod location 15: Locate the query to the articles table, the 7th line down (line 1640 in the default snewsMU.php file) in the functon.
Like the query strings in most of the other mod locations, it starts with:  $query = "SELECT * FROM - Replace it with:
Code: [Select]

# Content approval mod: (15) - added to query string: AND approved = 'YES'
$query "SELECT * FROM ".db('prefix')."articles WHERE SUBSTRING(position, 1, 1) != '2' AND published = 1 AND approved = 'YES' AND";


.... continued to next post (exeeded the limit on this one)...
Title: Re: Approve Editors Content Before Publishing
Post by: Keyrocks on November 08, 2009, 08:38:49 pm
(picking up where I left off on the first post...)

11)  // ADMINISTRATION FORM function:

a)  Mod location 16: Seven lines below the $query_comm  string, locate:  if ($unapproved > 0) {
     (line 1887 in the default snewsMU.php file) - Replace the - echo html_input  string below it.
     (cosmetic... it changes the language text value in the string to read "Comments - Approval Required".)
Code: [Select]

# Content approval mod: (16) new lang-variable 'comments_to_approve' replaces 'comments'.
echo html_input('fieldset'''''''''''''''''''''''''''l('comments_to_approve'));


b)  Mod location 17: 12 lines below the echo html_input  string, locate:  if (get_identity($_SESSION['id'], 'level') == '1') { (line 1900 in the default snewsMU.php file). The "Comments - Approval Required" panel ends just above it, and this is where we add in the new panel for the new "Contents - Approval Required" panel. Insert all of the following in this location:
Code: [Select]

# End: "Comments - Approval Required" panel --------------------
# ------- # Content approval mod: (17) "Content - Approval Required" panel (article,page,extra) ------------
$query_content "SELECT * FROM ".db('prefix')."articles WHERE approved = 'NO'";
$content_result mysql_query($query_content);
$not_approved mysql_num_rows($content_result);
# If approve and Super-Editor approved are on, show panel to Super Editor - OR - if approve is on and is Admin, show panel to Admin.
if (s('approve_content') == 'on' && s('supera_approve') == 'on' || s('approve_content') == 'on' && get_identity($_SESSION['id'], 'level') == '1') {
if ($not_approved 0) {
   echo html_input('fieldset'''''''''''''''''''''''''''l('unapproved_content'));
   echo '<p><a onclick="toggle(\'subarticles\')" style="cursor: pointer;" title="'.l('unapproved').'">'.$not_approved.' '.l('wait_approval_content').'</a></p>';
   echo '<div id="subarticles" style="display: none;">';
   while ($r mysql_fetch_array($content_result)) {
        $contentTITLE $r['title'];
        $user_id $r['author_id'];
        $position $r['position'];
$user_name retrieve(username_realusersid$user_id); // pulls username from users table.
$user_level retrieve(levelusersid$user_id); // pulls user's level # from users table.
$user_type get_identity($user_level); // generate user type user level #.
# show content-type by position number.
if ($position == '1') { $content_type l('pos_status_1'); } else if ($position == '2') { $content_type l('pos_status_2'); } else if ($position == '3') { $content_type l('pos_status_3'); } // translate content-type to text value
# Show item(s) with details & 'Edit' link(s)
echo '<p><strong>'.$contentTITLE.':</strong> ('.$content_type.', by '.$user_name.', '.$user_type.') '.l('divider').' <a href="'.db('website').'index.php?action=admin_article&amp;id='.$r['id'].'">'.l('edit').'</a></p>';
   echo '</div>';
if ($not_approved 0) {echo '</fieldset>';}
//-------- End: "Content - Approval Required" panel (article,page,extra) --------------------


12)  // SETTINGS FORM function:

a)  Mod location 18:
    Locate the first $query = "SELECT * FROM query string (to the articles table again, line 1952 in the default snewsMU.php file).
    And, like the others, we're just adding - AND approved = 'YES' -  to it so it will only list page titles for "approved" pages,
    in the drop-down page section field where we choose "Use Page as Home Page" in the Settings > Contents panel. Replace it with:
Code: [Select]

# Content approval mod: (18) - added to query string: AND approved = 'YES'
$query "SELECT * FROM ".db('prefix')."articles WHERE position = 3 AND approved = 'YES' ORDER BY id ASC";


b)  Mod location 19:
    7 lines below the new query string, locate:  echo '</select></p>'; - This is the end of the dropdown 'page selection' field in the form.
    Below it, we want to add 2 new check-boxes the Admin will use to switch "Approve Content by Editors before publishing" (on/off)
    and switch "Allow Super-Editor to approve content" (on/off). Copy and paste the following here:
Code: [Select]

# Content approval mod: (19) - 2 check-box strings
echo html_input('checkbox''approve_content''aa'''l('mu_approve_content'), '''''''', (s('approve_content') == 'on' 'ok' ''), ''''''''''); // "Approve Content by Editors before publishing" (on/off).
echo html_input('checkbox''supera_approve''supa'''l('mu_supera_approve'), '''''''', (s('supera_approve') == 'on' 'ok' ''), ''''''''''); // "Allow Super-Editor to approve content" (on/off).


13)  // ARTICLES FORM function:

a)  Mod location 20:
    Locate these two strings, (lines 2189 & 2190 in the default snewsMU.php file):
Code: [Select]

if ($contents == 'article_new' || $edit_option == 1) {
html_input('checkbox''publish_article''pu''YES'l('publish_article'), ''''''''$frm_publish'''''''''');


    Comment them out and, above them, add (or replace them with) this new section:
Code: [Select]

/* # Content approval mod: (20)
   - Controls which check-boxes are visible to Editor, Super Editor and Admin.
     1) IF "approve_content" is enabled (on) & author is EDITOR (3), ---*/
if (s('approve_content') == 'on' && get_identity($_SESSION['id'], 'level') > '2') {
# show EDITOR "Post Content for Approval" check-box: Checked - sets published status to '1'.
   echo html_input('checkbox''publish_content''pu''YES'l('send_for_approval'), ''''''''$frm_publish'''''''''');
} else {
 # IF NOT, show EDITOR the "Publish Now" check-box: Checked - also sets published status to '1'.
   echo html_input('checkbox''publish_content''pu''YES'l('publish_now'), ''''''''$frm_publish'''''''''');
  // 2) IF "approve_content" & "supera_approve" 'on' & level =less than 3 (Super Editor or Admin), show "Approval" checkbox.
if (s('approve_content') == 'on' && s('supera_approve') == 'on' && get_identity($_SESSION['id'], 'level') < '3') {
html_input('checkbox''approved''ap'''l('approved'), ''''''''$r['approved'] == 'YES' 'ok' '''''''''''');
# End: Content approval mod: (20) -------------------------------------------- 


b)  Mod location 21: Further down in this same function, locate another $query = "SELECT * FROM  query string (to the articles table) that requires AND approved = 'YES' in it. This one keeps un-approved pages from showing in the Customize panel's "Appear only on page" drop-down (line 2214 in the default snewsMU.php file). Replace it with:
Code: [Select]

# Content approval mod: (21) AND approved = 'YES' (show pages in "Appear only on Page" dropdown)
$query "SELECT * FROM ".db('prefix')."articles WHERE position = 3 AND approved = 'YES' ORDER BY id ASC";


14)  // ARTICLES - ADMIN LIST function:

Mod location 22: About 9 lines up from the bottom of the function, (line 2295 in the default snewsMU.php file)
locate:  if ($r['published'] == 0) {echo  l('divider').' ['.l('status').' '.l('unpublished').']';}
and under it, add the following to show - [Status: Approval Required] beside content that is not yet approved:
Code: [Select]

# Content approval mod: (22)
if ($r['approved'] == NO) {echo  l('divider').' ['.l('status').' '.l('pub_status_3').']';}


The modifications in function processing() are all required to save all changes   made from the various administration panels to their respective tables in the database.

a)  Mod location 23:
    Locate the 5th line down in the function (variable=value) - $commentid = $_POST['commentid'];
    (line 2355 in the default snewsMU.php file) and, under it, paste in a new string:
Code: [Select]

# Content approval mod: (23)
$approved_content $_POST['approved'] == 'on' 'YES' 'NO';


b)  Mod location 24:
    Further down in the same list of variable strings, locate (line 2378 in the default snewsMU.php file):
    $publish_article = ($_POST['publish_article'] == 'on' || $position > 1) ? 1 : 0;
    and replaced it with:
Code: [Select]

# Content approval mod: (24) default string but changed: 'publish_article' to: 'publish_content'
$publish_article = ($_POST['publish_content'] == 'on' || $position 1) ? 0;


c)  Mod location 25:
    In the next set of variable strings, under:  case 'save_settings':
    locate (line 2404 in the default snewsMU.php file):  $num_categories = $_POST['num_categories'];
    and, under it, add 2 new ones:
Code: [Select]

# Content approval mod: (25) to save "Approve Articles by Editors before publishing" (yes, no)
$approve_content $_POST['approve_content']; // "Approve Articles by Editors before publishing" (on/off)
$supera_approve $_POST['supera_approve']; // super-editor content approval (on/off)


e)  Mod location 26: (line 2421 in the default snewsMU.php file)
    The $ufield = array string (a biggie) at the end of this variable string-set contains the variable => value phrases
    for all of the settings being saved to the settings d-base table.
    Each time we add a new setting to the settings table, we need to add a phrase for it in this array.
    In this case, we need to add:  'approve_content'  => $approve_content, to the string.
   You can replace the complete $ufield  array string with (if you wish):
Code: [Select]

# Content approval mod: (26)
// added: 'approve_content' => $approve_content,'supera_approve' => $supera_approve,
$ufield = array('website_title' => $website_title,'home_sef' => $home_sef,'website_description' => $website_description,'website_keywords' => $website_keywords,'website_email' => $website_email,'contact_subject' => $contact_subject,'language' => $language,'charset' => $charset,'date_format' => $date_format,'article_limit' => $article_limit,'rss_limit' => $rss_limit,'display_page' => $display_page,'comments_order' => $comments_order,'comment_limit' => $comment_limit,'word_filter_file' => $word_filter_file,'word_filter_change' => $word_filter_change,'display_new_on_home' => $display_new_on_home,'display_pagination' => $display_pagination,'num_categories' => $num_categories,'approve_content' => $approve_content,'supera_approve' => $supera_approve,'approve_comments' => $approve_comments,'word_filter_enable' => $word_filter_enable,'display_added_by' => $added_by,'comments_reg' => $comments_reg,'alert_register' => $alert_register,'alert_emailusr' => $alert_emailusr,'length_password' => $length_password,'registration_off' => $registration_off,'users_online' => $users_online,);


f)  Mod location 27: (line 2484 in the default snewsMU.php file)
    Locate:  case(isset($_POST['add_article'])): and replace the - mysql_query("INSERT INTO - string under it with:
Code: [Select]

# Content approval mod: (27) added - approved,   '$approved_content',
mysql_query("INSERT INTO ".db('prefix')."articles(title, seftitle, text, date, category, position, displaytitle, displayinfo, commentable, published, description_meta, keywords_meta, approved, author_id, allow_edit) VALUES('$title', '$seftitle', '$text', '$date', '$category', '$position', '$display_title', '$display_info', '$commentable', '$publish_article', '$description_meta', '$keywords_meta', '$approved_content', '".$_SESSION['id']."', '$allow_edit')");


g)  Mod location 28: (line 2489 in the default snewsMU.php file)
    Locate:  case(isset($_POST['edit_article'])): and replace the - mysql_query("UPDATE - string under it with:
Code: [Select]

# Content approval mod: (28) added: approved = '$approved_content',
mysql_query("UPDATE ".db('prefix')."articles SET title='$title', seftitle = '$seftitle', text = '$text',".$future." category = '$category', position = '$position', displaytitle = '$display_title', displayinfo = '$display_info', commentable = '$commentable', published = '$publish_article', description_meta = '$description_meta', keywords_meta = '$keywords_meta', approved = '$approved_content', allow_edit = '$allow_edit' WHERE id = '$id' LIMIT 1;");


And... if you've made it this far and your file still functions... and your new mods are visible and working... we're finished.


DISCLAIMER: As is the case with all modifications provided by sNews users and developers, the above modification instructions are provided on an as-is, where-is basis without any suggestion or implication of warranty or guarantee that the results will function as intended. The degree of success achieved will depend on how well the preparation and modification steps were adhered to in the modification process.

I hope this mod turns out to be useful for sNewsMU 1.63 users.  8)
Title: Re: Approve Editors Content Before Publishing
Post by: michael kennedy on February 22, 2010, 07:33:00 pm
I haven't tried this yet, but this is awesome. I'm surprised it isn't part of the sNews MU core.
Title: Re: Approve Editors Content Before Publishing
Post by: michael kennedy on January 03, 2013, 01:12:12 am
OK, so I'm sure that nobody probably cares at this point. But I found a serious issue with the approval mod, and I might even dump it.

It seems that if you have pages already online, and a editor makes a change - that page is completely pulled from the site leaving an ugly "Content not found" message until the page gets approved by a Super Editor or Admin.   Seriously???  Not cool.

That page should remain visible, and only a copy of it should be kept in the approval queue....  :-\

Title: Re: Approve Editors Content Before Publishing
Post by: Keyrocks on January 03, 2013, 02:31:25 am
Hi Michael:
It is now more than three years since I posted these modifications so I no longer have a working project with them to test for the problem you described. However you would be correct.

It makes sense that if an Editor changes the content of a page that was published and approved before, it will again become un-published and require approval of the site or super admin again. It would also make sense that any links to that page - or search results to it from a search engine - would return the "Content not found" message until it was re-approved and published again... there would be no getting around that.

I am thinking a 'cleaner' way to deal with this would be to replace the "Content not found" message with a more acceptable message like... "Oops! We apologise. The content you are looking for may be unavailable due to (whatever) and should be available within the next 24 hours" (as an example) ... and it could even include a cute image or be wrapped in a nice container if desired.

This could be done by creating a new function that would generate the 'new' message... and calling that function into action in whichever function the "Content not found" message is being generated (one would replace the other).