Page 1 of 5 123 ... LastLast
Results 1 to 10 of 41
  1. #1
    Pligg Donor redwine's Avatar
    Joined
    Jul 2007
    Posts
    214
    Thanks
    Received:0
    Given: 0

    [SOLVED] Complete solution to approve the story after being submitted

    I've already posted a quick fix answering few questions about this subject:
    http://forums.pligg.com/general-help...l-stories.html

    Then, I thought about providing a complete solution for it.

    This is applicable only if you want, as administrator, to verify and approve the story before appearing in the “Upcoming”.

    The files involved are:
    1. /submit.php
    2. /libs/html1.php
    3. /templates/yourtemplate/admin_templates/admin_links_center.tpl
    4. /admin_links.php
    5. /libs/search.php
    **** WARNING ****
    Always backup your files before making any modifications
    First, change the table:
    Code:
    alter TABLE table prefix_links change link_status link_status enum('discard','queued','published','abuse','duplicated','pending') NOT NULL default 'discard';
    Then modify the “table_totals” to add a name and total for “pending”
    Code:
    insert into table_totals (`name`, `total`) values ('pending', 0);
    Now, we have to make sure that upon finishing the 3rd step of submitting the story, the story status is set to “pending” instead of queued, and the totals in the totals table is adjusted.

    Open /submit.php and locate function do_submit3() {
    Change this code:

    Code:
    totals_adjust_count($linkres->status, -1);
    totals_adjust_count('queued', 1);
    $linkres->status='queued';
    Change to:
    Code:
    totals_adjust_count($linkres->status, -1);
    totals_adjust_count('pending', 1);
    $linkres->status='pending';
    Note: If you started having grey hair or more grey hair from verifying the stories, all you have to do to revert back is changing the above changes to the original code above it. All the below modifications can remain and will be used if you want to manually change the status of the story to “pending” instead of “discard”

    Save and close.

    Now, we have to modify the function totals_regenerate() to reflect this in the table_links and table_totals.

    Open /libs/html1.php and locate function totals_regenerate(){

    Right before the if(caching == 1){

    Add this code:
    Code:
    $name = 'pending';
    $count = $db->get_var("SELECT count(*) FROM " . table_links . " WHERE link_status='$name';");
    $db->query("UPDATE `" . table_totals . "` set `total` = $count where `name` = '$name';");
    $cached_totals[$name] = $count;
    Save and close.

    Up to here, any new submitted story is “pending”. The administrator has to review it and, if approved, change the status to “queued”.

    We need to modify few other files to filter (in News Management) by “pending” and also show the radio button to reverse a published or queued story to “pending”.

    Open /templates/yourtemplate/admin_templates/admin_links_center.tpl

    We have to add an option to the select (dropdown) to be able to filter by “pending”

    Add this code anywhere you want after <select name="filter">:
    Code:
    <option value="pending" {if $templatelite.get.filter eq "pending"} selected="selected" {/if}>Pending</option>
    And few lines down, change this code (add the code in red):
    Code:
    <tr><th>{#PLIGG_Visual_View_Links_Status#}</th><th>{#PLIGG_Visual_View_Links_Author#}</th><th>{#PLIGG_Visual_View_Links_New_Window#}</th><th><center>Publish</center></th><th><center>Queued</center></th><th><center>Pending</center></th><th><center>Discard</center></th></tr>
    Change this code (add the code in red)
    Code:
    Find this bloc of code and add the code (in red)
     
     <tr>     
                 <td>{$template_stories[id].link_status}</td>
                 <td><a href="{$URL_user, $template_stories[id].link_author}">{$template_stories[id].link_author}</a></td>
                 <td><a href="{$my_pligg_base}/story.php?title={$template_stories[id].link_title_url}" target="_blank">{$template_stories[id].link_title}</a></td>
                 <td><center><input type="radio" name="link[{$template_stories[id].link_id}]" id="link-{$template_stories[id].link_id}" value="publish"></center></td>
                 <td><center><input type="radio" name="link[{$template_stories[id].link_id}]" id="link-{$template_stories[id].link_id}" value="queued"></center></td>
     <td><center><input type="radio" name="link[{$template_stories[id].link_id}]" id="link-{$template_stories[id].link_id}" value="pending"></center></td>
                 <td><center><input type="radio" name="link[{$template_stories[id].link_id}]" id="link-{$template_stories[id].link_id}" value="discard"></center></td>
     </tr>
    Find this bloc of code and add the code (in red)
    Code:
    <center><a href="javascript:mark_all_publish()">Mark all for Published</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:mark_all_queued()">Mark all for Queued</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:mark_all_pending()">Mark all for Pending</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:mark_all_discard()">Mark all for Discarded</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:uncheck_all()">Uncheck All</a></center>
    Finally, add this function at the end of the file:
    Code:
    function mark_all_pending() {
        for (var i=0; i< document.bulk_moderate.length; i++) {
                    if (document.bulk_moderate[i].value == "pending") {
                                document.bulk_moderate[i].checked = true;
                    }
        }
    [FONT=Verdana][FONT=Times New Roman]}[/FONT][/FONT]
    And modify this function (add the code in red):
    Code:
    function uncheck_all() {
        for (var i=0; i< document.bulk_moderate.length; i++) {
                    if ((document.bulk_moderate[i].value == "queued")||(document.bulk_moderate[i].value == "pending")||(document.bulk_moderate[i].value == "discard")|| (document.bulk_moderate[i].value == "publish")){
                                document.bulk_moderate[i].checked = false;
                    }
        }
    [FONT=Verdana][FONT=Times New Roman]}[/FONT][/FONT]
    Save and close.

    Now open /admin_links.php

    Locate if(isset($_GET["filter"])) {

    And add this (to be able to filter by “pending” from the “News Management”:
    Code:
    case 'pending':
        $filtered = $db->get_results("SELECT link_id FROM " . table_links . " where link_status = 'pending' ORDER BY link_date DESC LIMIT $offset,25");
        $rows = $db->get_var("SELECT count(*) FROM " . table_links . " where link_status = 'pending'");
    [FONT=Verdana][FONT=Times New Roman]break;[/FONT][/FONT]
    Locate if ($_GET['action'] == "bulkmod") {

    [FONT=Times New Roman][FONT=Verdana]And add this code at the end of the foreach[/FONT][/FONT]
    Code:
    elseif ($value == "pending") {
        $db->query('UPDATE `' . table_links . '` SET `link_status` = "pending" WHERE `link_id` = "'.$key.'"');
    [FONT=Verdana][FONT=Times New Roman]}[/FONT][/FONT]
    Save and Close.

    Thanks to method20, who brought the issue of the Tags related to the pending story (http://forums.pligg.com/general-help...on-syndk8.html).

    Open /libs/search.php, look the following code and add the part in RED
    Code:
    if ($this->filterToStatus == 'all') {$from_where .= " link_status!='discard' AND link_status!='pending'";}
    Save and close.
    Upload the files listed at the top to your dev server and test. It works like a charm.

  2. #2
    Banned Geoserv's Avatar
    Joined
    Feb 2007
    Posts
    796
    Thanks
    Received:0
    Given: 0
    Though I probably wouldn't use this mod, I gave you a thanks for the time and work put into creating it.

    Good job.

    Geoserv.

  3. #3
    Casual Pligger modernste's Avatar
    Joined
    Nov 2007
    Posts
    34
    Thanks
    Received:0
    Given: 0
    awesome mod, I can really see where this would be a major help with sites getting lots of garbage submissions or sites that only allow a specific type of submission. I'm thinking about where I can use this.

  4. #4
    New Pligger Skandy's Avatar
    Joined
    Dec 2007
    Posts
    28
    Thanks
    Received:0
    Given: 0

    Wink Sending email when a story is pending

    Hi,

    Thank you for the nice work. It would be great if the server could send an email to the admin/moderator when a story is submitted and pending.

    Any ideas?

    Thanks.

  5. #5
    Pligg Donor redwine's Avatar
    Joined
    Jul 2007
    Posts
    214
    Thanks
    Received:0
    Given: 0
    Quote Originally Posted by Skandy View Post
    Hi,

    Thank you for the nice work. It would be great if the server could send an email to the admin/moderator when a story is submitted and pending.

    Any ideas?

    Thanks.
    It is coming. I am working on it as well as a global options for users to select when they want to receive emails.

  6. #6
    New Pligger Skandy's Avatar
    Joined
    Dec 2007
    Posts
    28
    Thanks
    Received:0
    Given: 0

    Cant' wait!

    Quote Originally Posted by redwine View Post
    It is coming. I am working on it as well as a global options for users to select when they want to receive emails.
    Cool! Any dates? :smile:

  7. #7
    Senior Member not2serious's Avatar
    Joined
    Apr 2007
    Posts
    231
    Thanks
    Received:0
    Given: 0
    It also would be nice if this approval process could be limited to a "god" level user, a "admin" level user or BOTH. This would have to be a setting in the admin user panel, which can only be edited by a "god" level user.

  8. #8
    Pligg Donor blaze's Avatar
    Joined
    Sep 2007
    Posts
    192
    Thanks
    Received:0
    Given: 0
    Can you please let people know what version this is for in the FIRST POST? Your first step doesn't make sense to those using v9.82, as there is no "table_totals" in the database. Also, will this work for v9.82 or less?

  9. #9
    Pligg Donor redwine's Avatar
    Joined
    Jul 2007
    Posts
    214
    Thanks
    Received:0
    Given: 0

    Makin sense!

    Quote Originally Posted by blaze View Post
    Can you please let people know what version this is for in the FIRST POST? Your first step doesn't make sense to those using v9.82, as there is no "table_totals" in the database. Also, will this work for v9.82 or less?
    It does make sense to those who asked for it. You can read the version number I am using, and if it applies for you then good for you, if not you can either customize it if you know how or ask for specifics!

  10. #10
    Constant Pligger manya1011's Avatar
    Joined
    Jan 2008
    Posts
    159
    Thanks
    Received:0
    Given: 0
    Nicely done, with this, some people are interested in something like this..

Page 1 of 5 123 ... LastLast

Similar Threads

  1. A Complete Solution to Turkish Char Problem in Pligg
    By ozlegolas in forum Questions & Comments
    Replies: 13
    Last Post: 12-13-2009, 05:21 PM
  2. auto approve all story/news
    By cmedia in forum Questions & Comments
    Replies: 3
    Last Post: 09-22-2009, 01:45 PM
  3. [SOLVED] How to submit complete URL?
    By Max09 in forum Questions & Comments
    Replies: 1
    Last Post: 12-31-2008, 08:38 AM
  4. summary of story in complete story-view
    By gatekeeper in forum Questions & Comments
    Replies: 1
    Last Post: 04-18-2008, 01:31 PM
  5. Replies: 10
    Last Post: 12-29-2007, 07:56 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Pligg Modules and Pligg Templates from Pligg Pro Web Hosting Services by Midphase Dreamhost Web Hosting Donate to Pligg