Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-02-2002, 07:47 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Username in posts and microstats

Can anyone plaese help me with the following code? I had microstats installed and working and when I installed the username in posts hack, microstats quit working. I know the problem in the code, just not how to fix it so both of them will work. I know it can be done because they both work here.
Code:
$findwords=array(0 => '{getmicrostats}');
  $replacewords=array(0 => $microstats);
  $i=1;

  $findwords=array(0 => '{bbusername}');
  $replacewords=array(0 => "$bbuserinfo[username]<!-- auto name hack -->");
  $i=1;
  while ($var=$DB_site->fetch_array($vars) and $i++) {
    if ($var['findword']!='') {
      $findwords[$i]=$var['findword'];
      $replacewords[$i]=$var['replaceword'];
    }
  }
  $newtext=str_replace($findwords,$replacewords,$newtext);
Reply With Quote
  #2  
Old 06-03-2002, 01:17 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
  $findwords=array(0 => '{getmicrostats}', 1 => '{bbusername}');
  $replacewords=array(0 => $microstats, 1 => "$bbuserinfo[username]<!-- auto name hack -->");
  $i=1;
  while ($var=$DB_site->fetch_array($vars) and $i++) {
    if ($var['findword']!='') {
      $findwords[$i]=$var['findword'];
      $replacewords[$i]=$var['replaceword'];
    }
  }
  $newtext=str_replace($findwords,$replacewords,$newtext);
Might work.
Reply With Quote
  #3  
Old 06-03-2002, 01:36 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That did the trick, Chen. Works great! Thank you very much!

Could you just add more arrays to it as you need to then? This could come in handy. Gives me a few ideas.

Quote:
Originally posted by FireFly
Code:
  $findwords=array(0 => '{getmicrostats}', 1 => '{bbusername}');
  $replacewords=array(0 => $microstats, 1 => "$bbuserinfo[username]<!-- auto name hack -->");
  $i=1;
  while ($var=$DB_site->fetch_array($vars) and $i++) {
    if ($var['findword']!='') {
      $findwords[$i]=$var['findword'];
      $replacewords[$i]=$var['replaceword'];
    }
  }
  $newtext=str_replace($findwords,$replacewords,$newtext);
Might work.
Reply With Quote
  #4  
Old 06-03-2002, 01:49 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes you can, but make sure you increment $i every time you add a new variable.
Reply With Quote
  #5  
Old 06-03-2002, 01:52 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You mean the $i=1;, right? Ok, I can do that. Just for learning sake here, why didn't you increment it when you put both of them together then? Or does the 0 and 1 basically mean the same?

Quote:
Originally posted by FireFly
Yes you can, but make sure you increment $i every time you add a new variable.
Reply With Quote
  #6  
Old 06-03-2002, 02:10 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It could have been $i=0; before, don't know why it was set to 1.
Reply With Quote
  #7  
Old 06-03-2002, 02:34 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You could use something like this for an Easter Egg sort of thing, couldn't you? Like if you do the word {Boofo} it could put almost anything in the message post (from the postbit variables). For instance you could do {location} and have it bring up their location variable. Am I going in the right direction on this or am I way off track again?
Reply With Quote
  #8  
Old 06-03-2002, 02:37 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think that might have been from the microstats code and when I added the user name in post hack, it also had the 1 in it. At least I got to the point I knew what piece of code was messing up. Maybe I am learning something (although not significant), huh?

Quote:
Originally posted by FireFly
It could have been $i=0; before, don't know why it was set to 1.
Reply With Quote
  #9  
Old 06-03-2002, 02:46 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I just noticed something that I'm not sure has anything to do with the code you gave me, but if I delete a message with the username in post hack in it, it gives me the errorid message. It goes ahead and deletes it, I just get the error after it says the message was successfully deleted. Any idea what might be causing that? Or how I can fix it?
Reply With Quote
  #10  
Old 06-03-2002, 02:52 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't think my hack is causing that.
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 05:21 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.06796 seconds
  • Memory Usage 2,262KB
  • 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
  • (3)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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