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

Reply
 
Thread Tools Display Modes
  #1  
Old 07-23-2010, 04:13 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default languageid question

Is there a variable to check for the language id or name in php?
Reply With Quote
  #2  
Old 07-23-2010, 04:21 PM
Guest190829
Guest
 
Posts: n/a
Default

Try $languageid and I also think its stored in the user's cookie, but I'm not sure off the top of my head.
Reply With Quote
  #3  
Old 07-23-2010, 04:32 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here's what I have now and it doesn't seem to be working:

Code:
if ($vbulletin->options['languageid'] == 1)

I want to check for whatever the user is using from the language dropdown in the footer, if possible.
Reply With Quote
  #4  
Old 07-23-2010, 04:36 PM
Guest190829
Guest
 
Posts: n/a
Default

Have you tried $vbulletin->userinfo['languageid'] ?
Reply With Quote
  #5  
Old 07-23-2010, 04: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

Bingo! It worked! Thank you, sir!

I tried $bbuserinfo['languageid'] earlier and it wouldn't t take. Is id1 ALWAYS English then? It seems that the 2 languages I am testing this one are id1 for English and id3 for Italian. But on the user's other site he has id4 for Italian.
Reply With Quote
  #6  
Old 07-23-2010, 04:59 PM
ForumsMods ForumsMods is offline
 
Join Date: Aug 2007
Location: Argentina
Posts: 667
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$vbulletin->userinfo['languageid'] only get the languageid which the users selected in their usercp.

If the users change the language via Quick Chooser, it will not be displayed.
Reply With Quote
  #7  
Old 07-23-2010, 05:01 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry, you are wrong on that as i just tested it and it changed according to what was selected in the language drop-down.
Reply With Quote
  #8  
Old 07-23-2010, 05:02 PM
Guest190829
Guest
 
Posts: n/a
Default

Yes, I think you can assume ID: 1 is always English, but even that may not be correct, as licenses provided in other languages may have their language as default.

Point is, since languages are imported by the forum owner, you can't assume that any ID equals a specific language, you'd have to compare the actual title.
Reply With Quote
  #9  
Old 07-23-2010, 05:04 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So, then use this?

Code:
	if ($vbulletin->userinfo['languageid'] == 'English (US)')
	{
		setlocale(LC_TIME, 'en_US.utf8');
	}
	else
	{
		setlocale(LC_TIME, $vbulletin->options['site_lifestatus_setlocale']);
	}
--------------- Added [DATE]1279908919[/DATE] at [TIME]1279908919[/TIME] ---------------

That doesn't work for the name.
Reply With Quote
  #10  
Old 07-24-2010, 02:36 PM
Guest190829
Guest
 
Posts: n/a
Default

No, you'll probably have to fetch the language title in the query dynamically with a hook; I don't have time right now to take a good look at it, but the query is in fetch_userinfo() function in functions.php
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 08:24 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.06539 seconds
  • Memory Usage 2,243KB
  • 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
  • (2)bbcode_code
  • (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
  • (6)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