PDA

View Full Version : profile field


Sketch
01-07-2003, 02:39 AM
Trying to add a hidden extra profile field to my global nav bar so clients can login to their cpanel account. (See link at http://forum.hostareus.com)

Thing is not all customers will have entered their domain (not the same as their profile website address...this is an extra profile field called Domain). If they have entered a doain, I want to enter http://domainname.com/cpanel as the link. If they haven't I want to NOT display the cpanel link.

Question is, I guess, what's the best way to get that field on that global nav bar?

Aaron

okrogius
01-07-2003, 10:39 AM
if you want to display the link globally then you can make good use of the phpinclude template.

Include in it: (note: not sure if the customfieldx is the proper name)


if ( empty($bbuserinfo[customfieldx]) ) {
$cpanelLogin = '';
} else {
$cpanelLogin = $bbuserinfo[customfieldx] . ':2082';
}


Then you can use $cpanelLogin in all of your templates. No code changes are needed.

Sketch
01-07-2003, 12:54 PM
I follow you but customfield5 doesn't work... :(

Sketch
01-07-2003, 01:44 PM
ok, figured it our...$bbuserinfo[field5] ;)

Anyways, see http:forum.hostareus.com to see wha tI mean.

This is the code I'm using in phpinclude:

if ( empty($bbuserinfo[field5]) ) {
$cpanelLogin = '';
} else {
$cpanelLogin = "<a class='topnav' href='http://$bbuserinfo[field5]:2082'>cPanel</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp . ':2082'";
}

This is a portion of the code in the header:
<!-- toplinks -->
<a class="topnav" href="http://$cpanelLogin">cPanel</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp
<a class="topnav" href="usercp.php?s=$session[sessionhash]">Profile</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
<a class="topnav" href="register.php?s=$session[sessionhash]&action=signup">Register</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;

There's 2 problems here:

1) No cpanel link is supposed to be displayed if profile field 5 is blank.

2) that link is supposed to link to THEIRDOMAIN:2082. Instead it points to the page the user is on...

Any clues whats going on?

Sketch
01-08-2003, 01:30 PM
come on, anybody?

okrogius
01-08-2003, 03:53 PM
Try this:


if ( empty($bbuserinfo[field5]) ) {
$cpanelLogin = '';
} else {
$cpanelLogin = '<a class="topnav" href="http://' . $bbuserinfo[field5] . ':2082">cPanel</a>';
}


And in your header template you need to have just $cpanelLogin, no <a> tags, etc.

Sketch
01-09-2003, 01:43 AM
thanks. It works. :)

okrogius
01-09-2003, 10:24 AM
OH , and not to ruin your mood of your announcements forum, this ireally a template modification, not a code hack. ;)

Feel free to ask if you need any more help doing something with vb.