Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
Prev Previous Post   Next Post Next
  #1  
Old 10-15-2005, 01:41 PM
Kovash Kovash is offline
 
Join Date: Jan 2005
Location: Australia
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Post Count - Adding Random Numbers

Ok, strange modification that is kinda specific to the 'needs' of my forum.

Originally when I was running vB2, I had a friendly user who made us a modification where when you posted, instead of adding a single number to your postcount, it added a random number between a pre-defined range (set in the AdminCP individually for each forum.)

This was used for role-play purposes (Simulated a DBZ 'Powerlevel', each time you post it increases considerably, instread of adding one - just a for a bit of 'realism'.) and worked really great for the better half of two years.

We have since moved server and updated to vB 3.5.0 while we were at it... Unfortunately, the user who made the modifications is now unavailable and unable to make similar changes for vB3; since no one else has any idea how it was done, we're at a loss.

So, as my second request, I was wondering if anyone could help me?


Side Note: It would also be cool if we could create a seperate variable to keep track off (added to in the same way, but stored in the db seperately from the postcount) so we can keeptrack of and display both, but it's not really nessecary (we don't use postcount for anything), just something nice to have.


Edit: Oops, forgot the pre-emptory thanks... so... Thanks in advance

Edit2: Oh, I also have access to the complete db.sql (nearly 200mb >_<) and all the forum files from the old forum vB2 (though it IS still up at the moment, we are waiting for him to take it down) so if you need those for reference perhaps, I can hand them over.

- Kovash

PHP Code:
            // Update User Post Counts
            
if (!empty($userbyuserid))
            {
                
$userbypostcount = array();
                foreach (
$userbyuserid AS $postuserid => $postcount)
                {
                    
$alluserids .= ",$postuserid";
                    
$userbypostcount["$postcount"] .= ",$postuserid";
                }
                foreach (
$userbypostcount AS $postcount => $userids)
                {
                    
$postcasesql .= " WHEN userid IN (0$userids) THEN $postcount";
                }

                
$db->query_write("
                    UPDATE " 
TABLE_PREFIX "user SET
                        posts = posts + CASE 
$postcasesql ELSE 0 END
                    WHERE userid IN (0
$alluserids)
                "
);
            }

            break; 
I found that in 'postings.php' while I was looking to see if I could fix my problem myself, so I looked up the same php file in our old forum but didn't find anything that INCREASED the postcount, only a decrement - I only thought that might be usefual information because the person who set up the random allocation also set it to subtract the same (random) amount from user if their post was deleted.

PHP Code:
  // decrement users post counts
  
$posts=$DB_site->query("SELECT postid FROM post WHERE threadid='$threadid'");
  while (
$post=$DB_site->fetch_array($posts)) {
    if (
$deletepost[$post[postid]]=="yes") {
      
deletepost($post[postid],$foruminfo[countposts]);
    } else {
      
$deletethread=0;
    }
  } 
I don't know if this is helpful or not :/
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:42 PM.


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.04772 seconds
  • Memory Usage 2,361KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (4)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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_threadedmode.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete