Kunena 7.0.4 Released

The Kunena team has announce the arrival of Kunena 7.0.4 [K 7.0.4] in stable which is now available for download as a native Joomla extension for J! 5.4.x/6.0.x. This version addresses most of the issues that were discovered in K 6.2 / K 6.3 / K 6.4 and issues discovered during the last development stages of K 7.0

Topics that are moved into this category are generally considered to be closed. Users may want to add additional information but these topics should not be resurrected in order to discuss new problems or unrelated matters.

Question HOW TO: Allow users to delete their own forum posts!

More
16 years 3 months ago - 16 years 3 months ago #38965 by gxisolutions
View this hack in action on www.noticeboardonline.com or view my blog for support: joomlahax.blogspot.com/

Enjoy!

1: post.php (/components/com_kunena/template/default/)

1.1) Find:
Code:
else if ($do == "deletepostnow") { if (!$is_Moderator)

1.2) Change to:
Code:
else if ($do == "deletepostnow") { $modified_reason = addslashes(mosGetParam($_POST, "modified_reason", null)); $modified_by = $my->id; $modified_time = CKunenaTools::fbGetInternalTime(); $id = (int) $id; $database->setQuery("SELECT * FROM #__fb_messages LEFT JOIN #__fb_messages_text ON #__fb_messages.id=#__fb_messages_text.mesid WHERE #__fb_messages.id=$id"); $message1 = $database->loadObjectList(); check_dberror("Unable to load messages."); $mes = $message1[0]; $userid = $mes->userid; //Check for a moderator or superadmin if ($is_Moderator) { $allowEdit = 1; } if ($fbConfig->useredit == 1 && $my->id != "") { //Now, if the author==viewer and the viewer is allowed to edit his/her own post the let them edit if ($my->id == $userid) { if(((int)$fbConfig->useredittime)==0) { $allowEdit = 1; } else { $modtime = $mes->modified_time; if(!$modtime) { $modtime = $mes->time; } if(($modtime + ((int)$fbConfig->useredittime) + ((int)$fbConfig->useredittimegrace)) >= CKunenaTools::fbGetInternalTime()) { $allowEdit = 1; } } } } if (!$allowEdit == 1)

1.1.1) Find:
Code:
else if ($do == "delete") { if (!$is_Moderator)

1.1.2) Change to:
Code:
else if ($do == "delete") { $modified_reason = addslashes(mosGetParam($_POST, "modified_reason", null)); $modified_by = $my->id; $modified_time = CKunenaTools::fbGetInternalTime(); $id = (int) $id; $database->setQuery("SELECT * FROM #__fb_messages LEFT JOIN #__fb_messages_text ON #__fb_messages.id=#__fb_messages_text.mesid WHERE #__fb_messages.id=$id"); $message1 = $database->loadObjectList(); check_dberror("Unable to load messages."); $mes = $message1[0]; $userid = $mes->userid; //Check for a moderator or superadmin if ($is_Moderator) { $allowEdit = 1; } if ($fbConfig->useredit == 1 && $my->id != "") { //Now, if the author==viewer and the viewer is allowed to edit his/her own post the let them edit if ($my->id == $userid) { if(((int)$fbConfig->useredittime)==0) { $allowEdit = 1; } else { $modtime = $mes->modified_time; if(!$modtime) { $modtime = $mes->time; } if(($modtime + ((int)$fbConfig->useredittime) + ((int)$fbConfig->useredittimegrace)) >= CKunenaTools::fbGetInternalTime()) { $allowEdit = 1; } } } } if (!$allowEdit == 1)

2: message.php (/components/com_kunena/template/default_ex/) * NB: default_ex must be the template you are using)

2.1) Find:
Code:
if ($msg_edit) { echo " | " . $msg_edit;

2.2) Change to:
Code:
if ($msg_edit) { echo " | " . $msg_edit; echo " | " . $msg_delete;

3: view.php (/components/com_kunena/template/default_ex/) * NB: default_ex must be the template you are using)

3.1) Find:
Code:
if($allowEdit) { $msg_edit = CKunenaLink::GetTopicPostLink('edit', $catid, $fmessage->id , $fbIcons['edit']?'<img src="' . KUNENA_URLICONSPATH . $fbIcons['edit'] . '" alt="Edit" border="0" title="' . _VIEW_EDIT . '" />':_GEN_EDIT);

3.2) Change to:
Code:
if($allowEdit) { $msg_delete = CKunenaLink::GetTopicPostLink('delete', $catid, $fmessage->id , $fbIcons['delete']?'<img src="' . KUNENA_URLICONSPATH . $fbIcons['delete'] . '" alt="Delete" border="0" title="' . _VIEW_DELETE . '" />':_GEN_DELETE); $msg_edit = CKunenaLink::GetTopicPostLink('edit', $catid, $fmessage->id , $fbIcons['edit']?'<img src="' . KUNENA_URLICONSPATH . $fbIcons['edit'] . '" alt="Edit" border="0" title="' . _VIEW_EDIT . '" />':_GEN_EDIT);
Last edit: 16 years 3 months ago by gxisolutions.

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

Time to create page: 0.457 seconds