[Request] Tabs in profile member

Discuss the development of future releases of phpBB (phpBB 3.x minor releases) and MODing/Coding related questions.
Post Reply
Dakin Quelia
New member
New member
Posts: 49
Joined: 12 Nov 2008, 01:26
Real name: Daniel
Location: Belgique

[Request] Tabs in profile member

Post by Dakin Quelia »

Hello,

I have a request. In this [url=http://phpbbmodders.net/articles/3.0/menu_from_tabs/]article[/url], we can add some tabs but I want to do it in profile member. I need this feature to separate main profile informations to custom profile fields. :)

I tried this code but it doesn't work:

Code: Select all

 <li<!-- IF SCRIPT_NAME == 'memberlist.php?mode=character' --> class="activetab"<!-- ENDIF -->><a href="{U_MEMBERLIST}" title="{L_MEMBERLIST_EXPLAIN}"><span>{L_MEMBERLIST}</span></a></li>


See you soon,
Last edited by Dakin Quelia on 02 Nov 2009, 21:02, edited 1 time in total.
Elglobo
Past Contributor
Past Contributor
Posts: 119
Joined: 15 Jul 2008, 19:42

Re: [Request] Tabs in profile member

Post by Elglobo »

Hi Dakin,

You can't do that in a template file since phpBB 3.0.4. You have to write the condition in the PHP file, and assign the template var after. Here is an example. in your PHP file:

Code: Select all

$active_tab_member&nbsp;=&nbsp;($_SERVER['SCRIPT_NAME']&nbsp;==&nbsp;'/memberlist.php?mode=character')&nbsp;?&nbsp;'&nbsp;class="activetab"'&nbsp;:&nbsp;'';&nbsp;&nbsp;&nbsp;&nbsp

Code: Select all

$template->assign_vars(array(
        'ACTIVE_TAB_SEARCH'                => $active_tab_member,&nbsp;&nbsp;&nbsp;&nbsp

Finally, in your template file you use {ACTIVE_TAB_SEARCH}.

Have a good day ;)
phpBB-Services.com: L'hébergement et l'assistance de votre forum phpBB en toute tranquillité.

Myff.fr - My First forum, créer votre forum phpBB3 facilement !
Dakin Quelia
New member
New member
Posts: 49
Joined: 12 Nov 2008, 01:26
Real name: Daniel
Location: Belgique

Re: [Request] Tabs in profile member

Post by Dakin Quelia »

Hi Elglobo,

Thanks for information but it doesn't work.

Here are my template file with tabs:

Code: Select all

<div id="tabs">
   <ul>
       <li {PROFIL_INFOS}><a href="{U_MEMBERLIST_PROFILE}" title="{L_MEMBERLIST_EXPLAIN}"><span>{L_INFO_PROFILE}</span></a></li>
       <li {CHARACTER}><a href="{U_MEMBERLIST_CHARACTER}"><span>{L_INFO_PROFILE_RP}</span></a></li>
   </ul>
</div>


;)

-Edit by Dakin Quelia-
Reason:

I tested this code and it does work. Strange, no?

Code: Select all

$profile_infos&nbsp;=&nbsp;($_SERVER['SCRIPT_NAME']&nbsp;==&nbsp;&nbsp;'/memberlist.php?mode=viewprofile')&nbsp;?&nbsp;''&nbsp;:&nbsp;'class="activetab"';&nbsp;&nbsp;&nbsp;Â


See you soon,
User avatar
Obsidian
Supporter
Supporter
Posts: 736
Joined: 13 May 2008, 15:20
Real name: Damian
Contact:

Re: [Request] Tabs in profile member

Post by Obsidian »

Be very, very careful there. Messing with $_SERVER variables unescaped is very dangerous.
Dakin Quelia
New member
New member
Posts: 49
Joined: 12 Nov 2008, 01:26
Real name: Daniel
Location: Belgique

Re: [Request] Tabs in profile member

Post by Dakin Quelia »

It used in phpBB. :)

How secure it?
User avatar
Obsidian
Supporter
Supporter
Posts: 736
Joined: 13 May 2008, 15:20
Real name: Damian
Contact:

Re: [Request] Tabs in profile member

Post by Obsidian »

It is used in phpBB, however it is used after it is cleaned of possible injects. It's usually a good idea to clean any external data, just to be on the safe side.
Dakin Quelia
New member
New member
Posts: 49
Joined: 12 Nov 2008, 01:26
Real name: Daniel
Location: Belgique

Re: [Request] Tabs in profile member

Post by Dakin Quelia »

My request is solved. But I don't know protect $_SERVER. ;)
User avatar
Obsidian
Supporter
Supporter
Posts: 736
Joined: 13 May 2008, 15:20
Real name: Damian
Contact:

Re: [Request] Tabs in profile member

Post by Obsidian »

If you're using it in a straight comparison, you should be good. However, if you have to manipulate data using it, you should probably check to see if the data matches what it should carry (this you can do with preg_match() usually). For example, the IP address -- it should be checked and filtered to verify that it /is/ an IP address.
Post Reply