I think this is a simple solution to what I want to do. I only want Super Admins to be able to contact users but, I do want users to be able to respond. I added this simple hack (on j!1.0.13) to prevent users from being able to compose messages.
at line 271 of includes.php:
[code:1]global $my;
if($my->usertype == "Super Administrator"«») {
if($uddeaction=="new"«») {
echo "<li class='uddeim-activemenu'>";
if($config->showmenuicons) {
echo "<img src='components/com_uddeim/templates/".$config->templatedir."/images/menu_new.gif'>";
}
echo _UDDEIM_COMPOSE;
echo "</li>\n";
} else {
echo "<li>";
if($config->showmenuicons) {
echo "<a href='index.php?option=com_uddeim&task=new&Itemid=".$item_id."'><img src='components/com_uddeim/templates/".$config->templatedir."/images/menu_new.gif' border='0' alt="._UDDEIM_COMPOSE."></a>";
}
echo "<a href='index.php?option=com_uddeim&task=new&Itemid=".$item_id."'>"._UDDEIM_COMPOSE."</a>";
echo "</li>\n";
} }[/code:1]
While I was at it, I also hacked cb.menu.php to only display the "Messages" links to Super Admins.
on line 903:
[code:1] if($my->usertype == "Super Administrator"«») {
if ($my->id!=$user->id && $my->id > 0) {
global $_CB_PMS;
$resultArray = $_CB_PMS->getPMSlinks($user->id, $my->id, $subject="", $message="", 1);
if (count($resultArray) > 0) {
foreach ($resultArray as $res) {
if (is_array($res)) {
$mi = array(); $mi["_UE_MENU_MESSAGES"][$res["caption"]]=null;
$this->_addMenuItem( $mi, getLangDefinition($res["caption"]),sefRelToAbs($res["url"]), "",
"","", getLangDefinition($res["tooltip"]),"" );
}
}
}
}
// Send Email
$emailHtml=getFieldValue('primaryemailaddress',$user->email,$user);
if ($ueConfig!=4 && $my->id != $user->id && $my->id > 0) {
switch ($ueConfig) {
case 1: // Display Email only
$caption = $emailHtml;
$url = "javascript:void(0);";
$desc = _UE_MENU_USEREMAIL_DESC;
break;
case 2: // Display Email with link:
$caption = null;
$url = $emailHtml;
$desc = _UE_MENU_SENDUSEREMAIL_DESC;
break;
case 3: // Display Email-to text with link to web-form:
$caption = _UE_MENU_SENDUSEREMAIL;
$url = $emailHtml;
$desc = _UE_MENU_SENDUSEREMAIL_DESC;
break;
}
$mi = array(); $mi["_UE_MENU_MESSAGES"]["_UE_MENU_SENDUSEREMAIL"]=null;
$this->_addMenuItem( $mi, $caption, $url, "", "", "", $desc, "" );
} }[/code:1]
I know hacking core files is not the best option, but I'm not a programmer.
Does anybody see an issue(s) with these hacks?
Post edited by: knotworking, at: 2007/12/21 20:42
Post edited by: knotworking, at: 2007/12/21 20:44