View Full Version : Member.php default tab
TheAdminMarket
10-08-2014, 03:49 PM
Hello,
Using the hook profile_tabs_first I've created a page tab with some extra user info. So far so good. As expected, it appears as first tab.
The problem is that all core links to member.php redirect to "My Activity" tab. I thought that by placing my custom tab first the links will open the 1st tab. But not.
Anyone knows how to set as default tab my custom tab? Manually changing the links to:
member.php?u={vb:raw userid}&tab=mycustomtab#mycustomtab
works fine, but it's almost impossible to change all core links.
Thank you
Maybe you need to make your tab the default tab. In the navigation table there's a state field, and one of the bits says the tab is the default. Look in admin/navigation.php, where it does if ($_REQUEST['do'] == 'dodefault'), and maybe also in includes/functions_navigation.php.
TheAdminMarket
10-08-2014, 04:26 PM
Maybe you need to make your tab the default tab.
First of all thank you for your prompt attention. Really appreciated. I gave a look at navigation.php but I got a feeling that this file is for the site's navigation tabs, while I'm talking for the user's profile tabs.
Oops, you're right, sorry. I saw "Activity" and thought you meant the navigation tab.
TheAdminMarket
10-08-2014, 04:29 PM
See the attached screenshot to understand for which tabs I'm talking about.
OK, in member.php there's this code:
if ($vbulletin->GPC['vmid'] AND !$vbulletin->GPC['tab'])
{
$vbulletin->GPC['tab'] = 'visitor_messaging';
}
So maybe if you set $vbulletin->GPC['tab'] to your tab at hook member_execute_start. Like:
if (!$vbulletin->GPC['tab'])
{
$vbulletin->GPC['tab'] = 'my_tab';
}
Edit: ...or maybe you also need to check $vbulletin->GPC['vmid'] like the code above. I don't know what that is.
TheAdminMarket
10-08-2014, 04:53 PM
I'll check your suggestion and I'll come back. Meanwhile I was checking the template MEMBERINFO and I found something that can helps, but still haven't tested it.
{vb:raw template_hook.profile_tabs_first}
<vb:if condition="$blocks[activitystream]"><dd<vb:if condition="$selected_tab == 'activitystream' OR $selected_tab == ''"> class="userprof_module" <vb:else /> class="userprof_moduleinactive" </vb:if>><a id="activitystream-tab" href="{vb:link member, {vb:raw userinfo}, "tab=activitystream"}#activitystream" onclick="return tabViewPicker(this);">{vb:raw activity_phrase}</a></dd></vb:if>
That OR $selected_tab == ''" I think that it makes the tab "My Activity" to be default. Tried to remove it but I got parsing error when during saving. I'll give one more try.
--------------- Added 1412791348 at 1412791348 ---------------
Unfortunatelly your solution does not works, so I need to try with the template. That:
$vbulletin->GPC['vmid']
means (most probably) "Visitor Message Id"
Unfortunatelly your solution does not works, so I need to try with the template. That:
$vbulletin->GPC['vmid']
means (most probably) "Visitor Message Id"
That makes sense. So what that code does is go to the visitor message tab if the url has a vmid. So you wouldn't want to check for a vmid, but it seems like you should be able to set $vbulletin->GPC['tab'] to a default.
TheAdminMarket
10-08-2014, 05:40 PM
but it seems like you should be able to set $vbulletin->GPC['tab'] to a default.
I don't know if I must laught or cry.
To laught because from no solution we've in hands 2 solutions. Yours is better as PHP modification is easier than template. But the template also works.
To cry because even if my tab becomes default, it does not shows data. Just a blank tab. The funny is that if I click another tab and then come back to my tab it shows the data.:confused:
TheAdminMarket
10-12-2014, 06:05 AM
Anyone??
Lynne
10-12-2014, 04:50 PM
I am unsure what the current status is. You are able to set the default to your tab but the data is blank? Can we get a link to view the problem?
Fields
10-15-2014, 12:30 PM
Why you don't use an add-on like Ozzy's here:
https://vborg.vbsupport.ru/showthread.php?t=302655
TheAdminMarket
10-19-2014, 05:10 AM
@Fields
Unfortunately, does not works even with that Mod, but thank you for your help.
@Lynne
I've some doubts sharing the link as it's an Adult Dating (but 100% NOT porn site). But as it currently has only 2-3 fake profiles for testing, in case that you don't have moral problems for the content, the link is:
http://www.xxx24.gr/member.php?3-Rene&tab=dating#dating
The tab uses the hook: member_complete and the template hook: profile_tabs_first. I also removed from the activity tab the code that makes it presected if there is no "&tab=...." in the link.
As you can see by clicking the link, the tab opens normally as first tab, but it does not has content. Click any other tab and then back to mine and you'll see that funny issue. The content is there now. Maybe the hook: member_complete is wrong and seems that I must use another one. Don't really know.
ozzy47
10-19-2014, 08:50 AM
Try with the template hook, profile_tabs instead.
TheAdminMarket
10-19-2014, 09:33 AM
I'm already using profile_tabs as master template hook for the content. The template hook profile_tabs_first is for the position of the tab. See me code below:
require_once(DIR . '/includes/class_postbit.php');
require_once(DIR . '/includes/functions_user.php');
require_once(DIR . '/dating/includes/functions.php');
if (isset($vbulletin->GPC['tab']))
{
$selected_tab = $vbulletin->GPC['tab'];
}
$blockinfo['title'] = $vbphrase["erotic_profile"];
$blockid = "dating";
$taburl = $memberurl = fetch_seo_url('member', $prepared) . "&tab=dating#dating";
// Drawing the Tab
$templater = vB_Template::create('memberinfo_tab');
$templater->register('selected_tab', $selected_tab);
$templater->register('relpath', $relpath);
$templater->register('blockinfo', $blockinfo);
$templater->register('blockid', $blockid);
$templater->register('taburl', $taburl);
$template_hook['profile_tabs_first'] .= $templater->render();
// Page Template
$templater = vB_Template::create('microdating_profile_tab');
.....
$template_hook['profile_tabs'] .= $templater->render();
--------------- Added 1413716087 at 1413716087 ---------------
Looking in my code again, I got a feeling that I've did something just the opposite. The code must be on the hook profile_tab_first and the tab in the profile_tabs.
ozzy47
10-19-2014, 11:38 AM
No it looks right, try profile_tabs_last instead of first.
TheAdminMarket
10-19-2014, 01:52 PM
The code below was missing from the actual tab code that's why content didn't appeared on the first access.
$templater->register('selected_tab', $selected_tab);
So now I can have my tab as first, I can see the content when I'm accessing the profile page with &tab=dating#dating but I can't make it to be default even using Ozzy's mod.
I edit the template memberinfo:
From:
<vb:if condition="$selected_tab == 'activitystream' OR $selected_tab == ''">
To:
<vb:if condition="$selected_tab == 'activitystream'">
to avoid Activity tab to be preselected when $selected_tab == ''. I also added this condition to my own link. Nothing :( Still the Activity tab is preselected (but not highlighted).
What frustates me mostly is that vB uses globally the displayorder feature. From forums to Navigation Manager. Was so big deal to add such feature for profile tabs?
--------------- Added 1413730930 at 1413730930 ---------------
Edited: I clear the browser's cache and now I've one more strange issue. My tab appears preselected (but not highlighted) but if you see carefully you'll find the activity report about my data. In simple words in one tab there is content of 2 tabs :rolleyes:
http://www.xxx24.gr/member.php?3-Rene
--------------- Added 1413732196 at 1413732196 ---------------
Ok, Fixed after removing some code changes to member.php that I've did on the early suggestions here. Also Ozzy's mod helped me to determine the correct hook.
Instead to post the full solution here, I prefer to post an Article for those who maybe are interest to add their own tab as first tab and make it preselected. It should be a full article for building a tab. Otherwise if you've the tab ready and you just want to make it preselected, Ozzy's mod (https://vborg.vbsupport.ru/showthread.php?t=302655) does the work fine.
Thank you all for your help.
--------------- Added 1413735496 at 1413735496 ---------------
Here is the full Article for those who maybe interest for building a new tab from scratch.
https://vborg.vbsupport.ru/showthread.php?p=2519390
Lynne
10-19-2014, 03:26 PM
I'm glad you got it working.
@Lynne
I've some doubts sharing the link as it's an Adult Dating (but 100% NOT porn site). But as it currently has only 2-3 fake profiles for testing, in case that you don't have moral problems for the content, the link is:
http://www.xxx24.gr/member.php?3-Rene&tab=dating#dating
LOL. You should *see* some of the sites that we have to view as Support Staff. I no longer look too closely at the content and focus only on the problem and that way my delicate sensibilities are not offended. :D :D :D
Ok, Fixed after removing some code changes to member.php that I've did on the early suggestions here.
Glad you got it working finally. Just for the record, if you're refering to my suggestions, I never meant to suggest that you should make any changes to member.php, only that you shoud look at that code to see what a plugin would need to do. Sorry if I wasn't clear enough.
TheAdminMarket
10-19-2014, 03:49 PM
LOL. You should *see* some of the sites that we have to view as Support Staff. I no longer look too closely at the content and focus only on the problem and that way my delicate sensibilities are not offended. :D :D :D
Glad to know that except of very helpful person you're having good sense of humor:p Well, unlike you, once that I was on a same position I found myself walking on that the site for some hours, I created a profile and finally I got out forgeting at all that I was there to check an issue :D Men...... same all around the world :P
--------------- Added 1413737563 at 1413737563 ---------------
Glad you got it working finally. Just for the record, if you're refering to my suggestions, I never meant to suggest that you should make any changes to member.php, only that you shoud look at that code to see what a plugin would need to do. Sorry if I wasn't clear enough.
NOOO !!! Sorry if you got this meaning. My English is not the best and sometimes misunderstandings can come up easily. Be sure that before your suggestions I already had did some tests. It's true that I tested your suggestions, but this in no way means that you've any responsibility for it. Finally you spent your valuable time trying to help me.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.