Jump to content

Archived

This topic is now archived and is closed to further replies.

sbourdon

Post Control / Approval MOD

Recommended Posts

Hello,

I've taken over the development of [b]Post Control[/b], 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 [b]non-moderated [/b]forum is identified with the variable [b]topic_request_val = 1[/b] when it should be: [b]topic_request_val = 0[/b].


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

[code]EDIT: fixed![/code]

Thanks!

Share this post


Link to post
Share on other sites
[!--quoteo(post=350332:date=Feb 28 2006, 02:29 PM:name=sbourdon)--][div class=\'quotetop\']QUOTE(sbourdon @ Feb 28 2006, 02:29 PM) [snapback]350332[/snapback][/div][div class=\'quotemain\'][!--quotec--]
The bug is that a new topic created inside a [b]non-moderated [/b]forum is identified with the variable [b]topic_request_val = 1[/b] when it should be: [b]topic_request_val = 0[/b].[/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 [b]non-validated[/b] messages is not susbracted from the total number of posts found.

For example, if a post awaiting validation contains the word [b]Test [/b]and you do a search for that word on the board, you will get the following results (assuming [b]Test [/b]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 [b]substract non-validated messages [/b]from the [b]total number of posts [/b]found?

Share this post


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

Well, I thought about this:

[code]#
#-----[ 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++;
            }[/code]

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

Thanks!

Share this post


Link to post
Share on other sites
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 [b]validate [/b]table, could anyone tell me what the sql query should look like?


Thanks!

Share this post


Link to post
Share on other sites
Fixed!

[code]#
#-----[ 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";
[/code]

Thanks anyway! ;)

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.