vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Give Users +10 postcount when they post a thread (https://vborg.vbsupport.ru/showthread.php?t=54581)

Moreland 06-21-2003 10:04 AM

Give Users +10 postcount when they post a thread
 
Very Simple I presume

Just how do I do it ? I dont want to add any reward things or anything like that, just simple give users +10 posts if they post a thread.

Thanks :)

PS: also when i delete the thread it needs to -10 postcounts from the user that started it.

I am using VB 2.3.0

Chris M 06-21-2003 11:08 AM

Open root/newthread.php
Find:
Code:

          $DB_site->query("UPDATE user SET
          ".iif ($foruminfo[countposts],"posts=posts+1,","")."
          $dotitle"."lastpost='".time()."' WHERE userid='$bbuserinfo[userid]'");
      }

Replace with:
Code:

          $DB_site->query("UPDATE user SET
          ".iif ($foruminfo[countposts],"posts=posts+10,","")."
          $dotitle"."lastpost='".time()."' WHERE userid='$bbuserinfo[userid]'");
      }

Open admin/functions.php
Find:
Code:

    if (is_array($userpostcount)) {
      while(list($postuserid,$subtract)=each($userpostcount)) {
        $DB_site->query("UPDATE user SET posts=posts$subtract WHERE userid='$postuserid'");
      }
    }

add below:
Code:

    if (!empty($userpostcount)) {
        $DB_site->query("UPDATE user SET posts=posts-9 WHERE userid='$postuserid'");
    }

:)

It says [high]-9[/high], as the query above it will reduce the user's post count for the amount of posts in that thread that they made, so the first post will be counted as 1 post, so to make it remove 10 you have to subtract the 1 which was already removed, leaving you with 9 to remove afterwards;) I have also made it check that the User's post count is not 0, and if it is, it will not run that query...

It should all work:)

Satan

Moreland 06-21-2003 11:36 AM

Satan thanks alot :) I will do that and let you know what happens

Moreland 06-21-2003 11:47 AM

Works :D thanks

Chris M 06-22-2003 03:42 AM

No problemos:)

Satan


All times are GMT. The time now is 11:11 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01232 seconds
  • Memory Usage 1,715KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete