PDA

View Full Version : Adding options to the User CP


gdguide
05-23-2009, 12:16 AM
On our forum we have a set of rotating header images, but the PHP that is used to rotate them doesn't perform well on old versions of IE. I'd like to add a single checkbox in the UserCP that enables a "optimize for IE" setting, and wrap the IE-specific header code in an <if>...<else> tag that would check for the status of that option for each individual user and display the header accordingly. How would I do this?

Biker_GA
05-23-2009, 12:19 AM
Why don't you just add the browser check in your coding for everyone?

gdguide
05-23-2009, 12:22 AM
Why don't you just add the browser check in your coding for everyone?

Because in some instances it performs fine on IE 7, while in others it performs horribly. It is isolated to IE, but I don't want to force IE users to use a simple, static header if they feel no need for it.

Biker_GA
05-23-2009, 12:24 AM
You can look for specific IE versions within the script.. Something like:


<?php
echo ( browser_detection( 'number' ) .'<br>'.
browser_detection( 'browser' ) .'<br>'.
browser_detection( 'os' ) .'<br>'.
browser_detection( 'os_number' ) );
?>

Outputs (browser version, browser, os, os number):
1.5
moz
nt
5.1

<?php
if ( ( browser_detection( 'browser' ) == 'ie' )
&&
( browser_detection( 'number' ) >= 5 ) )
{
echo 'it is Internet Explorer ' .
browser_detection( 'number' );
// or anything else you want to happen of course
}
?>


Obviously, you don't need to check for OS version, but this should give you an idea on where to start with checking for the type of browser and browser version.

gdguide
05-23-2009, 01:39 AM
You can look for specific IE versions within the script.. Something like:


<?php
echo ( browser_detection( 'number' ) .'<br>'.
browser_detection( 'browser' ) .'<br>'.
browser_detection( 'os' ) .'<br>'.
browser_detection( 'os_number' ) );
?>

Outputs (browser version, browser, os, os number):
1.5
moz
nt
5.1

<?php
if ( ( browser_detection( 'browser' ) == 'ie' )
&&
( browser_detection( 'number' ) >= 5 ) )
{
echo 'it is Internet Explorer ' .
browser_detection( 'number' );
// or anything else you want to happen of course
}
?>


Obviously, you don't need to check for OS version, but this should give you an idea on where to start with checking for the type of browser and browser version.
Like I said, I don't want to force it upon anyone - I'd rather give them the option.

Unofficial mods and addons manage to add options to the User CP. Is it not possible to do this manually?