Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 09-18-2005, 11:06 AM
Yorixz Yorixz is offline
 
Join Date: Jun 2005
Location: Netherlands
Posts: 284
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Condition for usergroups in php files

I'm hoping anyone can provide me with data of what condition I can use inside the bbcode parser (hardcoded) as condition.

Right now the only condition I've found is
Code:
if ($vbulletin->userinfo['userid'])
{
bla
} Else {
bla 
}
but what I want to do is check for the usergroup (and if it's higher than x do "bla")

Thanks for your possible reply
Reply With Quote
  #2  
Old 09-18-2005, 08:21 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hardcoding = Bad
What exactly do you want to do?
Reply With Quote
  #3  
Old 09-18-2005, 10:32 PM
Blaine0002's Avatar
Blaine0002 Blaine0002 is offline
 
Join Date: Jul 2003
Location: Wisconsin.
Posts: 1,350
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i think he wants to get the persons usergroup id,
this probably dosent work but whatever, I tried.
Code:
if ($vbulletin->userinfo['usergroupid']) > '5'
{
bla
} Else {
bla 
}
Reply With Quote
  #4  
Old 09-24-2005, 05:55 PM
Yorixz Yorixz is offline
 
Join Date: Jun 2005
Location: Netherlands
Posts: 284
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by KirbyDE
Hardcoding = Bad
What exactly do you want to do?
What I want to do is create a modification similar to what you see here on vB.org; quotes/codes not visible untill a user is in a "special" usergroup (where he gets moved to when he validated his account in some way). As this can't be done by template edits I think this is the only possible way.

Sorry for the terrible slow reply, been busy this week.
Reply With Quote
  #5  
Old 09-24-2005, 07:06 PM
Blaine0002's Avatar
Blaine0002 Blaine0002 is offline
 
Join Date: Jul 2003
Location: Wisconsin.
Posts: 1,350
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Yorixz
What I want to do is create a modification similar to what you see here on vB.org; quotes/codes not visible untill a user is in a "special" usergroup (where he gets moved to when he validated his account in some way). As this can't be done by template edits I think this is the only possible way.

Sorry for the terrible slow reply, been busy this week.
you can change the usergroup by changing the 5, this is if the persons usergroup = 5 then they view the correct page. if not, they get an error.
Code:
if ($vbulletin->userinfo['usergroupid'] == 5)
{
echo'You are in the right usergroup!'
} Else {
echo'Sorry, you cant view this page!'
}
this is if the user has a larger usergroup id than 5, they view the page
Code:
if ($vbulletin->userinfo['usergroupid'] > 5)
{
echo'You are in the right usergroup!'
} Else {
echo'Sorry, you cant view this page!'
}
is this what you wanted?
Reply With Quote
  #6  
Old 09-25-2005, 07:31 AM
Yorixz Yorixz is offline
 
Join Date: Jun 2005
Location: Netherlands
Posts: 284
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, thanks a lot for your help; I'll go try it out on my testboard.

Quote:
Originally Posted by Blaine0002
you can change the usergroup by changing the 5, this is if the persons usergroup = 5 then they view the correct page. if not, they get an error.
Code:
if ($vbulletin->userinfo['usergroupid'] == 5)
{
echo'You are in the right usergroup!'
} Else {
echo'Sorry, you cant view this page!'
}
this is if the user has a larger usergroup id than 5, they view the page
Code:
if ($vbulletin->userinfo['usergroupid'] > 5)
{
echo'You are in the right usergroup!'
} Else {
echo'Sorry, you cant view this page!'
}
is this what you wanted?
It's exactly what I want; changed it a little to my needs though; to be exact to this:

Code:
	function handle_bbcode_code($code)
	{
		global $vbulletin, $vbphrase, $stylevar, $show;

		// remove unnecessary line breaks and escaped quotes
		$code = str_replace(array('<br>', '<br />', '\\"'), array('', '', '"'), $code);
		$code = $this->strip_front_back_whitespace($code, 1);
		if ($vbulletin->userinfo['usergroupid'] > 5) /* also tried == and != etc, plainly to try it out, neither of them did what I wanted */
		{
		$code = $code;
		}
		else
		{
			$code = "You are not allowed to view codes yet";
		}
		
		if ($this->printthread)
		{
			$code = $this->emulate_pre_tag($code);
			$template = 'bbcode_code_printthread';
		}
		else
		{
			$blockheight = $this->fetch_block_height($code);
			$template = 'bbcode_code';
		}

		eval('$html = "' . fetch_template($template) . '";');
		return $html;
	}
The only problem that I've got now is; it doesn't work, for some reason it just shows the data, no matter what I try.
Reply With Quote
  #7  
Old 09-25-2005, 12:55 PM
Blaine0002's Avatar
Blaine0002 Blaine0002 is offline
 
Join Date: Jul 2003
Location: Wisconsin.
Posts: 1,350
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

sorry, im not good at php at all, try making the 5 into '5' (dont know if this will help at all.)
Reply With Quote
  #8  
Old 09-25-2005, 01:02 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Do you have post caching turned on in your vB options?
Reply With Quote
  #9  
Old 09-25-2005, 02:00 PM
Yorixz Yorixz is offline
 
Join Date: Jun 2005
Location: Netherlands
Posts: 284
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MarcoH64
Do you have post caching turned on in your vB options?
Mm, thanks, I did have it enabled - disabling it shows up the message directly, only problem now is; what's the best option. Wont disabling the cache option hammer my mysql database a lot more?
(I'm actually wondering what the way is that the code is added here at vB.org, but I doubt I'll get to know that)
Reply With Quote
  #10  
Old 09-25-2005, 04:01 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes disabling would stress your server more.
Reply With Quote
Reply

Thread Tools
Display Modes

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:33 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.04141 seconds
  • Memory Usage 2,249KB
  • 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
  • (7)bbcode_code
  • (4)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