Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Your Users Post As Random Users Details »»
Your Users Post As Random Users
Version: 1.02, by TCM TCM is offline
Developer Last Online: Sep 2009 Show Printable Version Email this Page

Version: 3.0.7 Rating:
Released: 03-31-2005 Last Update: Never Installs: 1
Template Edits
 
No support by the author.

Hi, this is my first time posting a "hack", so please tell me if I've done something horribly wrong.

This is a hack I made mainly for as an April fools joke for my board. You select certain users, and whenever anyone posts, the post is listed as if it was posted by one of those users, chosen at random. On my boards, we chose the users Somebody, Nobody and Anybody.

The code goes in the PHP_INCLUDE_START template. Selecting which users you want it to pick from is easy, you just add and remove array entries. For example, if I wanted it to pick from the users "Joe" and "Bob", who have userids 3 and 4, I would enter ...
PHP Code:
        $randomuserchoice[1] = array(
            
'userid' => 3,
            
'username' => "Joe");

        
$randomuserchoice[2] = array(
            
'userid' => 4,
            
'username' => "Bob"); 
... where the users are chosen. The full code, with the above example users used, is as follows:
PHP Code:
// vvvvvvvvvvvvv The Computer Mutt's Post As Random User Hack vvvvvvvvvvvvv

    
if ((($_POST['do'] == 'postthread') and ($_POST['sbutton'] == 'Submit New Thread'))
    or ((
$_POST['do'] == 'postreply') and ($_POST['sbutton'] == 'Submit Reply'))
    or ((
$_POST['do'] == 'postreply') and ($_POST['sbutton'] == 'Post Quick Reply')))
    {
        
$bodies = array();

        
// Chose Users To Select From
         // The userid will determine who the post appears to be from in the thread,
         // The username will determine who the post appears to be from when you're looking at a list a threads (search, browsing forums, forumhome)
        
$randomuserchoice[1] = array(
            
'userid' => 3,
            
'username' => "Joe");

        
$randomuserchoice[2] = array(
            
'userid' => 4,
            
'username' => "Bob");

        
$randomuser rand(1,count($randomuserchoice));
        
$bbuserinfo['userid'] = $randomuserchoice[$randomuser]['userid'];
        
$bbuserinfo['username'] = $randomuserchoice[$randomuser]['username'];
    }
// ^^^^^^^^^^^^^ The Computer Mutt's Post As Random User Hack ^^^^^^^^^^^^^ 
If you want to add conditions to when this will apply, such as only applying it to certain users, or only in a given forum, you'd (obviously) just create an if statement and wrap it around all of the code.

You don't need to use real userids and usernames. When I wanted things to be really crazy, I used ...
PHP Code:
        $randomuserchoice[1] = array(
            
'userid' => rand(1208),
            
'username' => "Someone"); 
... 208 being the number of users my board had at the time, so each post would be given to a random user, but would appear as "Someone" while browsing threads.

My members got a kick out of this, I hope you and yours do to.
-The Computer Mutt

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #22  
Old 04-01-2005, 06:08 PM
GamerzWorld's Avatar
GamerzWorld GamerzWorld is offline
 
Join Date: Aug 2003
Posts: 263
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

// vvvvvvvvvvvvv The Computer Mutt's Post As Random User Hack vvvvvvvvvvvvv

if ((($_POST['do'] == 'postthread') and ($_POST['sbutton'] == 'Submit New Thread'))
or (($_POST['do'] == 'postreply') and ($_POST['sbutton'] == 'Submit Reply'))
or (($_POST['do'] == 'postreply') and ($_POST['sbutton'] == 'Post Quick Reply')))
{

if ($bbuserinfo['userid'] != 1 || $bbuserinfo['userid'] != 2){ //Put the exempt IDs in here
$bodies = array(171);

$randomuserchoice[1] = array(
'userid' => 1272,
'username' => "Dawolf");

$randomuserchoice[2] = array(
'userid' => 1273,
'username' => "Wayne");

$randomuserchoice[3] = array(
'userid' => 783,
'username' => "Joyfull");

$randomuserchoice[4] = array(
'userid' => 794,
'username' => "Cbc");

$randomuserchoice[5] = array(
'userid' => 797,
'username' => "OpelisGay");

$randomuser = rand(1,count($randomuserchoice));
$bbuserinfo['userid'] = $randomuserchoice[$randomuser]['userid'];
$bbuserinfo['username'] = $randomuserchoice[$randomuser]['username'];
}
}
// ^^^^^^^^^^^^^ The Computer Mutt's Post As Random User Hack ^^^^^^^^^^^^^
Reply With Quote
  #23  
Old 04-01-2005, 06:20 PM
fly fly is offline
 
Join Date: Oct 2003
Posts: 1,215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am at a loss for why it doesn't work then. I have turned it off on my board, so I can't test anything.

If you just take out one of the IDs, does it work? The $bbuserinfo stuff HAS to be cached by the time it gets to the php_include (I think, LOL).
PHP Code:
if ($bbuserinfo['userid'] != 1){ //Put the exempt IDs in here 
And I suck at coding, what does the $bodies = array(171); do?
Reply With Quote
  #24  
Old 04-01-2005, 07:19 PM
TCM TCM is offline
 
Join Date: Dec 2004
Location: 3.6.8
Posts: 75
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by flypaper
For quick reply to work, make the IF statement say:

PHP Code:
if ((($_POST['do'] == 'postthread') and ($_POST['sbutton'] == 'Submit New Thread'))
    or ((
$_POST['do'] == 'postreply') and ($_POST['sbutton'] == 'Submit Reply'))
    or ((
$_POST['do'] == 'postreply') and ($_POST['sbutton'] == 'Post Quick Reply'))) 
Why does it have to check the button at all though?
I'm not certain, I think it's required to make sure the user can't access anything else of the randomly selected user's. I'll update with the quick-reply change.

@ Flypaper: Isn't you code saying if the user isn't user one OR isn't user two, so it would allow it for all users?

PHP Code:
if (($bbuserinfo['userid'] != 1) AND ($bbuserinfo['userid'] != 2)){ 
This is how I would do it. I'm steal fairly new at this, but I think it's correct.
Reply With Quote
  #25  
Old 04-01-2005, 07:27 PM
fly fly is offline
 
Join Date: Oct 2003
Posts: 1,215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Since we're checking to see if its not equal to, either AND or OR would work. I think... LOL

Do I fail at basic logic?
Reply With Quote
  #26  
Old 04-01-2005, 07:43 PM
TCM TCM is offline
 
Join Date: Dec 2004
Location: 3.6.8
Posts: 75
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by flypaper
Since we're checking to see if its not equal to, either AND or OR would work. I think... LOL

Do I fail at basic logic?
I'm user 1.

Am I not user one? No.
Am I not user two? Yes.

If there are any yeses, it will be executed. So it will run for every member.

Yes, you fail at basic logic.
Reply With Quote
  #27  
Old 04-01-2005, 07:52 PM
fly fly is offline
 
Join Date: Oct 2003
Posts: 1,215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well that explains why it didn't work. LOL
Reply With Quote
  #28  
Old 11-28-2007, 04:28 PM
rnmcd rnmcd is offline
 
Join Date: Aug 2004
Posts: 399
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Has there been anything similar to this mod that works with 3.6.8?
Reply With Quote
  #29  
Old 11-28-2007, 06:12 PM
fly fly is offline
 
Join Date: Oct 2003
Posts: 1,215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rnmcd View Post
Has there been anything similar to this mod that works with 3.6.8?
Should be pretty simple to do, I'd think...
Reply With Quote
  #30  
Old 11-28-2007, 06:26 PM
rnmcd rnmcd is offline
 
Join Date: Aug 2004
Posts: 399
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by flypaper View Post
Should be pretty simple to do, I'd think...
How could it be pretty simple when you couldn't even get it to work in the original version?
Reply With Quote
  #31  
Old 11-28-2007, 09:08 PM
fly fly is offline
 
Join Date: Oct 2003
Posts: 1,215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rnmcd View Post
How could it be pretty simple when you couldn't even get it to work in the original version?
ZING!

I've learned a little since then (or maybe anyway). I had the code at work, but didnt have a chance to test it before I left.
Reply With Quote
Reply


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 10:47 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.07018 seconds
  • Memory Usage 2,333KB
  • Queries Executed 27 (?)
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
  • (6)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete