Approval MOD

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.

Rating:

Excellent!
13
65%
Very Good
5
25%
Good
2
10%
Fair
0
No votes
Poor
0
No votes
 
Total votes: 20

User avatar
RMcGirr83
Former Team Member
Posts: 22016
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Approval MOD

Post by RMcGirr83 »

Welcome to my world :roll:
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beer Image
User avatar
Zaid
Registered User
Posts: 590
Joined: Thu Nov 08, 2007 2:06 pm
Location: South Pacific Ocean

Re: Approval MOD

Post by Zaid »

RMcGirr83 wrote:Welcome to my world :roll:
can i get a response in your phpinstallers of my predefined question :oops: as i think i m being ignored :?
tsunamix83
Registered User
Posts: 5
Joined: Fri Nov 30, 2007 10:06 pm

Re: Approval MOD

Post by tsunamix83 »

Is it possible to send an email to that particular user when his/her post/topic got approved?
I tried to do that just putting a php mail() statement to somewhere in the code but couldn't figure it out.
Any help is appreciated.
User avatar
uncle.f
Registered User
Posts: 253
Joined: Thu Mar 25, 2004 11:42 am
Location: Purple Yonder
Contact:

Re: Approval MOD

Post by uncle.f »

tsunamix83 wrote:Is it possible to send an email to that particular user when his/her post/topic got approved?
I tried to do that just putting a php mail() statement to somewhere in the code but couldn't figure it out.
Any help is appreciated.
It is possible of course with some code addition. To do it right you need to use the mailing class that comes with phpBB similarly to how it is done in functions_approve.php for moderator notification.
tsunamix83
Registered User
Posts: 5
Joined: Fri Nov 30, 2007 10:06 pm

Re: Approval MOD

Post by tsunamix83 »

uncle.f wrote:It is possible of course with some code addition. To do it right you need to use the mailing class that comes with phpBB similarly to how it is done in functions_approve.php for moderator notification.
I don't know where to put the additional code. I want email to go to the user after moderator click on the approve button. Can you show me where to put it?

If there is anyone done this before it would be so nice to have the code also.
thanks
User avatar
uncle.f
Registered User
Posts: 253
Joined: Thu Mar 25, 2004 11:42 am
Location: Purple Yonder
Contact:

Re: Approval MOD

Post by uncle.f »

tsunamix83 wrote:I want email to go to the user after moderator click on the approve button. Can you show me where to put it?
First of all you need to create a template for your e-mail that will go out to your users.
You should call the template approved_notify.tpl and place the template in the following directory (this is an example for an English template):

language/lang_english/email/approved_notify.tpl

The contents of the file should be similar to the following (do not touch the variable names in the curly braces):

Code: Select all

Subject: {SITENAME} Post Approval Notification
Charset: iso-8859-1

Hello,

This is an automated message from {SITENAME}.
Your post post in the forum '{FORUM_NAME}' has been approved.
(full post text can be found below)

------------------------------------------------------------------------------
Topic title: {TOPIC_TITLE}
Message subject: {POST_SUBJECT}

{POST_TEXT}
------------------------------------------------------------------------------

{EMAIL_SIG}
Such a template must be created for every language you have installed on your board and placed into the appropriate lang_... directory.

Now open the file includes/functions_approve.php and find the following piece of code:

Code: Select all

        message_die(GENERAL_ERROR, "Error while updating user's post counter", '', __LINE__, __FILE__, $sql);
        }
}
Insert the code between the two closing curly braces like that:

Code: Select all

        message_die(GENERAL_ERROR, "Error while updating user's post counter", '', __LINE__, __FILE__, $sql);
        }
        ...your additional code here...
}
And the code to insert is the following:

Code: Select all

        global $board_config, $phpbb_root_path, $phpEx, $lang;

        if ($post_info['poster_id'] != ANONYMOUS)
        {
                $sql = "SELECT user_email, user_lang FROM " . USERS_TABLE . " WHERE user_id = " . $post_info['poster_id'] . " AND user_active <> 0 ";
                if ( !($result = $db->sql_query($sql)) )
                {
                        message_die(GENERAL_ERROR, 'Could not query poster information', '', __LINE__, __FILE__, $sql);
                }

                $userinfo = $db->sql_fetchrow($result);
                $db->sql_freeresult($result);
                
                if ($userinfo['user_email'] != '')
                {
                        include_once($phpbb_root_path . 'includes/emailer.'.$phpEx);
                        $emailer = new emailer($board_config['smtp_delivery']);
                        $emailer->from($board_config['board_email']);
                        $emailer->replyto($board_config['board_email']);

                        $emailer->assign_vars(array(
                                'EMAIL_SIG' => $board_config['board_email_sig'] ? strip_tags(str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig'])) : '',
                                'SITENAME' => $board_config['sitename'],
                                'FORUM_NAME' => $post_info['forum_name'],
                                'TOPIC_TITLE' => stripslashes(trim($post_info['topic_title'])),
                                'POST_SUBJECT' => stripslashes(trim($post_info['post_subject'])),
                                'POST_TEXT' => stripslashes(trim($post_info['post_text']))
                        ));

                        $emailer->use_template('approved_notify', $userinfo['user_lang']);
                        $emailer->email_address($userinfo['user_email']);
                        $emailer->send();
                        
                        $emailer->reset();
                }
        }
tsunamix83
Registered User
Posts: 5
Joined: Fri Nov 30, 2007 10:06 pm

Re: Approval MOD

Post by tsunamix83 »

Thank you very much for the help but I am using the old version. It doesn't has anything like this:

Code: Select all

message_die(GENERAL_ERROR, "Error while updating user's post counter", '', __LINE__, __FILE__, $sql);
User avatar
uncle.f
Registered User
Posts: 253
Joined: Thu Mar 25, 2004 11:42 am
Location: Purple Yonder
Contact:

Re: Approval MOD

Post by uncle.f »

tsunamix83 wrote:Thank you very much for the help but I am using the old version.
You could have mentioned that from the start! :evil: :evil:

If you mean the Approval MOD version 1.0 then the code you need to locate in the file includes/functions_approve.php is the following:

Code: Select all

$sql  = "UPDATE " . TOPICS_TABLE . " SET " . $topic_sql . " WHERE topic_id = $topic_id";
	if (!$db->sql_query($sql))
	{
		message_die(GENERAL_ERROR, 'Error while updating topic approval info', '', __LINE__, __FILE__, $sql);
	}
        ...... insert new code here ......
}
But there is no guarantee it will fully work as I have neither means nor will to test it on the old version of the Approval MOD
imlek
Registered User
Posts: 27
Joined: Fri Jun 14, 2002 5:46 am

This board has no forums

Post by imlek »

Hello,

I just installed this Approval Mod 2.0.0.
I can login to Admin panel. But there is an error on my board.

The error message: "This board has no forums"

But I can see all my forums at the Admin panel.

Please help me.

Thank you and warm regards
imlek
Registered User
Posts: 27
Joined: Fri Jun 14, 2002 5:46 am

Re: This board has no forums

Post by imlek »

Fixed it. :)

I made a typo when entering the code to index.php. :)

Great Mod. :) :)

Thanks alot.
imlek wrote:Hello,

I just installed this Approval Mod 2.0.0.
I can login to Admin panel. But there is an error on my board.

The error message: "This board has no forums"

But I can see all my forums at the Admin panel.

Please help me.

Thank you and warm regards
stefane321
Registered User
Posts: 5
Joined: Sat Feb 09, 2008 5:48 am

Re: Approval MOD

Post by stefane321 »

hello,

I installed the Approval MOD

I got this error:

Code: Select all

Parse error: syntax error, unexpected T_BOOLEAN_OR in /home/etaupoli/public_html/forum/viewtopic.php on line 1051
Code of line 1051:

Code: Select all

        if ( $userdata['user_id'] == $poster_id && $is_auth['auth_delete'] && $forum_topic_data['topic_last_post_id'] == $postrow[$i]['post_id'] || $allowed_to_approve && $postrow[$i]['post_approve'])
Can you help me please?

Thanks!
ChunkyBananas
Registered User
Posts: 5
Joined: Wed Oct 24, 2007 5:22 am

Re: Approval MOD

Post by ChunkyBananas »

This is a fantastic mod! thanks a bundle! :D

I have this installed with the Last Topic Title on Index mod, and it didn't work with the straight included fix.
Looks like it leaves a missing open parens after the FROM in index.php. It gave me an sql syntax error on the forum index until I changed the FROM (((... to FROM ((((...
Figured I'd let ya'll know :)


I'm sorry if I missed it, but has anyone found a way to allow the poster to view his/her own post while its approval is pending - but still hidden to everyone else?
I've had instances where the member will continue trying to post the same message, thinking their connection timed out or something.
babuyagu
Registered User
Posts: 3
Joined: Tue Feb 19, 2008 4:52 pm

Re: Approval MOD

Post by babuyagu »

uncle.f wrote:
bugfixed wrote: Ok problem solved.

but now other category there is same problem :(
(wrong values)


The SQL queries above should have fixed the whole board. If this is not the case, then I am afraid wrong values are being written into the tables when posts are made / deleted. This means that the MOD was installed incorrectly. Most likely editing error.

I said it million times before and I will say it again. Please use EasyMOD instead of manual editing.
It is REALLY easy and error free.
Thanks for a great mod -do you have any indication which piece of code could be causing this post reporting error? I have installed on a heavily modded board and therefore cannot us EasyMOD and all works perfectly apart from the post and comment counts (only in approval required forums). Link.
User avatar
uncle.f
Registered User
Posts: 253
Joined: Thu Mar 25, 2004 11:42 am
Location: Purple Yonder
Contact:

Re: Approval MOD

Post by uncle.f »

stefane321 wrote:hello,

I installed the Approval MOD

I got this error:

Code: Select all

Parse error: syntax error, unexpected T_BOOLEAN_OR in /home/etaupoli/public_html/forum/viewtopic.php on line 1051
Code of line 1051:

Code: Select all

        if ( $userdata['user_id'] == $poster_id && $is_auth['auth_delete'] && $forum_topic_data['topic_last_post_id'] == $postrow[$i]['post_id'] || $allowed_to_approve && $postrow[$i]['post_approve'])
The code that you quoted is 100% correct. That is how that line should look after the Approval MOD installation. What I wonder is why your line number is 1051. If you installed the Approval MOD using EasyMOD on a virgin phpBB 2.0.22, the line number should be actually 1055. So either you have more MODs installed that modified this file and could cause a conflict OR you did not use EasyMOD to install the Approval MOD (and very likely made a typo somewhere earlier in that file).

You can mail me the complete viewtopic.php file if you wish and I can compare it with mine. I can do it for you only if you have no other MODs installed that modified the viewtopic.php file.
User avatar
uncle.f
Registered User
Posts: 253
Joined: Thu Mar 25, 2004 11:42 am
Location: Purple Yonder
Contact:

Re: Approval MOD

Post by uncle.f »

ChunkyBananas wrote:I have this installed with the Last Topic Title on Index mod, and it didn't work with the included fix. Looks like it leaves a missing open parens after the FROM in index.php.
Figured I'd let ya'll know :)
Thanks a lot for reporting this problem! Indeed a bug in the "fix" file. I will include the revised fix with the next update!
ChunkyBananas wrote:I'm sorry if I missed it, but has anyone found a way to allow the poster to view his/her own post while its approval is pending - but still hidden to everyone else?
This functionality is included in the MOD. The only catch is that you need to make sure the "Hide unapproved posts" option is deactivated for the required forum. This way the posts will be displayed as "waiting for approval" for everybody, except the moderators and the user who posted it.

If you do activate the "Hide unapproved posts" option, then the extended message is displayed right after the post has been made notifying the user that his/her post will NOT be visible until approved. This message is displayed for 10 seconds instead of usual 3.
Post Reply

Return to “[2.0.x] MOD Database Releases”