Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
adding stylesheet for certain admin users
Hello, I have the following code from a existing plugin which adds a stylesheet to everyone in the admin area but i only want it to show for writers (priv 4 i think that is) but have no idea how to go about doing this.
function hpw_admincss($buffer){
global $event;
$style = '<style type="text/css">'.n.'@import url("css.php?n=admin");'.n.'</style>';
$ret = str_replace("</head>", "\n$style\n</head>", $buffer);
$ret = str_replace("<body>", "<body id=\"event_$event\">", $ret);
return $ret;
}
if (@txpinterface == 'admin') {
ob_start("hpw_admincss");
}
i would greatly appreciate any help :)
Dave.
Last edited by ruud (2008-10-07 14:24:13)
Offline
Re: adding stylesheet for certain admin users
Try changing this:
if (@txpinterface == 'admin') {
ob_start("hpw_admincss");
}
into:
if (@txpinterface == 'admin') {
global $txp_user;
if (safe_field("privs", "txp_users", "name='".doSlash($txp_user)."' and privs = 4"))
{
ob_start("hpw_admincss");
}
}
Offline
Re: adding stylesheet for certain admin users
Thanks for this! it works great :)
Offline