/** * Only create a Member object on the Frontend of the site. * There is no need to create this in the Administration context * as authenticated users are Authors and are handled by Symphony, * not this extension. */ public function __construct() { if (!extension_Members::$initialised) { // Find all possible member sections $config_sections = preg_split('~,~', extension_Members::getSetting('section'), -1, PREG_SPLIT_NO_EMPTY); extension_Members::initialiseMemberSections($config_sections); if (class_exists('Symphony') && Symphony::Engine() instanceof Frontend) { /** * This delegate fires as soon as possible to allow other extensions * the chance to overwrite the default Member class. This allows * for other types of Member objects to be used with the Members * extension. If the given `$member` is left as null, then * the default `SymphonyMember` will be initialised. * * @delegate InitialiseMember * @param string $context * '/frontend/' * @param object $member * Excepted to be a instance of a class that implements the `Member` * interface. Defaults to null. */ Symphony::ExtensionManager()->notifyMembers('InitialiseMember', '/frontend/', array('member' => &$this->Member)); // Set $this->Member to be an instance of SymphonyMember if an // extension hasn't already populated this variable if (is_null($this->Member)) { $this->Member = new SymphonyMember(); } $members_section_id = $this->getMemberDriver()->getMemberSectionID(); // If there is only one section... this just got easy if (count($config_sections) === 1) { $this->setMembersSection(current($config_sections)); } else { if (isset($_REQUEST['members-section-id']) && in_array((int) $_REQUEST['members-section-id'], $config_sections)) { $this->setMembersSection($_REQUEST['members-section-id']); } else { if (isset($members_section_id) && in_array((int) $members_section_id, $config_sections)) { $this->setMembersSection($members_section_id); } } } } extension_Members::$initialised = true; } }