[HOW TO - vB4] Adding a New Tab in Member Profile
1 Attachment(s)
If you are using anything above vB4.0.8 then refer to cellarius' updated article.
https://vborg.vbsupport.ru/showthread.php?p=2214470 I haven't seen a tutorial on doing this and I had to do it for a mod of mine, so I figured I would share. It is actually quite a bit easier to do in vb4 then it was before. You will need 4 templates and 2 plugins. You could reduce it down to 2 templates but mine is used for distribution so I have to account for all versions. First Template: This will create the tab next to About Me, Friends, etc (my_data_tab) Quote:
Second Template: The data you want to show. (my_data_data) Quote:
Third Template: This will create the tab next to About Me, Friends, etc (4.0.8+) (my_data_tab_408) Quote:
Fourth Template: The data you want to show (4.0.8+). (my_data_data_408) Quote:
Now the first plugin Hook Location: member_build_blocks_start Title: Whatever you want to call it Plugin Code PHP Code:
Hook Location: cache_templates Title: Whatever you want to call it PHP Code:
https://vborg.vbsupport.ru/attachmen...1&d=1266180760 |
Thank you. I do a lot of stuff with custom profiles and this code is nice to have.
/subscribed. I'll now look into seeing how I can get certain profilefields to appear on the new tab. |
is this article written for the latest vb 4.0.2 or is this for a different version ?
i now had my mod working on vb 4.0.1 and on vb 4.0.2 this mod is working but on every tab there is a link of the tab. so if your solution works on 4.0.2 i have to rewrite my mod :( i don't like it that vbulletin changes on every release the way things should be done. so a mod can't be use on several version's |
Quote:
I'm going to have to bite the bullet and install it on my production box. 4.0.0 only half works for me on my dev because the CMS wont allow me to use a port other then 80. 4.0.1 doesn't work at all on my dev. I'm sure 4.0.2 will be worse for me heh. |
ageurtse,
They changed the template hook names. I found the new hooks to use and it works fine on my test system. I updated the code in the original post. Let me know if you have problems with it. Wish they would at least keep the old ones for a while and let us know they're going to be gone. |
thanks 4 great work !
|
very nice.. you saved my day.. !!!
just one thing.. I thought the $show array does NOT need to be registered... $templater->register('show', $show); havent tested here yet.. but usually on other pages it does not... F. |
I wasn't sure, I haven't seen a list of what is auto registered, so I usually just register everything I need in the template.
|
well as far as I know (assume) ....
(not sure read somewhere, but sorry, cant remember where) magic globals dont need registering, like $template_hook, $show, $vboptions, $stylevar, $vbphrase not sure with $template_hook, but thats easy to test.. there might be others.. would be interesting if someone knew where to find a complete list!! F. PS: check class_core.php line: 3959 and following: public function render $template_hook and $show are 'magic globals' |
Yeah would be nice to have a list of everything. I removed the $show registration from the code, thanks for the input :)
|
How would one add tabs to a custom page instead of profile page?
|
I don't remember where I found it but there is a article or mod that shows how to add tabs to a custom page for 3.x that still works for 4.x
I just looked but I couldn't find it this time around, not sure where it's at. |
You forgot to mention that you should cache the templates used by making a plugin on the hook cache_templates containing:
PHP Code:
|
Quote:
|
Hey....thanks for the tutorial. Very useful!
Just one question for anyone out there who may know if this is possible. I'm trying to link directly to a tab in the member.php. By default, it will always load up the first tab. I want it to load a specific tab. How would I do this? If it is possible? Leonard --------------- Added [DATE]1272737152[/DATE] at [TIME]1272737152[/TIME] --------------- Worked it out... You can move the hook to member_complete and manually set the $selected_tab variable to make it select your custom tab. |
Do you know how to load the tab as AJAX like facebook? :) THanks
|
Quote:
|
tx, worked in first go..
|
Quote:
Change the first plugin to... Hook Location: member_complete Plugin Code - vb4.0.2 PHP Code:
|
is it possible to move ALBUM widget to the tabs ?
|
Quote:
I can't look at it right now though, trying to figure out what css changes they made in 4.0.8 that makes non default tabs look jacked up. |
Quote:
I'm hoping that they will implement the suggestions from DP if enough people vote. (I have no clue how that works.) Otherwise we have to bloat mods with an added template for css and a hook. |
Quote:
Might not be the best way but it's how I got it to work heh. |
looks really cool, oh btw do you know if its possible to add iframes tags in members new profile tabs so that it links to an external site of mine without directing users away from the forum? If so, can you please show me an example of how to do this?
|
Quote:
Code:
if ($vbulletin->versionnumber < "4.0.8") |
Thank you so much for this reply, I will give a try on my forum soon. ^^
|
Anyone got this working for 3.8.x?
|
Quote:
|
Quote:
this has bothered me since vb4.0.8 came out .. prevented me from upgrading .. lol I just couldn't do it I may now tho after seeing that bug reported thanks to all that help here at vb.org your all much appreciated |
Anyone tried this on VB 4.1.0? My tab was added successfully, but the content is blank. I can find the content in the browser source file, but it doesn't show in the tab.
Edit: never mind, I had a typo. |
The two 408 templates have an error in the code, there's an extra single quote (') after the word "test" in the conditionals. You'll get an error if you try to save the templates without fixing it. Once fixed it worked great on my 4.0.8.
Edit- Actually there's quite a few extra single quotes in 408 data tab as well breaking the style, it seems there's an extra single quote after each red test in the code. Once they are all removed it works well. |
I have a problem with my profile tab, when loading it it's displaying it like in the picture about the red line. When I click the "button" then it turns right into the correct color and format (below red line)
http://images.glua.info/?di=113023873364 Does anyone know what could cause that? |
Yep, the profile tabs template has changed a little in previous versions.
I would advise not to create a specific template for your tab - template nr. 1 (my_data_tab) in the tutorial is actually unnecessary. I call the standard memberinfo_tab instead and prefill the necessary variables. Saves you one template. PHP for this looks like that: PHP Code:
|
I can't get this to work. I used the above's PHP code for the plugin and the my_data_data_408 for the template.
The tab shows up fine but when I click it nothing is shown in the box. |
Have you seen my post directly over yours?
|
Yes, I used your PHP code for the plugin and the my_data_data_408 for the template.
|
Really need some help with this. It's driving me nuts that vB still hasn't a decent article on these member profile tabs.
|
++++ you +++++++ then.
|
I'm sure that this childish behaviour is going to get you LOTS of help.
|
I already tried mature and exasperated behavior to no avail. Didn't have much hope for childish, but it did lift my spirits a bit which is always a plus.
Anyway, this thread is really outdated or just full of bad code. I've managed to clean it up a little but still can not get the tab to show via its AJAX call. Going to the tab via direct link shows up fine. It's weird. Has anybody got this working yet? I'd assume so. |
All times are GMT. The time now is 11:41 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 | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|