'edit_status_message' Alert not working?

I am trying to respond to the 'edit_status_message' alert but it is not working.

 

I have added the alert handler to the DB as follows:

sys_alerts table:

45

profile

edit_status_message

20

sys_alerts_handlers table:

20

mp_statusblock

MPStatusBlockResponse

modules/misterpopper/statusblock/classes/MPStatusBlockResponse.php

 

The file MPStatusBlockResponse.php looks like:

bx_import('BxDolAlerts');

class MPStatusBlockResponse extends BxDolAlertsResponse {

    function response ($oAlert) {
        $oModule = BxDolModule::getInstance('MPStatusBlockModule');

        switch ($oAlert->sAction) {
            case 'edit_status_message':
                $sCode = "<script type='text/javascript'>\n";
                $sCode .= "alert('12');\n";
                $sCode .= "return false;\n";
                $sCode .= "</script>";
                return $sCode;
            break;

            default:
                $sCode = "<script type='text/javascript'>\n";
                $sCode .= "alert('12');\n";
                $sCode .= "return false;\n";
                $sCode .= "</script>";
                return $sCode;
            break;
        }
    }
}

 

Anyone have an idea why it isnt working?

http://www.boonex.com/market/posts/paansystems - your resource for Dolphin Pro
Quote · 27 Feb 2012

Nothing jumps out at me as obviously wrong, but I'm perhaps not the most seasoned PHP dev, and it's late.

But perhaps I...and anyone else trying to help...Might benefit from exactly what you mean when you say it's not working.  Does it throw a DB error?  SQL Error?  Just does nothing?  Wipes the site clean and throws up an image of Steve Urkel in a dress?

Quote · 27 Feb 2012

nothing happends ... no reaction, so i think that the alert is not fired!?

http://www.boonex.com/market/posts/paansystems - your resource for Dolphin Pro
Quote · 27 Feb 2012

no idea?

http://www.boonex.com/market/posts/paansystems - your resource for Dolphin Pro
Quote · 28 Feb 2012

Sorry, but I've no idea past that.  I was hoping for some additional clue in an error message or DB error email.  If I was in your place, I'd probably insert what I call a "Probe function".  I created a function called LogicProbe($message) in the header include file so as to make it accessable anywhere in the dolphin code, which simply logs whatever is in $message to a database table.  With that I can see if code has executed at any point.  And if so, The contents of $message can be anything from a variable state, content, or even a $message = print_r($array, true);where $array is an array.  This way I can monitor the operation of code much the way an actual logic probe can monitor activity on a circuit board.

Using that you could determine exactly whether or not your code is running.

In fact, here is my probe log code.  Insert the following before the "$oz = new Bx..." at the end of your /inc/header/inc.php file.

function LogicProbe($message) {
    global $dbx;
    $sql = "INSERT INTO `dolphin`.`z_probe_log` (`log_date` ,`log_text` ,`log_extra`) VALUES (CURRENT_TIMESTAMP, '".$message."', '".(int)$_COOKIE['memberID']."');";
    $result = mysql_query($sql,$dbx);
}

Noticing of course that you may have to alter the code above where it says dolphin to replace the database name you use with dolphin.

and the database struct is

--
-- Table structure for table `z_probe_log`
--

CREATE TABLE IF NOT EXISTS `z_probe_log` (
  `log_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `log_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `log_text` text NOT NULL,
  `log_extra` int(11) DEFAULT NULL,
  PRIMARY KEY (`log_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=47722 ;

All you need to do then, is call the following function from anywhere in dolphin to insert log entries into this table:

LogicProbe($message);

where you can fill $message with any data you want to examine.  It could even be as simple as LogicProbe("the code has run");

The Log Extra field will have the user ID of the user logged in triggering the log, or it will be null if no one is logged in (called by cron, or guest user), as well as the timestamp for when the log was created.

It also generates a log_id in case you wanted to parse this with an application that could refer back to log rows, but that's usually not important.  .

Hope this helps debug the code.

Regards,
Thefakenet

Quote · 28 Feb 2012

wow, thank you ... this is a very good idea!

http://www.boonex.com/market/posts/paansystems - your resource for Dolphin Pro
Quote · 29 Feb 2012

alert is working ... thread can be closed!

http://www.boonex.com/market/posts/paansystems - your resource for Dolphin Pro
Quote · 6 Mar 2012
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.