Hi
I used this great plugin created by Team Webgalli which allows the user to create a messagebox inside the group's profile page:
Everything works fine,except for a little trouble about the delete.php file which allows the user to delete messages he wrote and posted in the messageboard: when a user deletes its message,he's forwarded to a page which displays the refreshed messageboard (refreshed means without the deleted message) and in the left side you can find a link to the original group (when the user clocks on it,he's forwarded to the original group's profile page).
What i need of is: when the message is being deleted,user shall be forwarded not to the page which display the refreshed messageboard BUT directly to the group's profile page.
The first thing i did was:check the delete.php file anche edit it,in order to forward the user to the right page.This is the original delete.php file:
---------------------------------------------
<?php
/**
* Elgg Message board: delete message action
*
* @package ElggMessageBoard
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Curverider Ltd <info@elgg.com>
* @copyright Curverider Ltd 2008-2009
* @link http://elgg.org/
*/
// Ensure we're logged in
if (!isloggedin()) forward();
// Make sure we can get the comment in question
$annotation_id = (int) get_input('annotation_id');
//make sure that there is a message on the message board matching the passed id
if ($message = get_annotation($annotation_id)) {
//grab the user or group entity
$entity = get_entity($message->entity_guid);
//check to make sure the current user can actually edit the message board
if ($message->canEdit()) {
//delete the comment
$message->delete();
//display message
system_message(elgg_echo("messageboard:deleted"));
//generate the url to forward to
$url = "pg/messageboard/" . $entity->username;
//forward the user back to their message board
forward($url);
}
} else {
$url = "";
system_message(elgg_echo("messageboard:notdeleted"));
}
forward($url);
?>
-----------------------------------
and this is the delete.php file i edited:
-----------------------------------
<?php
/**
* Elgg Message board: delete message action
*
* @package ElggMessageBoard
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Curverider Ltd <info@elgg.com>
* @copyright Curverider Ltd 2008-2009
* @link http://elgg.org/
*/
// Ensure we're logged in
if (!isloggedin()) forward();
//ATTENZIONE->E' MODIFICATO! PER RITROVARE IL FORWARD ORIGINALE DEVI ANDARE A PRENDERLO NEL
//MESSAGEBOARD ORIGINALE SITUATO NEL DESKTOP
$group_guid = get_input('group_guid');
$group = get_entity($group_guid);
//FINE AGGIUNTA
// Make sure we can get the comment in question
$annotation_id = (int) get_input('annotation_id');
//make sure that there is a message on the message board matching the passed id
if ($message = get_annotation($annotation_id)) {
//grab the user or group entity
$entity = get_entity($message->entity_guid);
//check to make sure the current user can actually edit the message board
if ($message->canEdit()) {
//delete the comment
$url=$group->getURL();
$message->delete();
system_message(elgg_echo("messageboard:deleted"));
forward($url);
exit;
}
} else {
$url="";
system_message(elgg_echo("messageboard:notdeleted"));
forward($url);
}
?>
--------------------------------------------
As you can see,i tried to use:
$group_guid = get_input('group_guid');
$group = get_entity($group_guid);
forward($group->getURL());
exit;
instead of:
//generate the url to forward to
$url = "pg/messageboard/" . $entity->username;
in order to redirect the user toward the group's profile page.What happens instead is:
1)Message is being deleted
2)User is being for redirected to the dashboard
Any suggestions? If you need more informations please ask and i'll add more files inside the plugin
or i'm going to give any explanations if you wish.
Thanks in advance =)
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- bobaso@bobaso

bobaso - 0 likes
You must log in to post replies.I try to keep alive this topic to remind you that i could still use some help of possible.
Thank you in advance for any advice you can give me.