View Single Post
  #3  
Old 05-19-2014, 09:58 AM
mohammad6006's Avatar
mohammad6006 mohammad6006 is offline
 
Join Date: May 2008
Location: IRAN (Tabriz)
Posts: 116
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by mokujin View Post
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 threadyou allowed create {1threads for each day in the <b>{2}</bforum]]></phrase>
            <
phrase name="chip_limitnewthreadperday_error_reply" date="1326256560" username="Chip Pro" version="1.3"><![CDATA[For anti spam replyyou allowed create {1threads 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 forumidfollow 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 enablethe 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 modEnter any usergroup here if you want disable mod for their<br />
<
br />
NoteSeparated 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 (replythat 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 threadforumid]]></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 />
NoteSeparated 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
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01273 seconds
  • Memory Usage 1,985KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete