Evening!
Im currently developing a module which alters the default member registration process.
I have got the module installed, along with the extension and control panel backend.
My extension uses the ‘member-member-register’ hook and calls a function called ‘analyse_this’ which i have created as a public function in the extension’s php file (im assuming this is the correct place to put this).
For test i have tried to get this function to load a view page and print the variable data passed with the hook but instead of this the default action continues to happen and the created function appears to not run.
So, what im asking is if someone is able to provide me with some code to stop the default action, or tell me where ive gone wrong thus far.
Thanks in advance for any help.
Jon
Evening, thanks for replying… I think my friday night post might need clarifying, its more of a question i guess than a help with code, well at least at the minute 😉
So i suppose the question(s) is(are) this(these)… when the code is run that triggers the hook, this will then trigger the function that i have written determined by the entry in the exp_extensions table yes?
When my function is triggered is this replacing the default action or run in addition to the default action?
If i run a conditional statement and find i do not need to alter the default process can i get EE to resume what it was doing in the first place?
Basically the code is going to check what member the group a new user is signing up to, if it is a particular group it will send out an email using a different template to a different email address, if it is not in said member group the process will carry on as normal…
Thanks in advance,
Jon
p.s. thanks for the welcome, im humbled.
Oki Doki…
Done some more googling and have maybe partly answered my own question…
My extension will take over what ever is meant to be happening.
Depending on whether i set $EXT->end_script to TRUE or FALSE will determine if the default actions are processed after my function or not.
So i just need to write the code, job done…
This leads me to another quick one though… The module / extension installs two new speciality templates for emails… Can you direct me to example code which uses these templates? Or let me know where to find the EE core code thats using them so i can butcher that in to something i can use? I would just use the email helper / library but i would like the admin to be able to edit the template? I do have a workaround solution for this but would like to keep in line with EE standard on email templates etc…
Muchos Gracias
Word.
OK, i still need help!!!
This is the extension code…
class Forum_guardian_ext
{
var $name = 'Forum_guardian';
var $version = '1.0';
var $description = 'blah blah';
var $settings_exist = 'n';
var $docs_url = '';
var $settings = array();
function __construct($settings='')
{
$this->EE =& get_instance();
$this->settings = $settings;
}
// Install the extension to the exp_extensions table (required, obviously)
public function activate_extension()
{
$this->settings = array();
$data = array(
'class' => __CLASS__,
'method' => 'authorise_this',
'hook' => 'member_member_register',
'settings' => serialize($this->settings),
'priority' => 1,
'version' => $this->version,
'enabled' => 'y'
);
$this->EE->db->insert('extensions', $data);
}
// Required function to update the extension
function update_extension($current = '')
{
return FALSE;
}
// Disables the function, actually deletes the extension from the exp_extensions table
function disable_extension()
{
$this->EE->db->where('class', __CLASS__);
$this->EE->db->delete('extensions');
}
// this function should be triggered by the member_member_register hook
public function authorise_this($edata)
{
$this->EE->functions->redirect('http://www.google.com');
echo "this should display";
$this->EE->extensions->end_script = TRUE;
}
}I am expecting this to trigger as i click submit on the member/register but nothing is happening, the hook is not calling the function / method…
Any help muchly appreciated…!
p.s. i have enabled triggers in the config.php…
Jon
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.