Recent Topics

You can only post a new comment every 30 seconds.

Started by on Nov 24, 2018 – Contents updated: Nov 25, 2018

Nov 24, 2018 04:28    

OK. The documentation is literally horrible.
I see only the admin gets 2 comment options when replying. The other comment block isn't there for Mods and Admins. Love to change that.

So, in the final testing phase I post a comment as a member and get "You can only post a new comment every 30 seconds.". Hour of searching and an hour of getting the same message.
This is nuts! Every setting is buried somewhere funky in the backend.

So how can I fix the "You can only post a new comment every 30 seconds."

Affected website URL :https://mikesandsharisdirt.com/b2e
Exact b2evolution version number :6.10.4-stable

Nov 24, 2018 04:29

Sorry, I meant for Mods and Users.

Nov 24, 2018 11:03

Say no more about the documentation lol

I've haven't seen an option to change the 30sec rule but as you indicate being able to change it seems reasonable with a warning about spammers and misuse. I'll check out the back end and files etc.

Nov 24, 2018 11:55

Been checking files and searched for similar see https://forums.b2evolution.net/topic-7641 but this didn't work when I tried it.

1) there is no such section and variable

	/**
	* Minimum interval (in seconds) between consecutive comments from same IP
	* @global int $minimum_comment_interval
	*/
	$minimum_comment_interval = 30;

2) adding and setting at 32 for a test did nothing, so still looking

Nov 24, 2018 13:18

Been checking the database and no luck at finding it there so far so thinking again it is set in a file ??

Nov 24, 2018 14:53

Look at [/plugins/_basic_antispam.plugin.php]

if( $last_comment_time = $DB->get_var( $SQL ) )
			{	// If last comment is found from current IP or email address:
				$last_comment_time = mysql2date( 'U', $last_comment_time );
				$new_comment_time = mysql2date( 'U', date( 'Y-m-d H:i:s', $localtimenow ) );
				if( ( $new_comment_time - $last_comment_time ) < $min_comment_interval )
				{	// Block new comment because of minumum interval:
					$this->msg( sprintf( T_('You can only post a new comment every %d seconds.'), $min_comment_interval ), 'error' );
					if( $comment_Item )
					{
						syslog_insert( sprintf( 'The comment can be posted only every %d seconds', $min_comment_interval ), 'info', 'item', $comment_Item->ID, 'plugin', $this->ID );
					}
					// Exit here to don't spend a time to next checking:
					return;
				}

Trying to find where $min_comment_interval is set, but could override it in this section

Nov 24, 2018 15:24

Ok for now you can edit the above plugin by adding a line after 219

		$min_comment_interval = $this->Settings->get( 'min_comment_interval' );
		$min_comment_interval = 6;

or so that only logged in users get the quick comment option, if you allow open comments, as otherwise more open to spam

$min_comment_interval = $this->Settings->get( 'min_comment_interval' );
			
 if(isset($current_User) )
   {
   $min_comment_interval = 6;
   }

EDIT

The second code that checked if the user was logged in didn't work so I'll get back on that

Yes that's weird works fine if I use if(isset($current_User) ) i.e user is not set ??

Not a problem for me as I don't allow comments except from logged in users so I don't need the if clause. Maybe $current_User isn't global ??

Nov 24, 2018 16:04

OK this seems to work and getting a new comment up and posted in less than 10 seconds is a bit much

$min_comment_interval = $this->Settings->get( 'min_comment_interval' );
		
if (is_logged_in());
   {
   $min_comment_interval = 16;
   }

Bet there's an easier way of doing this but this does revert to 30 secs if someone is not a logged in user

Nov 24, 2018 23:58

Thanks will play with that.
Changing cms's causes brain damage.

Nov 25, 2018 00:48

Found it phew!

Over the years the options have become so multifarious that they are difficult to keep track of, as you indicated better documentation would help, which is updatable via comments from users.

Also many users are looking for quick answers and do not search much so lucky there is this forum.


Form is loading...

Multi-blog engine – This forum is powered by b2evolution CMS, a complete engine for your website.