After some more digging, and thanks to the answers from kiatng and lalit mohan, I found the answer.
I wanted to list all customer details to the page via javascript.
In the mage.php file, located at Magento\apps\magento\htdocs\app:
public static function dispatchEvent($name, array $data = array())
{
//Custom code, this is being executed when the customer succesfully registers
if($name == "customer_register_success")
{
$customer = $data['customer'];
$customerData = Mage::getModel('customer/customer')->load($customer->getId())->getData();
$out = "";
foreach( $customerData as $key => $value ) {
//this prevents the password hash to be show in the session
if(!$key == "password_hash")
{
$out .= "|" . $key . ':' . $value;
}
}
//Put customer vallues in the sessions
session_start();
$_SESSION["data"] = $out;
}
//Logging to htdocs/var/log/system.log
Mage::log('Event fired: ' . $name . "__" . $data);
//Default code (this was already there)
Varien_Profiler::start('DISPATCH EVENT:'.$name);
$result = self::app()->dispatchEvent($name, $data);
Varien_Profiler::stop('DISPATCH EVENT:'.$name);
return $result;
}
Then in your javascript:
var customerdata = "<?php session_start(); echo $_SESSION["data"]; ?>";
This will output all customer data to a string.
$this->_redirectSuccess($url);
where $url is by defaultcustomer/account/index
or the URL paramsuccess_url
, seeMage_Core_Controller_Varien_Action ::_redirectSuccess()
. So, in order to execute your js, you'll need to find a way to always redirect to the page where you have your js embedded. You can do this by hard-setting thesuccess_url
.