summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/controllers/welcome.php7
-rw-r--r--modules/user/helpers/user_installer.php10
2 files changed, 14 insertions, 3 deletions
diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php
index 40b8390a..523cccb8 100644
--- a/core/controllers/welcome.php
+++ b/core/controllers/welcome.php
@@ -142,7 +142,8 @@ class Welcome_Controller extends Template_Controller {
$parents = ORM::factory("item")->where("type", "album")->find_all()->as_array();
try {
- $user_id = ORM::factory("user")->find()->id;
+ $user = Session::instance()->get("user");
+ $owner_id = $user ? $user->id : ORM::factory("user")->find()->id;
} catch (Exception $e) {
$user_id = null;
}
@@ -151,12 +152,12 @@ class Welcome_Controller extends Template_Controller {
$parent = $parents[array_rand($parents)];
if (!rand(0, 10)) {
$parents[] = album::create(
- $parent->id, "rnd_" . rand(), "Rnd $i", "random album $i", $user_id)
+ $parent->id, "rnd_" . rand(), "Rnd $i", "random album $i", $owner_id)
->set_thumbnail(DOCROOT . "core/tests/test.jpg", 200, 150)
->save();
} else {
photo::create($parent->id, DOCROOT . "themes/default/images/thumbnail.jpg",
- "thumbnail.jpg", "rnd_" . rand(), "sample thumbnail", $user_id);
+ "thumbnail.jpg", "rnd_" . rand(), "sample thumbnail", $owner_id);
}
if (!($i % 100)) {
diff --git a/modules/user/helpers/user_installer.php b/modules/user/helpers/user_installer.php
index 82f6d675..962eb86b 100644
--- a/modules/user/helpers/user_installer.php
+++ b/modules/user/helpers/user_installer.php
@@ -72,6 +72,16 @@ class user_installer {
throw new Exception("@todo {$user->name} WAS_NOT_ADDED_TO {$group_name}");
}
}
+
+ $user = ORM::factory("user")->where("name", "joe")->find();
+ $user->name = "joe";
+ $user->display_name = "Registered User";
+ $user->password = "joe";
+ $user->save();
+ $group = ORM::factory("group")->where("name", "registered")->find();
+ if (!$group->add($user)) {
+ throw new Exception("@todo {$user->name} WAS_NOT_ADDED_TO {$group_name}");
+ }
}
}