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 01-01-2010, 12:37 AM
bouhani bouhani is offline
 
Join Date: Oct 2008
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default customized fields

Hello,

I apologize if this is a repeated question.

I created a customized field for users' profile so the users will be able to specify their gender. "This field will then appear on the "Options" page of the User CP," as stated in the CP documentation.

My question is where does this field exactly reside? I mean I was trying to use this field in a conditional statement in another template [happened to be "postbit_onlinestatus" template] so I can display different status icons based on the user's gender.

So generally, how can I use those customized fields in any template I want?

Thanks
Reply With Quote
  #2  
Old 01-01-2010, 02:50 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It should show in User CP > Edit Options

As for using it in the postbit template, it should be $post['fieldx'] where x is the field id from the Profile Field Manager.
Reply With Quote
  #3  
Old 01-01-2010, 04:38 PM
bouhani bouhani is offline
 
Join Date: Oct 2008
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Lynne for your help.

What I meant by "reside" is from programming prospective. Meaning I do not want to access it in the postbit template; instead, I want to access those fields in any template. In my case, I want to access it in the "postbit_onlinestatus" template. I tried to use it like this : $post[fieldx] but it did not work.

any help

thanks
Reply With Quote
  #4  
Old 01-01-2010, 05:12 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You should *always* take a look at the template you are try to add to or modify and see what variable name is being used there. In this case, they are using $user instead of $post. You should also aways look at the code in the php files that is parsed prior to the template being rendered so you can see what variables are available for use. You will need to see if that field is available for use in that template. So, do a search for "postbit_onlinestatus" in the files and see where the template is being rendered. (From doing a quick search, I think it is OK to use that field, but you may need to follow the function backwards.)
Reply With Quote
  #5  
Old 01-01-2010, 07:46 PM
bouhani bouhani is offline
 
Join Date: Oct 2008
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That was so helpful. It is working now; thanks a lot!
I used $user instead of $post.

Quote:
You should also aways look at the code in the php files that is parsed prior to the template being rendered so you can see what variables are available for use
Would you please explain more. How can I know which php file is being parsed before an X template? I tried to search in the php files (the ones in the include folder) for the phrase "postbit_onlinestatus" but I could find any.

Another question please, I made a new template to do a similar job as the "postbit_onlinestatus" template but to handle smaller status icons. However, I do not know ho to refer to this new template in the "postbit" template or any other template. Would please explain to me how to call a custom template from others.

I am not sure though if calling the template is the proper way or is the way how it works because in the case of postbit_onlinestatus template we are not calling the template name. The call from the postbit template is $post[onlinestatus]. So does "onlinestatus" refer to the a variable or a template?

Sorry for bothering you with all of my questions. I am a new user and I need your help.


Thanks
Reply With Quote
  #6  
Old 01-01-2010, 08:04 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You need to search in the whole upload folder, not just the includes folder. If you did, you'd find it rendered in functions_bigthree.php (which does happen to be in the includes folder, so I don't know why it didn't show up when you searched).

There are articles on how to call custom templates over in the articles forums. You should check out those forums.

If you look up where the template is evaled, you'll see it's in a function and the results of that function are assigned to $post[onlinestatus].
Reply With Quote
  #7  
Old 01-01-2010, 08:48 PM
bouhani bouhani is offline
 
Join Date: Oct 2008
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I did the search through windows 7. I might have done it on the wrong way.
I opened the file functions_bigthree.php and yes I found it. And it is only rendering the template "postbit_onlinestatus" so I am not sure if I can use another template to check the online status through it.

PHP Code:
eval('$user[\'onlinestatus\'] = "' fetch_template('postbit_onlinestatus') . '";'); 
Overall, you did help me a lot. I thanks you so much for your the great help you've been providing. I appreciate it

I might come with other questions when needed if you do not mind.

Thanks a lot
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:48 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.04289 seconds
  • Memory Usage 2,218KB
  • Queries Executed 11 (?)
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
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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