public function confirm($hash) { $pending_user = ORM::factory("pending_user")->where("hash", "=", $hash)->where("state", "=", 0)->find(); if ($pending_user->loaded()) { // @todo add a request date to the pending user table and check that it hasn't expired $policy = module::get_var("registration", "policy"); $pending_user->state = 1; $pending_user->save(); if ($policy == "vistor") { $user = register::create_new_user($pending_user->id); message::success(t("Your registration request has been approved")); auth::login($user); Session::instance()->set("registration_first_usage", true); $pending_user->delete(); } else { site_status::warning(t("There are pending user registration. <a href=\"%url\">Review now!</a>", array("url" => html::mark_clean(url::site("admin/register")), "locale" => module::get_var("gallery", "default_locale"))), "pending_user_registrations"); message::success(t("Your registration request is awaiting administrator approval")); // added by Shad Laws, v2 if (module::get_var("registration", "admin_notify") == 1) { register::send_admin_notify($pending_user); } } } else { message::error(t("Your registration request is no longer valid, Please re-register.")); } url::redirect(item::root()->abs_url()); }