Quote:
Originally Posted by mokujin
Change query to this, maybe it works.
PHP Code:
SELECT COUNT(postid) AS count
FROM " . TABLE_PREFIX . "post
WHERE dateline > " . $start_day . "
AND threadid = " . $threadinfo['threadid'] . "
AND userid = " . $vbulletin->userinfo['userid'] . "
|
not work
this is full code of plugin :
https://vborg.vbsupport.ru/showthread.php?t=270797
PHP Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<product productid="chip_limitnewthreadperday" active="1">
<title>Chiplove.9xpro - Limit new thread/post per day</title>
<description>Limit new thread/post created per day</description>
<version>1.3</version>
<url />
<versioncheckurl />
<dependencies>
</dependencies>
<codes>
</codes>
<templates>
</templates>
<plugins>
<plugin active="1" executionorder="5">
<title>Limit replies</title>
<hookname>newpost_process</hookname>
<phpcode><![CDATA[#<?
if($vbulletin->options['chip_limitnewthreadperday_turn']
AND !in_array($vbulletin->userinfo['usergroupid'], explode(',', $vbulletin->options['chip_limitnewthreadperday_excludegroups']))
AND !in_array($vbulletin->userinfo['userid'], explode(',', $vbulletin->options['chip_limitnewthreadperday_usersexcluded']))
){
if($limted_reply = $vbulletin->options['chip_limitnewthreadperday_limitreply'])
{
$total = $vbulletin->db->query_first("
SELECT COUNT(postid) AS posts
FROM ".TABLE_PREFIX."post
WHERE parentid != 0
AND userid = ".$vbulletin->userinfo['userid']."
AND dateline > ".mktime(0,0,0, date('n'), date('j'), date('Y'))."
AND dateline < ".mktime(23,59,59, date('n'), date('j'), date('Y'))."
");
if($total['posts'] > $limted_reply)
{
$dataman->errors[] = fetch_error('chip_limitnewthreadperday_error_reply', $limted_reply);
}
}
}]]></phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>Check first form</title>
<hookname>newthread_start</hookname>
<phpcode><![CDATA[#<?php
if($vbulletin->options['chip_limitnewthreadperday_turn']
AND !in_array($vbulletin->userinfo['usergroupid'], explode(',', $vbulletin->options['chip_limitnewthreadperday_excludegroups']))
AND !in_array($vbulletin->userinfo['userid'], explode(',', $vbulletin->options['chip_limitnewthreadperday_usersexcluded']))
){
$start_day = strtotime(date('d-m-Y'));
//total
if($vbulletin->options['chip_limitnewthreadperday_total']){
//check
$check = $db->query_first("
SELECT COUNT(threadid) AS count
FROM ".TABLE_PREFIX."thread
WHERE dateline > " .$start_day. "
AND postuserid = ".$vbulletin->userinfo['userid']."
");
if($check['count'] >= $vbulletin->options['chip_limitnewthreadperday_total'])
{
eval(standard_error(fetch_error('chip_limitnewthreadperday_error', $vbulletin->options['chip_limitnewthreadperday_total'], '(all box)')));
}
}
//advance
if($vbulletin->options['chip_limitnewthreadperday_advopturn'] && trim($vbulletin->options['chip_limitnewthreadperday_advop']))
{
$lines = explode(PHP_EOL, $vbulletin->options['chip_limitnewthreadperday_advop']);
foreach($lines as $line)
{
list($forumids, $limited) = explode('|', $line);
if(in_array($foruminfo['forumid'], array_map('intval',explode(',', $forumids))))
{
$check = $db->query_first("
SELECT COUNT(threadid) as count
FROM ".TABLE_PREFIX."thread
WHERE dateline > " .$start_day. "
AND forumid = ".$foruminfo['forumid']."
AND postuserid = ".$vbulletin->userinfo['userid']."
");
if($check['count'] >= intval($limited))
{
eval(standard_error(fetch_error('chip_limitnewthreadperday_error', intval($limited), $foruminfo['title_clean'])));
}
}
}
}
//normal
if($vbulletin->options['chip_limitnewthreadperday_normal'] > 0)
{
$check = $db->query_first("
SELECT COUNT(threadid) as count
FROM ".TABLE_PREFIX."thread
WHERE dateline > " .$start_day. "
AND forumid = ".$foruminfo['forumid']."
AND postuserid = ".$vbulletin->userinfo['userid']."
");
if($check['count'] >= $vbulletin->options['chip_limitnewthreadperday_normal'])
{
eval(standard_error(fetch_error('chip_limitnewthreadperday_error', $vbulletin->options['chip_limitnewthreadperday_normal'], $foruminfo['title_clean'])));
}
}
}]]></phpcode>
</plugin>
</plugins>
<phrases>
<phrasetype name="Error Messages" fieldname="error">
<phrase name="chip_limitnewthreadperday_error" date="1298051638" username="Chip Pro" version="1.0"><![CDATA[For anti spam thread, you allowed create {1} threads for each day in the <b>{2}</b> forum]]></phrase>
<phrase name="chip_limitnewthreadperday_error_reply" date="1326256560" username="Chip Pro" version="1.3"><![CDATA[For anti spam reply, you allowed create {1} threads for each day ]]></phrase>
</phrasetype>
<phrasetype name="vBulletin Settings" fieldname="vbsettings">
<phrase name="setting_chip_limitnewthreadperday_advop_desc" date="1316795378" username="Chip Pro" version="1.2"><![CDATA[If you want to disable this option or modified for each forumid, follow this example.<br>
<b>Forumid1,forumid2</b>|<b>limited</b><br>
Ex:<Br>
5,6,7|3<br>
123|7]]></phrase>
<phrase name="setting_chip_limitnewthreadperday_advop_title" date="1316795378" username="Chip Pro" version="1.2" />
<phrase name="setting_chip_limitnewthreadperday_advopturn_desc" date="1316795378" username="Chip Pro" version="1.2"><![CDATA[If you enable, the below option will be active]]></phrase>
<phrase name="setting_chip_limitnewthreadperday_advopturn_title" date="1316795378" username="Chip Pro" version="1.2"><![CDATA[Enable advanced option]]></phrase>
<phrase name="setting_chip_limitnewthreadperday_excludegroups_desc" date="1326255796" username="Chip Pro" version="1.2"><![CDATA[If this option empty, all user groups will be affected by this mod. Enter any usergroup here if you want disable mod for their<br />
<br />
Note: Separated by comma]]></phrase>
<phrase name="setting_chip_limitnewthreadperday_excludegroups_title" date="1326255796" username="Chip Pro" version="1.2"><![CDATA[Exclude User Groups]]></phrase>
<phrase name="setting_chip_limitnewthreadperday_limitreply_desc" date="1316795378" username="Chip Pro" version="1.2"><![CDATA[The number of posts (reply) that member can be create per day<br /><br />
Set this value to 0 to disable this option]]></phrase>
<phrase name="setting_chip_limitnewthreadperday_limitreply_title" date="1316795378" username="Chip Pro" version="1.2"><![CDATA[Limit replies]]></phrase>
<phrase name="setting_chip_limitnewthreadperday_normal_desc" date="1316795378" username="Chip Pro" version="1.2"><![CDATA[Number of threads that member can create during the day for each forums <br />
Default: 5<br /><br />
Set this value to 0 to disable this option]]></phrase>
<phrase name="setting_chip_limitnewthreadperday_normal_title" date="1316795378" username="Chip Pro" version="1.2"><![CDATA[Limit thread/ forumid]]></phrase>
<phrase name="setting_chip_limitnewthreadperday_total_desc" date="1316795378" username="Chip Pro" version="1.2"><![CDATA[Total threads member can create per day (in all forums).<br /><br />
Set this value to 0 to disable this option]]></phrase>
<phrase name="setting_chip_limitnewthreadperday_total_title" date="1316795378" username="Chip Pro" version="1.2"><![CDATA[Total thread limited perday]]></phrase>
<phrase name="setting_chip_limitnewthreadperday_turn_desc" date="1316795378" username="Chip Pro" version="1.2"><![CDATA[Choose "yes" if you want enable this hack]]></phrase>
<phrase name="setting_chip_limitnewthreadperday_turn_title" date="1316795378" username="Chip Pro" version="1.2"><![CDATA[Enable or disable]]></phrase>
<phrase name="setting_chip_limitnewthreadperday_usersexcluded_desc" date="1326255603" username="Chip Pro" version="1.2"><![CDATA[User list will not affected by this mod<br /><br />
Note: Separated by comma]]></phrase>
<phrase name="setting_chip_limitnewthreadperday_usersexcluded_title" date="1326255603" username="Chip Pro" version="1.2"><![CDATA[Exclude Users]]></phrase>
<phrase name="settinggroup_chip_limitnewthreadperday" date="1316795378" username="Chip Pro" version="1.2"><![CDATA[Chiplove.9xpro - Limit new thread/post per day]]></phrase>
</phrasetype>
</phrases>
<options>
<settinggroup name="chip_limitnewthreadperday" displayorder="65535">
<setting varname="chip_limitnewthreadperday_turn" displayorder="10">
<datatype>boolean</datatype>
<optioncode>yesno</optioncode>
<defaultvalue>1</defaultvalue>
</setting>
<setting varname="chip_limitnewthreadperday_excludegroups" displayorder="11">
<datatype>free</datatype>
</setting>
<setting varname="chip_limitnewthreadperday_total" displayorder="15">
<datatype>number</datatype>
<defaultvalue>20</defaultvalue>
</setting>
<setting varname="chip_limitnewthreadperday_normal" displayorder="20">
<datatype>number</datatype>
<defaultvalue>5</defaultvalue>
</setting>
<setting varname="chip_limitnewthreadperday_advopturn" displayorder="30">
<datatype>boolean</datatype>
<optioncode>yesno</optioncode>
<defaultvalue>0</defaultvalue>
</setting>
<setting varname="chip_limitnewthreadperday_advop" displayorder="40">
<datatype>free</datatype>
<optioncode>textarea</optioncode>
</setting>
<setting varname="chip_limitnewthreadperday_limitreply" displayorder="50">
<datatype>number</datatype>
<defaultvalue>100</defaultvalue>
</setting>
<setting varname="chip_limitnewthreadperday_usersexcluded" displayorder="60">
<datatype>free</datatype>
<defaultvalue>1</defaultvalue>
</setting>
</settinggroup>
</options>
<helptopics>
</helptopics>
<cronentries>
</cronentries>
<faqentries>
</faqentries>
</product>
i want limit post in thread per day
this have limit thread for forum
forumid|limit
and i want :
threadid|limit