<?php

// If subsites is installed
if (class_exists('Users_Account_Controller')) {
    Users_Account_Controller::add_extension('OrdersUserAccountControllerExtension');
    Member::add_extension('OrdersMemberExtension');
}
// If subsites is installed
if (class_exists('Subsite')) {
    Order::add_extension('SubsitesOrdersExtension');
    OrderAdmin::add_extension('SubsiteMenuExtension');
}
// If subsites is installed
if (class_exists('SiteConfig')) {
    SiteConfig::add_extension('OrdersSiteConfigExtension');
}
<?php

if (class_exists("Users_Account_Controller")) {
    Users_Account_Controller::add_extension("CheckoutUserAccountControllerExtension");
}
<?php

// Extentions
SiteConfig::add_extension('Ext_Commerce_SiteConfig');
Image::add_extension('Ext_Commerce_Image');
Controller::add_extension('Ext_Commerce_Controller');
Group::add_extension('Ext_Commerce_Group');
Member::add_extension('Ext_Commerce_Member');
if (class_exists('Users_Account_Controller')) {
    Users_Account_Controller::add_extension('Ext_Commerce_UsersController');
}
// If subsites is installed
if (class_exists('Subsite')) {
    Product::add_extension('Ext_Subsites_CommerceObject');
    ProductCategory::add_extension('Ext_Subsites_CommerceObject');
    Order::add_extension('Ext_Subsites_CommerceObject');
    CatalogueAdmin::add_extension('SubsiteMenuExtension');
    LocaliseAdmin::add_extension('SubsiteMenuExtension');
    OrderAdmin::add_extension('SubsiteMenuExtension');
}
LeftAndMain::add_extension('Ext_Commerce_LeftAndMain');
// Setup google sitemaps
if (class_exists("GoogleSitemap")) {
    GoogleSitemap::register_dataobject('Product');
    GoogleSitemap::register_dataobject('ProductCategory');
}
 /**
  * Register a new member. This action is deigned to be intercepted at 2
  * points:
  *
  *  - Modify the initial member filter (so that you can perfom bespoke
  *    member filtering
  *
  *  - Modify the member user before saving (so we can add extra permissions
  *    etc)
  *
  * @param array $data User submitted data
  * @param Form $form Registration form
  */
 public function doRegister($data, $form)
 {
     $filter = array();
     if (isset($data['Email'])) {
         $filter['Email'] = $data['Email'];
     }
     $this->extend("updateMemberFilter", $filter);
     // Check if a user already exists
     if ($member = Member::get()->filter($filter)->first()) {
         if ($member) {
             $form->addErrorMessage("Blurb", "Sorry, an account already exists with those details.", "bad");
             // Load errors into session and post back
             unset($data["Password"]);
             Session::set("Form.{$form->FormName()}.data", $data);
             return $this->redirectBack();
         }
     }
     $member = Member::create();
     $form->saveInto($member);
     // Set verification code for this user
     $member->VerificationCode = sha1(mt_rand() . mt_rand());
     $member->write();
     $this->extend("updateNewMember", $member, $data);
     // Add member to any groups that have been specified
     if (count(Users::config()->new_user_groups)) {
         $groups = Group::get()->filter(array("Code" => Users::config()->new_user_groups));
         foreach ($groups as $group) {
             $group->Members()->add($member);
             $group->write();
         }
     }
     // Send a verification email, if needed
     if (Users::config()->send_verification_email) {
         $sent = $this->send_verification_email($member);
     } else {
         $sent = false;
     }
     // Login (if enabled)
     if (Users::config()->login_after_register) {
         $member->LogIn(isset($data['Remember']));
     }
     // If a back URL is used in session.
     if (Session::get("BackURL")) {
         $redirect_url = Session::get("BackURL");
     } else {
         $redirect_url = Controller::join_links(BASE_URL, Users_Account_Controller::config()->url_segment);
     }
     return $this->redirect($redirect_url);
 }
<?php

if (ClassInfo::exists('Commenting')) {
    // Add commenting to discussions
    Commenting::add('Discussion', array("require_login" => true, "required_permission" => "DISCUSSIONS_REPLY", "order_comments_by" => "\"Created\" ASC"));
    Object::add_extension("Member", "DiscussionsMember");
    Object::add_extension("Group", "DiscussionsGroup");
    Object::add_extension("Comment", "DiscussionsComment");
    if (class_exists('Users_Account_Controller')) {
        Users_Account_Controller::add_extension('DiscussionsUsersController');
    }
}