Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Users Can create their own drop down list in navbar Details »»
Users Can create their own drop down list in navbar
Version: 1.00, by Michael Morris Michael Morris is offline
Developer Last Online: Jun 2009 Show Printable Version Email this Page

Version: 3.0.3 Rating:
Released: 12-15-2004 Last Update: Never Installs: 34
 
No support by the author.

This hack is part of Lesson #6 of my Using the PHPINCLUDE_START template" tutorial thread. It is presented here individually. While techinically a user feature, it is put here with mini-mods since it requires no code edits. Instead you have 2 template edits: navbar and phpinclude_start. You must also add a user profile field.

For a more complete explaination of the code please visit the tutorial thread.

AND NOW THE HACK...

To begin create a user profile field that is multiple text lines and has a character limit of at least 2000. Note the user profile field # the system assigns to the new field - you'll need it below.

Once you do that crack into your navbar and look for this code:

HTML Code:
			<!-- nav buttons bar -->
				<div align="center">
					<table class="thead" cellpadding="0" cellspacing="0" border="0" width="100%" align="center">
						<tr align="center">
							<if condition="$show['popups']">
Immediately after add.

HTML Code:
								<if condition="!empty($mylinks)">
									<td id="mylinks" class="vbmenu_control"><a href="#mylinks">My Links</a> <script type="text/javascript"> vbmenu_register("mylinks"); </script></td>		
								</if>
Next look for this code in the navbar

HTML Code:
	<!-- / NAVBAR POPUP MENUS -->
Immediately above it insert the following code

HTML Code:
<if condition="!empty($mylinks)">
<!-- My Links Menu -->
	<div class="vbmenu_popup" id="mylinks_menu" style="display:none"> 
 		<table cellpadding="4" cellspacing="1" border="0"> 
			$mylinks
		</table> 
	</div>
<!-- /My Links -->
</if>
Now insert the following into PHPINCLUDE_START at either the very start or the very end.

PHP Code:
if (!empty($bbuserinfo['fieldX']))
    {
    require_once(
'./includes/functions_bbcodeparse.php');
    
$mylinks parse_bbcode2($bbuserinfo['fieldX'], 0001);
    
$mylinks str_replace('<br />'''$mylinks);
    
$mylinks str_replace('</a>''</a></td></tr>'$mylinks);
    
$mylinks str_replace('<a''<tr><td class="vbmenu_option"><a'$mylinks);    
    } 
You will need to plug the correct user profile field # into the spot occupied by "fieldX" above. So if your new profile field created above was field #9 you'd refer to $bbuserinfo['field9']

And with that you're done. Enjoy.

Compatibility Note
If you are running a version of vbulletin prior to version 3.0.3 you'll need to run a database query in order to have field lengths longer than 250 characters. This query is:

ALTER TABLE userfield MODIFY COLUMN fieldX TEXT

You'll need to change fieldX to the field# appropriate to your forums.

Supporters / CoAuthors

Show Your Support

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

Comments
  #22  
Old 12-18-2004, 02:44 PM
SVTOA SVTOA is offline
 
Join Date: Oct 2002
Location: In a fishbowl
Posts: 301
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have been comparing the code between vBAdvanced homepage and VBA CMPS, and began to play with the index.php files for both. I took this bit of code from vbAdvanced homepage:

Code:
if ($vboptions['home_navbar'])
{
	eval('$navbar = "' . fetch_template('navbar') . '";');
	
	$navbar = str_replace(
	array(
		'"memberlist.php',
		'"usercp.php',
		'"register.php',
		'"faq.php',
		'"calendar.php',
		'"search.php',
		'"login.php',
		'"forumdisplay.php',
		'"profile.php',
		'"private.php',
		'"subscription.php',
		'"member.php',
		'"online.php',
		'"clientscript',
		'\'misc.php',
		"$vboptions[bbtitle]</strong>"
	), 
	array(
		"\"$vboptions[bburl]/memberlist.php",
		"\"$vboptions[bburl]/usercp.php",
		"\"$vboptions[bburl]/register.php",
		"\"$vboptions[bburl]/faq.php",
		"\"$vboptions[bburl]/calendar.php",
		"\"$vboptions[bburl]/search.php",
		"\"$vboptions[bburl]/login.php",
		"\"$vboptions[bburl]/forumdisplay.php",
		"\"$vboptions[bburl]/profile.php",
		"\"$vboptions[bburl]/private.php",
		"\"$vboptions[bburl]/subscription.php",
		"\"$vboptions[bburl]/member.php",
		"\"$vboptions[bburl]/online.php",
		"\"$vboptions[bburl]/clientscript",
		"'$vboptions[bburl]/misc.php",
		"$vboptions[hometitle]</strong>"
	), $navbar);
}
and went to the CMPS index.php and inserted it directly below this:

Code:
require_once('./global.php');
Renamed the page as test.php and called it up in my browser. This "my links" hack started working on that page.
The ratio of php-to-mysql and page load time changed very little, if any.
I get no errors either. Is this an acceptable fix or have I introduced bad code into the CMPS page?
Reply With Quote
  #23  
Old 12-18-2004, 03:10 PM
SVTOA SVTOA is offline
 
Join Date: Oct 2002
Location: In a fishbowl
Posts: 301
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Michael Morris
Two added.

Note, minor glitch found for RC4 - you can't have user input fields beyond 500 characters or so (odd). I presume this is fixed in later versions.
Ugh, I think I have to give up on this one. In 3.0.0:

"Maximum Input (Input, Textarea only)
This setting is how many characters a user is allowed to enter into this field. This can be any number between 1 and 250."

Nice idea but it's not working out like I had hoped.
Reply With Quote
  #24  
Old 12-18-2004, 07:37 PM
Michael Morris's Avatar
Michael Morris Michael Morris is offline
 
Join Date: Nov 2003
Location: Knoxville TN
Posts: 774
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SVTOA
Ugh, I think I have to give up on this one. In 3.0.0:

"Maximum Input (Input, Textarea only)
This setting is how many characters a user is allowed to enter into this field. This can be any number between 1 and 250."

Nice idea but it's not working out like I had hoped.
I'm pretty sure you can run a query to override this - run the query after the table is created.
Reply With Quote
  #25  
Old 12-18-2004, 07:41 PM
SVTOA SVTOA is offline
 
Join Date: Oct 2002
Location: In a fishbowl
Posts: 301
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

And that query would be?
Reply With Quote
  #26  
Old 12-18-2004, 07:46 PM
Michael Morris's Avatar
Michael Morris Michael Morris is offline
 
Join Date: Nov 2003
Location: Knoxville TN
Posts: 774
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Testing it now - Such things can royally mess up a board if done incorrectly

BTW, 3.0.3 allows you to set any length.
Reply With Quote
  #27  
Old 12-18-2004, 08:12 PM
Michael Morris's Avatar
Michael Morris Michael Morris is offline
 
Join Date: Nov 2003
Location: Knoxville TN
Posts: 774
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The correct query is..

ALTER TABLE userfield MODIFY COLUMN fieldX TEXT

You need to change fieldX to the actual field # you're going to use.

PS you can use this script to up the lengths of the other profile fields, such as biography, if you want.
Reply With Quote
  #28  
Old 12-18-2004, 08:24 PM
SVTOA SVTOA is offline
 
Join Date: Oct 2002
Location: In a fishbowl
Posts: 301
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you for the followup, if this works then the hack becomes extremely useful to me and my members. Will check back in a bit.
Reply With Quote
  #29  
Old 12-18-2004, 08:27 PM
Jaxx Jaxx is offline
 
Join Date: Mar 2003
Location: Seattle, Wa
Posts: 102
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice Michael.

Along the same lines as the msg I sent you, just got to figure out how to get the actual links to work in the profile view if other members look at it.

I know I could keep it a private field, but whats the fun in that.
Reply With Quote
  #30  
Old 12-18-2004, 08:35 PM
SVTOA SVTOA is offline
 
Join Date: Oct 2002
Location: In a fishbowl
Posts: 301
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

BRAVO!!!! Worked perfectly!!! Much appreciated!!!!

SVTOA clicks *INSTALL*
Reply With Quote
  #31  
Old 12-27-2004, 08:12 PM
wirewolf's Avatar
wirewolf wirewolf is offline
 
Join Date: Jun 2004
Location: New York City
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Michael, very nice hack. Installed it today and it went smoothly. However, I have the "Links Directory v1.0.0 RC3" by vBadvanced installed on my forum. All of the "links" directory scripts call for their links_config.php file, which in turn calls for the vbulletins' global.php file, where the PHPINCLUDE_START is called. The "links" templates also call for the vbulletin $navbar. But the "My Links" drop down does not show when you go to the Links Directory Pages. I suspect it has to do with the PHPINCLUDE_START not being called apon correctly in the "links" files, but I'm not sure. I'm not getting any errors. The "Links Directory" files are in a separate directory within my main forum directory.
/home/vbforum/links

See the two attachments. Any clue where to start looking?
Thanks, John
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 06:53 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.04645 seconds
  • Memory Usage 2,325KB
  • Queries Executed 26 (?)
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
  • (2)bbcode_code
  • (4)bbcode_html
  • (1)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete