Jump to content


Photo

Post Control / Approval MOD


  • Please log in to reply
4 replies to this topic

#1 sbourdon

sbourdon
  • Members
  • PipPipPip
  • Advanced Member
  • 35 posts

Posted 28 February 2006 - 07:29 PM

Hello,

I've taken over the development of Post Control, an approval MOD for phpBB originally created by Ani' and published on phpbbfrance.org.

I only need to fix two more bugs before being able to release a stable, final version...

Let's take it one bug at a time!

Posts awaiting validation within a topic can all be approved or disapproved at once by simply clicking an icon at the bottom of the topic's page. Inside a non-moderated forum, the icon's tootltip should read: 'Activate Post Control in this topic' but as of right now, it says: 'Validate all posts awaiting validation in this topic'.

The bug is that a new topic created inside a non-moderated forum is identified with the variable topic_request_val = 1 when it should be: topic_request_val = 0.


Here's the installation file for this MOD; anyone with a good knowledge of PHP will probably easily identify the source of this problem!

EDIT: fixed!

Thanks!

#2 sbourdon

sbourdon
  • Members
  • PipPipPip
  • Advanced Member
  • 35 posts

Posted 01 March 2006 - 02:01 PM

[!--quoteo(post=350332:date=Feb 28 2006, 02:29 PM:name=sbourdon)--][div class=\'quotetop\']QUOTE(sbourdon @ Feb 28 2006, 02:29 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
The bug is that a new topic created inside a non-moderated forum is identified with the variable topic_request_val = 1 when it should be: topic_request_val = 0.[/quote]

Fixed!

Find:
$valid_free = ( forum_request_val($forum_id) == 1 ) ? ( !empty($HTTP_POST_VARS['valid_free']) ) ? 0 : 1 : 1;

Replace with:
$valid_free = ( forum_request_val($forum_id) == 1 ) ? ( !empty($HTTP_POST_VARS['valid_free']) ) ? 0 : 1 : 0;


Now, only one bug remaining!

Posts awaiting validation will not appear within search results; they are hidden. But, the total number of non-validated messages is not susbracted from the total number of posts found.

For example, if a post awaiting validation contains the word Test and you do a search for that word on the board, you will get the following results (assuming Test only appears in that post):

1 post found:
(nothing appears below, since posts awaiting validation do not appear within search results)

In this case, what I would like to achieve is this:
0 post found
(and still, nothing appears below, since posts awaiting validation do not appear within search results)


My question is: how can I substract non-validated messages from the total number of posts found?


#3 sbourdon

sbourdon
  • Members
  • PipPipPip
  • Advanced Member
  • 35 posts

Posted 02 March 2006 - 03:43 PM

[!--quoteo(post=350609:date=Mar 1 2006, 09:01 AM:name=sbourdon)--][div class=\'quotetop\']QUOTE(sbourdon @ Mar 1 2006, 09:01 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
My question is: how can I substract non-validated messages from the total number of posts found?
[/quote]

Well, I thought about this:

# 
#-----[ OPEN ]------------------------------------------ 
#
search.php

# 
#-----[ FIND ]------------------------------------------ 
#
        $db->sql_freeresult($result);        

# 
#-----[ BEFORE, ADD ]---------------------
# 
           $tot_unvalidated = 0;
            for ($i = 0; $i < count($searchset); $i++ )
            {
                if ($searchset[$i]['validate'] == 0 ) $tot_unvalidated++;
            }

Is that OK?
And how can I substract $tot_unvalidated from $result ?

Thanks!

#4 sbourdon

sbourdon
  • Members
  • PipPipPip
  • Advanced Member
  • 35 posts

Posted 04 March 2006 - 04:06 AM

Well, maybe there's an easier way to achieve this...

Just before $word_count++ (which is about line 357 of search.php), do a query to check the validation of the post. If the post is not validated, skip the $word_count++ instruction.

Knowing that the flag is set to 1 for unapproved posts inside the validate table, could anyone tell me what the sql query should look like?


Thanks!

#5 sbourdon

sbourdon
  • Members
  • PipPipPip
  • Advanced Member
  • 35 posts

Posted 10 March 2006 - 12:05 PM

Fixed!

# 
#-----[ FIND ]----------------------------
# 
                            $sql = "SELECT m.post_id 
                                FROM " . SEARCH_WORD_TABLE . " w, " . SEARCH_MATCH_TABLE . " m 
                                WHERE w.word_text LIKE '$match_word' 
                                    AND m.word_id = w.word_id 
                                    AND w.word_common <> 1 
                                    $search_msg_only";

# 
#-----[ REPLACE WITH ]---------------------
# 
                            $sql = "SELECT m.post_id 
                                FROM " . SEARCH_WORD_TABLE . " w, " . SEARCH_MATCH_TABLE . " m, " . POSTS_TABLE . " p 
                                WHERE p.post_id = m.post_id 
                                    AND p.validate = 0 
                                    AND w.word_text LIKE '$match_word' 
                                    AND m.word_id = w.word_id 
                                    AND w.word_common <> 1 
                                    $search_msg_only";

Thanks anyway! ;)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users