How to force post pending-approval in posting.php

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
deepkar
Registered User
Posts: 41
Joined: Thu Nov 30, 2006 3:47 am

How to force post pending-approval in posting.php

Post by deepkar » Fri Jul 22, 2016 11:46 am

Hi,
I'm trying to detect spam via a logic inside posting.php and then force that specific post to be submitted pending approval. Can someone please help me with a variable or setting I can trigger? Thanks.

User avatar
david63
Jr. Extension Validator
Posts: 14316
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: How to force post pending-approval in posting.php

Post by david63 » Fri Jul 22, 2016 12:02 pm

deepkar wrote:Can someone please help me with a variable or setting I can trigger?
From what you have posted - no.

Which event are you you using?
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 20791
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: How to force post pending-approval in posting.php

Post by RMcGirr83 » Fri Jul 22, 2016 12:05 pm

and how are you trying to "detect spam".
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

deepkar
Registered User
Posts: 41
Joined: Thu Nov 30, 2006 3:47 am

Re: How to force post pending-approval in posting.php

Post by deepkar » Fri Jul 22, 2016 12:20 pm

david63 wrote:
deepkar wrote:Can someone please help me with a variable or setting I can trigger?
From what you have posted - no.

Which event are you you using?
Not sure of the question. However, I'm looking at data inside "$message_parser->message" on submit and then applying my logic.
RMcGirr83 wrote:and how are you trying to "detect spam".
As mentioned above, I'm looking for a specific pattern in what's there in the message. (the pattern is based on what I see in most of the spam posts)

User avatar
david63
Jr. Extension Validator
Posts: 14316
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: How to force post pending-approval in posting.php

Post by david63 » Fri Jul 22, 2016 12:30 pm

deepkar wrote:Not sure of the question.
If you don't understand the question then how are you doing this?

In phpBB 3.1 you use events within extensions to manipulate your data there fore the question is - which event are you using. Once we know that then we will be in a better place to be able to answer your original question.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 20791
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: How to force post pending-approval in posting.php

Post by RMcGirr83 » Fri Jul 22, 2016 12:32 pm

Op probably wants to use the core.message_parser_check_message event but that's a guess.
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

deepkar
Registered User
Posts: 41
Joined: Thu Nov 30, 2006 3:47 am

Re: How to force post pending-approval in posting.php

Post by deepkar » Fri Jul 22, 2016 12:47 pm

Well, I think I don't understand much about extensions. I'm manually editing the code inside posting.php, after these lines:

Code: Select all

if ($submit || $preview || $refresh)
{
	$post_data['topic_cur_post_id']	= request_var('topic_cur_post_id', 0);
	$post_data['post_subject']		= utf8_normalize_nfc(request_var('subject', '', true));
	$message_parser->message		= utf8_normalize_nfc(request_var('message', '', true));

User avatar
david63
Jr. Extension Validator
Posts: 14316
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: How to force post pending-approval in posting.php

Post by david63 » Fri Jul 22, 2016 12:49 pm

The whole point of phpBB 3.1 is that you do not edit core code but use extensions
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

deepkar
Registered User
Posts: 41
Joined: Thu Nov 30, 2006 3:47 am

Re: How to force post pending-approval in posting.php

Post by deepkar » Fri Jul 22, 2016 12:58 pm

david63 wrote:The whole point of phpBB 3.1 is that you do not edit core code but use extensions
I ended up editing code because that seemed to be the only way to have a customized way of preventing SPAM. And I did not find a solid anti-spam extension that would fit my needs. (And I'm tackling human spammers)

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 20791
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: How to force post pending-approval in posting.php

Post by RMcGirr83 » Fri Jul 22, 2016 1:39 pm

Take a look at this extension which checks posts and signatures (needs an event for signatures which is why it is stated for 3.1.10-RC1 in ext file...if testing on 3.1.9 change the version in the ext.php file of the extension) on TLD's within the post. If found triggers an error.

Similar to what you are trying to accomplish only you would change the check_text function of the class.
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 49164
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: How to force post pending-approval in posting.php

Post by stevemaury » Fri Jul 22, 2016 6:26 pm

Lots easier to just stop spam registrants before they post.
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. PM or email me.

All unsolicited PMs will be ignored.

deepkar
Registered User
Posts: 41
Joined: Thu Nov 30, 2006 3:47 am

Re: How to force post pending-approval in posting.php

Post by deepkar » Mon Oct 31, 2016 8:41 am

Thanks all of you! After looking at your replies and some extensions (thanks again to RMcGirr83), I'm inclined towards using/modifying extensions. May be I will share what I edited once I see results.

Question @RMcGirr83,
Is it okay to edit the code in an existing extension and use it? Does it call home and detect a code change and complain about it?

deepkar
Registered User
Posts: 41
Joined: Thu Nov 30, 2006 3:47 am

Re: How to force post pending-approval in posting.php

Post by deepkar » Fri May 11, 2018 7:43 am

RMcGirr83 wrote:
Fri Jul 22, 2016 1:39 pm
Take a look at this extension which checks posts and signatures (needs an event for signatures which is why it is stated for 3.1.10-RC1 in ext file...if testing on 3.1.9 change the version in the ext.php file of the extension) on TLD's within the post. If found triggers an error.

Similar to what you are trying to accomplish only you would change the check_text function of the class.
Now that I'm trying to modify this extension, I'm trying to figure out how to let them submit the post and mark the post as waiting for approval (and not just throw an error preventing submission). Probably a small flag somewhere? Appreciate any pointers.

Post Reply

Return to “Extension Writers Discussion”

Who is online

Users browsing this forum: oBot and 3 guests