Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
[HOW TO - vB4] Adding a New Tab in Member Profile - Reloaded
cellarius
Join Date: Aug 2005
Posts: 1,973

Augsburg, Germany
by cellarius cellarius is offline 29 Jun 2011

This tutorial is an update of Dylanblitz' howto for older versions. Credits to him, and thanks for giving me green light for building on his ideas.

This has been tested with 4.1.4 4.2, but should work as far back as 4.0.8, when profile customization was reintroduced.
[Explanation: At least with version 4.1.8, the template name convention for profile tabs was changed. If you want to code for an earlier version, use custom_profile_tab_test as template name.]



The result will look like this:

tab.PNG

First step

To create a new member profile tab, create a plugin at hook member_complete

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

This code creates the tab and inserts it as the last tab in the row. You
  • should give the tab its own unique id. In this case, we use test. If you change it, make sure you do so everywhere in the plugin and in the template. It has to be identical everywhere
  • can add custom code to fill your tab, if the content is not static html. In that case you would only add code to the template.
  • have to register any variables you want to output in the template, if you add custom code. You will be able to call that variable by using {vb:var test_tab_content} in the template.
  • choose a name for the template you will be calling to show your tab's content.
    Note that template names are case sensitive: test is not the same as TEST or Test. Remember that in step 2!



Second step


The second step to a custom profile tab is to create a new template. It has to be the name you used in your php code to create it, in our case: memberinfo_block_test.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

This is the template for your tab content. You
  • have to adapt the id in several cases. Note that they have to be absolutely identical again.
  • can add static text and html code into the template.
  • can print the output of the variable that you saved the result of your php code in and that you registered correctly.



Direct access


If you want to access your custom profile tag directly, append &tab=test#testto the profile URL.

That's it

Last edited by cellarius; 24 May 2012 at 18:32..
Views: 14848
Reply With Quote
Comments
  #2  
Old 29 Jun 2011, 14:38
Princeton's Avatar
Princeton Princeton is offline
 
Join Date: Nov 2001
Real name: Joe Velez
thank you cellarius - great article!
__________________
Latest Articles:
Liquid Layout = Less Ad Revenue?
How to Monetize Your Site
Improve Web Page Performance
How To Write For The Web


If it needs instructions, there's room for improvement.
Give users what they actually want, not what they say they want. And whatever you do, don't give them new features just because your competitors have them!
Reply With Quote
  #3  
Old 29 Jun 2011, 14:42
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Real name: Sven
Thanks
__________________
Please note that there will be no further updates to my addons, especially they will not be upgraded for vB5. I'm leaving vB, since IB choose to go the banana-way yet again.

http://www.roma-antiqua.de
Reply With Quote
  #4  
Old 29 Jun 2011, 20:46
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
 
Join Date: Jun 2008
Real name: Joe D.
Will come in handy!
__________________
-Joe (@BirdOPrey5)
Qapla.com - Exclusive VB Mods! | Joe's Ultimate Off Topic | My Free VB "Mods"
Note - I do not read my PMs often, do not expect quick replies.
Reply With Quote
  #5  
Old 29 Jun 2011, 21:41
Pandemikk Pandemikk is offline
 
Join Date: Jul 2009
Real name: Jon
Great job. I wish this article was here when I first wanted to add a new profile tab! Would have saved me hours of headache over such a small little problem.
Reply With Quote
  #6  
Old 03 Jul 2011, 15:21
BCP Hung's Avatar
BCP Hung BCP Hung is offline
 
Join Date: May 2011
Real name: BCP Hung
It really important with me !
Great work !

(I can't like your post, why ??? )
Reply With Quote
  #7  
Old 04 Jul 2011, 09:56
tkhalbiz tkhalbiz is offline
 
Join Date: Aug 2009
I followed all the steps, but it does not work
can some one help me ?
Reply With Quote
  #8  
Old 04 Jul 2011, 11:40
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Real name: Sven
No, sorry, you're just giving too much information...

What vB version exactly are you using?
What exactly does not work?
What code did you use where?

Honestly, what help exactly do you expect on the simple statement "it does not work"? Only thing I possibly could offer on that grounds would be: fix the error, then it will.

--------------- Added 04 Jul 2011 at 11:43 ---------------

Originally Posted by Getamped 1404 View Post
(I can't like your post, why ??? )
They improved the likes system, maybe that was the problem. Feel free to try again
__________________
Please note that there will be no further updates to my addons, especially they will not be upgraded for vB5. I'm leaving vB, since IB choose to go the banana-way yet again.

http://www.roma-antiqua.de
Reply With Quote
  #9  
Old 06 Jul 2011, 07:37
tkhalbiz tkhalbiz is offline
 
Join Date: Aug 2009
Hello,
Im sorry for no precision
My vbulletin version : 4.1.4
i have create a plugin at hook member_complete
with this code :

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

i just copy past original code
then i have create template custom_profile_tab_test with this code :

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

and after i go to profile page to check new tabs but nothing to see
Reply With Quote
  #10  
Old 06 Jul 2011, 08:18
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Real name: Sven
Then you either have not activated the plugin you created, have deactivated plugins globally, created the template for the wrong style, or use a customized style where the needed template hook is not present.

Since that's, as far as I can see, the unchanged code from the firstpost, I can guarantee this works.
__________________
Please note that there will be no further updates to my addons, especially they will not be upgraded for vB5. I'm leaving vB, since IB choose to go the banana-way yet again.

http://www.roma-antiqua.de
Reply With Quote
  #11  
Old 06 Jul 2011, 08:25
tkhalbiz tkhalbiz is offline
 
Join Date: Aug 2009
Ok i will check all this point and come back
Reply With Quote
  #12  
Old 26 Jul 2011, 11:45
WorldCraft WorldCraft is offline
 
Join Date: Jun 2010
Awesome thanks!
Reply With Quote
  #13  
Old 28 Jul 2011, 14:20
John Tran John Tran is offline
 
Join Date: Jun 2011
Installed, but I have a quick question. I know I am asking this in the wrong area but I can't seem to find help anywhere. I installed this tab plugin, now I would like it to display member albums in the tab, is there anyway you can help with this?
Reply With Quote
  #14  
Old 25 Aug 2011, 14:45
n.stanley n.stanley is offline
 
Join Date: May 2011
Sorry to sound silly, but where can I find these hooks/plugins?
Is it editing a file directly, or something found within the Administration section?

Sorry..

Edit: Found it out, god bless, google.

Last edited by n.stanley; 25 Aug 2011 at 15:10.
Reply With Quote
  #15  
Old 29 Aug 2011, 10:43
n.stanley n.stanley is offline
 
Join Date: May 2011
Question;
After creating this tab, how can you specify the USER ID of the members profile you're on?
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

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


New To Site? Need Help?

All times are GMT. The time now is 13:55.

Layout Options | Width: Wide Color: