Skip to Content Skip to Menu

🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

Does this hack I made work?

17 years 6 days ago #52895 by knotworking
Does this hack I made work? was created by knotworking
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

Please Log in or Create an account to join the conversation.

  • slabbi
  • slabbi
  • OFFLINE
  • Posts: 3709
  • Thanks: 250
  • Karma: 153
17 years 6 days ago #52898 by slabbi
Replied by slabbi on topic Re:Does this hack I made work?
No it does not work, the user can still enter the link directly. Check the group id ($my->gid) at the very beginning of uddeim.php before $task is evaluated.

Post edited by: slabbi, at: 2007/12/21 20:55

uddeIM & uddePF Development
CB Language Workgroup
CB 3rd Party Developer

Please Log in or Create an account to join the conversation.

17 years 6 days ago #52900 by knotworking
Replied by knotworking on topic Re:Does this hack I made work?
Thanks for the prompt response, slabbi!

Yep, I figured in both cases that I wasn't disabling the function, just the link. Disabling the function would be best, but I can't see how.

I searched uddeim.php for $my->gid but could not find it, closest match was in the pruneMessages(...$my_gid...) function. Did you mean $my->id?

My goal is to have a system where moderators and above can contact members and members can respond to messages when contacted. Because of the nature of my site, I do not want any members contacting eachother.

Please Log in or Create an account to join the conversation.

  • slabbi
  • slabbi
  • OFFLINE
  • Posts: 3709
  • Thanks: 250
  • Karma: 153
17 years 6 days ago #52902 by slabbi
Replied by slabbi on topic Re:Does this hack I made work?
// get your group id
$my_gid=getGID($my->id);
// check if task=new and not (Admin or Super Admin) redirect back to inbox
if ($task=='new' && !($my_gid==24 || $my_gid==25)) {
mosRedirect(sefRelToAbs("index.php?option=com_uddeim"), _UDDEIM_VIOLATION);
}

Should work but untested. Should be done before $task is evaluated in uddeIM.

uddeIM & uddePF Development
CB Language Workgroup
CB 3rd Party Developer

Please Log in or Create an account to join the conversation.

17 years 5 days ago #52944 by knotworking
Replied by knotworking on topic Re:Does this hack I made work?
Worked like a charm, combined that with my little hack of includes.php and it is exactly what I needed.

Sincere thanks for the prompt support!

Please Log in or Create an account to join the conversation.

Moderators: beatnantslabbikrileon
Powered by Kunena Forum