vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Users Can create their own drop down list in navbar (https://vborg.vbsupport.ru/showthread.php?t=72980)

Michael Morris 12-15-2004 10:00 PM

Users Can create their own drop down list in navbar
 
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.

jluerken 12-16-2004 09:55 PM

Sounds cool. A screenshot would be nice.

Polo 12-16-2004 10:15 PM

Thank you Michael Morris, I may use this ;)

Michael Morris 12-16-2004 10:30 PM

Quote:

Originally Posted by jluerken
Sounds cool. A screenshot would be nice.

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.

Koutaru 12-16-2004 10:31 PM

Could this be domain specific (ie it can only be your domain they link to?

Michael Morris 12-16-2004 11:09 PM

Not without major recoding. This simply takes advantage of an existing vbulletin mechanic (the url tag) and uses it to create the links for a new feature.

ericgtr 12-16-2004 11:10 PM

Quote:

Originally Posted by Koutaru
Could this be domain specific (ie it can only be your domain they link to?

Very cool, clicks install for near future use, thanks!

???`S?LV?R???` 12-17-2004 12:20 AM

nice hack

docvader 12-17-2004 12:22 AM

works nicely. Only thing I've found is that if you don't put bb codes in that box correctly, it can make your browser hang up. Otherwise, nice addition.

OrangeFlea 12-17-2004 12:54 AM

Nice Hack!!!!!!!!

(cool, you're from Enworld? We have our banner on your webring. That's awesome.)


All times are GMT. The time now is 03:09 AM.

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.01048 seconds
  • Memory Usage 1,753KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_html_printable
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete