1 (edited by 2009-03-27 15:17:22)

Topic: [HACK] Allow Journalist to post without approval

Name: Allow Journalist to post without approval
Author: Damoor
CuteNews Compatibility: 1.3.6 - * (no incompatibility reported yet)
Description: On one of my educational websites I was asked to give Journalists the ability to post news without approval. Sometimes it needs to be on (when the journalists, who are young students, are new or are practising). Then later it  needed it to be off, when they are more confident and trusted.
With this hack you'll be enable journalists to directly post active news. And an option is added to 'system configurations' so you can switch between the options later on without editing files.
Instructions:

To do this Open inc/options.mdu
Find

// News

Add in this section

showRow("Approve Journalist", "if not, Journalists can post without approval", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[use_approve]", "$config_use_approve"));

Open inc/addnews.mdu
Find:

if($member_db[1] == 3 or $postpone_draft == "draft"){
            //if the user is Journalist, add the article as unapproved
             $decide_news_file = "./data/unapproved_news.txt";
             $added_time = time()+ ($config_date_adjust*60);
             $postpone = FALSE;
             $unapproved_status_msg = "The article was marked as Unapproved!";
    }

Replace with:

if((($member_db[1] == 3) and $config_use_approve == "yes")  or $postpone_draft == "draft") {
         //modified- if the user is Journalist, and approval is on, add the article as unapproved         
             $decide_news_file = "./data/unapproved_news.txt";
             $added_time = time()+ ($config_date_adjust*60);
             $postpone = FALSE;
             $unapproved_status_msg = "The article was marked as Unapproved!";
    }

You now have another option in configurations to allow journalists to post without approval.
Don't forget to set the option as required and then save the configurations.