Delete.php file in the Messageboard plugin (created by Webgalli Team)

Hi

I used this great plugin created by Team Webgalli which allows the user to create a messagebox inside the group's profile page:

http://community.elgg.org/pg/plugins/release/114145/developer/webgalli/message-board-with-group-message-board-option

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 =)