[HOW TO - vB4] Adding a New Tab in Member Profile - Reloaded
1 Attachment(s)
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 [S]4.1.4[/S] 4.2,[S] but should work as far back as 4.0.8, when profile customization was reintroduced. [/S] [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.] First step To create a new member profile tab, create a plugin at hook member_complete Code:
if (isset($vbulletin->GPC['tab']))
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. Code:
<div id="view-test" class="<vb:if condition="$selected_tab == 'test'">selected_view_section<vb:else />view_section</vb:if><vb:if condition="$userinfo['userid'] != $bbuserinfo['userid']"> vm_other_prof</vb:if>">
Direct access If you want to access your custom profile tag directly, append &tab=test#testto the profile URL. That's it :) |
thank you cellarius - great article! :up:
|
Thanks :D
|
Will come in handy!
|
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.
|
It really important with me !
Great work ! (I can't like your post, why ??? :() |
I followed all the steps, but it does not work
can some one help me ? |
No, sorry, you're just giving too much information... :rolleyes:
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 [DATE]1309779783[/DATE] at [TIME]1309779783[/TIME] --------------- Quote:
|
Hello,
Im sorry for no precision :) My vbulletin version : 4.1.4 i have create a plugin at hook member_complete with this code : Code:
if (isset($vbulletin->GPC['tab'])) then i have create template custom_profile_tab_test with this code : Code:
<div id="view-test" class="<vb:if condition="$selected_tab == 'test'">selected_view_section<vb:else />view_section</vb:if><vb:if condition="$userinfo['userid'] != $bbuserinfo['userid']"> vm_other_prof</vb:if>"> |
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. |
Ok i will check all this point and come back :)
|
Awesome thanks!
|
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?
|
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. |
Question;
After creating this tab, how can you specify the USER ID of the members profile you're on? |
Try
PHP Code:
to use it in the template you would probably have to register it first. |
this might be a stupid question, but is this an area that is editable by the user? Like if said user wanted to add more to their profile such as their favorite things, etc.
|
no.
You would have to supply fields to everyone via the Admin CP -> User Profile Field Manager. You can make them optional so only users who want to fill them out have to- but they would all show under "About Me." |
Hello,
Sorry for my bad english, i'm french How to add this profile tab with php code in a file .php and not in a plugin ? Thank you |
Sorry, I don't know what you want to do. If you want to add any tabs to any php page, this is not for you.
|
Any ideas why this only works if "test" is used in the $taburl variable? If I change the #test to #quoted ($blockid var) nothing shows up.
PHP Code:
HTML Code:
<div id="view-quoted" class="<vb:if condition="$selected_tab == 'quoted'">selected_view_section<vb:else />view_section</vb:if><vb:if condition="$userinfo['userid'] != $bbuserinfo['userid']"> vm_other_prof</vb:if>"> |
What should I do to have to extra tab only be shown to certain usergroups ?
--------------- Added [DATE]1335389174[/DATE] at [TIME]1335389174[/TIME] --------------- nevermind. figured it out: if (is_member_of($vbulletin->userinfo,x,y,z)) { } in the plugin where x,y,z are the group Id's |
Alright, so I've got the "Gallery" tab added. Now how would I add the content? How can I add photos?
Also I notice that none of my blog entries are showing up under my "Blog" tab in my user profile. I am logged in and everything. |
You have the tab working - this is all this article is about.
It is not about querying whatever it is you want to show on that tab. It sure is not about general support issues (your blog tab not working). Please ask for help in your own thread in the proper forums. |
But the "Congratulations, you can see me, I'm your PHP Code!" is not appearing under the new tab I added.
Can you please help me to determine why? I had deleted some of the code in the memberinfo_block_statistics template and cleared out the code in the memberinfo_block_contactinfo template, because I did not like all of that ("Number of Posts per Day: 0.25" etc) content in my User Profile. |
If you follow the tutorial by the letter, it will be there. I cannot know what you did wrong.
|
I copied and pasted the code you showed in my AdminCP, where you told me to.
Was that what I was supposed to do? |
Article updated. Obviously the template name convention was changed somewhere along the line.
The template needs to be named memberinfo_block_test now (remember to adapt the create_template call in the plugin accordingly. |
I did it exactly as you have it, but it does the same thing......I'm wondering if it is because I had deleted some of the code in the memberinfo_block_statistics template and cleared out the code in the memberinfo_block_contactinfo template, because I did not like all of that ("Number of Posts per Day: 0.25" etc) content in my User Profile? Could that affect it at all?
|
You could always try and revert those templates.
|
How do I do that? Do I press the "Revert" button and that will do it?
|
Yes.
|
Still doesn't work......
|
I have the code from the article working in 4.2.
|
Can someone please help? I want to have this custom tab added to each person's profile, and have that tab be called "Gallery". When you click on it, it shows all the photos they've uploaded.
Then in the menu at the top of the webpage, I want to have "Gallery" and have that connect to random members' photos, possibly based on their popularity. I hope it's not too much that I'm asking... |
You'll find the code to create the tab in this article. For all the rest you'll have to create your own thread in the general forums.
|
now that i have this setup
how do i include custom fields for that tab |
Quote:
|
Quote:
@simonhind i was having your problem and i've done this Create a new plugin and choose "userprofile_create" as hook, use this php code PHP Code:
|
Is there not a way to have this new tab connect directly to the user's pictures within their profile?
|
All times are GMT. The time now is 04:06 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|