Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Probobly simle question. Details »»
Probobly simle question.
Version: , by DonLKSAB DonLKSAB is offline
Developer Last Online: Mar 2020 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 01-03-2003 Last Update: Never Installs: 0
 
No support by the author.

Hi dudes.

I have a simple question ( I hope )
I have added a new "User Profile Field" called Nick.
Now i want to use it to find a rank in my Db.

The DB looks like this:

Table Name: stats_individual
Rows: name , rank

What i need is to display the "rank" under "posts" in the postbit using the "nick" the user provided in the CP.

I have tried to edit the postbit but i cant get it to work :-(
My test:

Location: $post[field2]
Posts: $post[posts]
Rank: SELECT rank FROM stats_individual WHERE name=$post[field5]

That dident work ( Not that i actualy belived that it would )
Any ideas?

/DonLKSAB

Show Your Support

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

Comments
  #2  
Old 01-03-2003, 04:46 PM
DrkFusion's Avatar
DrkFusion DrkFusion is offline
 
Join Date: Nov 2001
Posts: 1,926
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Woa what you said is confusing :-p
SELECT rank FROM stats_individual WHERE name=$post[field5]
Will not work in the post biut
You may want to try putting in the showthread.php
PHP Code:
$ranking $DB_site->query_first("SELECT rank FROM stats_individual WHERE name='$post[field5]'"); 
That should select the field rank where the name is whatever

I am still bit confused on what you want, but try that.
Also then in the postbit
put
Rank: $ranking[rank]
Reply With Quote
  #3  
Old 01-03-2003, 08:10 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@Arunan: Thank would create an extra query for each post!!
It would work you are right, but one more query per post is not good

@Don:
open showthread.php find:
PHP Code:
    FROM post
    
".iif($forum[allowicons],'LEFT JOIN icon ON icon.iconid=post.iconid','')."
    
LEFT JOIN user ON user.userid=post.userid
    LEFT JOIN userfield ON userfield
.userid=user.userid 
DIRECTLY after that lines put this line:
PHP Code:
   LEFT JOIN stats_individual ON (stats_individual.name=userfield.field5
then few lines above there is this part:
PHP Code:
post.*,post.username AS postusername
change ti to:
PHP Code:
post.*,stats_individual.rank,post.username AS postusername
then you can use $post[rank] in your postbit template
Reply With Quote
  #4  
Old 01-03-2003, 09:41 PM
DonLKSAB DonLKSAB is offline
 
Join Date: Dec 2001
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well both look good.
But non of them work :-(

I dont get any errors or any indication that something is wrong.
It simply dont display anything.

/DonLKSAB
Reply With Quote
  #5  
Old 01-03-2003, 09:44 PM
DrkFusion's Avatar
DrkFusion DrkFusion is offline
 
Join Date: Nov 2001
Posts: 1,926
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by Xenon
@Arunan: Thank would create an extra query for each post!!
It would work you are right, but one more query per post is not good

@Don:
open showthread.php find:
PHP Code:
    FROM post
    
".iif($forum[allowicons],'LEFT JOIN icon ON icon.iconid=post.iconid','')."
    
LEFT JOIN user ON user.userid=post.userid
    LEFT JOIN userfield ON userfield
.userid=user.userid 
DIRECTLY after that lines put this line:
PHP Code:
   LEFT JOIN stats_individual ON (stats_individual.name=userfield.field5
then few lines above there is this part:
PHP Code:
post.*,post.username AS postusername
change ti to:
PHP Code:
post.*,stats_individual.rank,post.username AS postusername
then you can use $post[rank] in your postbit template
ur rite...lost my mind, because I didn't tell him where to put it either lol.

That above should work.
Reply With Quote
  #6  
Old 01-03-2003, 09:53 PM
DonLKSAB DonLKSAB is offline
 
Join Date: Dec 2001
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ahh.
There were 2 places in Showtread to change.
One in the begining and one in the end :-)

Now it works.
Thanks dudes.

/DonLKSAB
Reply With Quote
  #7  
Old 01-04-2003, 09:58 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default



you're welcome

@Arunan: , as long as i saw where you wanted to put it, and could give a better advice it's ok
I remember my own first small hacks to showthread.php, without the microstats hack i always thought all is good ^^
Reply With Quote
  #8  
Old 01-04-2003, 02:41 PM
DrkFusion's Avatar
DrkFusion DrkFusion is offline
 
Join Date: Nov 2001
Posts: 1,926
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hehe, thanks Xenon You have been teaching me new things alot, and they are coming in handy alot too. For that I thank you!

Whenever you need anything...anything at all, my pm box/email inbox are open
Reply With Quote
  #9  
Old 01-04-2003, 03:15 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default


you're always welcome

hmm, yeah i need time, but i'm sure you can't send it to me right?

well, maybe i'll find something in future.
it's enough to see you've learned a lot so you could help others
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 11:10 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.04990 seconds
  • Memory Usage 2,302KB
  • Queries Executed 22 (?)
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
  • (9)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (8)postbit
  • (9)postbit_onlinestatus
  • (9)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_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