Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
  #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
  #2  
Old 10-18-2005, 01:58 AM
Kovash Kovash is offline
 
Join Date: Jan 2005
Location: Australia
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

--------------------------------------------------------------------------

I'm still not having any luck attempting to solve this myself; I've scoured the postings.php but can't find any sign of the postcount update function.

Is there a chance that the elemnts that require changing are imbedded in the dB somewhere, and if so - how can I find it?

Any help would be GREATLY appriciated. Thanks again, in advance.

- Kovash
Reply With Quote
  #3  
Old 10-18-2005, 11:18 PM
Reeve of shinra's Avatar
Reeve of shinra Reeve of shinra is offline
 
Join Date: Oct 2001
Location: NYC
Posts: 1,896
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You may want to look at the ucash hack, the 3.0 version at least could let you specify a specific amount of points a user can get per post per forum and it may be simpler trying to edit that to use a random number between 1 and 9.
Reply With Quote
  #4  
Old 10-19-2005, 12:08 AM
Chris M's Avatar
Chris M Chris M is offline
 
Join Date: Dec 2001
Location: Northampton, England
Posts: 6,186
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There are a few instances of post incrementing I have found:
One in /includes/class_dm_threadpost.php
PHP Code:
$user->set('posts''posts + 1'false); 
Two in /includes/functions_databuild.php
PHP Code:
$userdata->set('posts''posts + 1'false); 
Hope this helps

Chris
Reply With Quote
Reply

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 07:37 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.03861 seconds
  • Memory Usage 2,206KB
  • Queries Executed 13 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (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)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_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
  • 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