I’m working on synchronizing the membership data for two different systems that together power my project site. One is EE and the other is a catalog system known as the Scout Portal Toolkit. Each has their own registration and login systems and they use different databases (at the moment, at least). I’m trying to avoid having members register for one part of the site using one email and password, and then register using a different email or password or username in the second db, and otherwise try to limit the confusion that will result.
What I’ve done so far is to copy all the tables from the catalog system and add them to my EE database (they don’t start with the exp_ prepend that EE uses) to do some testing of extension development. I then wrote two extensions, one using the member_member_register hook and the other using the cp_members_member_create hook to capture new member data and add it to the other system. They both seem to work fine, but more extensions will be needed to address member validation (when they are validated on the EE system, do so as well on the other system) and probably another to manage deletion of members from both systems.
My question: Do I have to create separate extensions for each of these tasks, or can I somehow combine them all into one “mega-extension” that would be called when any of the requisite hooks is fired?
Related question: - are there any likely problems immediately apparent to having two systems sharing the same database (writing to different tables), or would it be better if I modified my extensions to work with the second system as an separate db, thereby losing (I think…) some of the nice EE DB class features.
Thanks for your thoughts…
Hey Dry. Thanks for the response. Just to be sure I am understanding you correctly, are you saying that I just add additional $DB queries under the Activate Extension portion of my extension, ie in this area, changing the method and hook in the array as needed?
// --------------------------------
// Activate Extension
// --------------------------------
function activate_extension()
{
global $DB;
$DB->query($DB->insert_string('exp_extensions',
array(
'extension_id' => '',
'class' => "Dual_cpregistration",
'method' => "create_other_reg_cp",
'hook' => "cp_members_member_create",
'settings' => "",
'priority' => 10,
'version' => $this->version,
'enabled' => "y"
)
)
);
}
Hi WCW,
That’s it. There are many examples of extensions with multiple hooks in Extensions:// Discussion and Questions.
Good luck!
Dry
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.