diff options
author | Janne Heß <janne@hess.ooo> | 2019-03-06 19:28:07 +0100 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2019-03-09 13:53:08 +0100 |
commit | 69ac1b2d2115a41afe2bd4527abadda70063019a (patch) | |
tree | 361f1ab05961526a94bf13429c32a03b6a4c8389 | |
parent | afa4506e11f96d05a727e591301f98fb50f8fad4 (diff) |
Support disabling the arrival feature
Setting `autoarrive` to true will now cause all newly registered angels
to be automatically confirmed as arrived.
-rw-r--r-- | config/config.default.php | 3 | ||||
-rw-r--r-- | includes/pages/guest_login.php | 7 | ||||
-rw-r--r-- | includes/sys_menu.php | 4 |
3 files changed, 13 insertions, 1 deletions
diff --git a/config/config.default.php b/config/config.default.php index 8840a00c..d1692590 100644 --- a/config/config.default.php +++ b/config/config.default.php @@ -82,6 +82,9 @@ return [ // Only arrived angels can sign up for shifts 'signup_requires_arrival' => false, + // Whether newly-registered user should automatically be marked as arrived + 'autoarrive' => false, + // Number of hours that an angel has to sign out own shifts 'last_unsubscribe' => 3, diff --git a/includes/pages/guest_login.php b/includes/pages/guest_login.php index f507548b..c636a36c 100644 --- a/includes/pages/guest_login.php +++ b/includes/pages/guest_login.php @@ -217,7 +217,12 @@ function guest_register() ->associate($user) ->save(); - (new State())->user() + $state = new State([]); + if (config('autoarrive')) { + $state->arrived = true; + $state->arrival_date = new Carbon(); + } + $state->user() ->associate($user) ->save(); diff --git a/includes/sys_menu.php b/includes/sys_menu.php index b4c04a98..4dabc857 100644 --- a/includes/sys_menu.php +++ b/includes/sys_menu.php @@ -114,6 +114,10 @@ function make_navigation() 'admin_event_config' => __('Event config'), ]; + if (config('autoarrive')) { + unset($admin_pages['admin_arrive']); + } + foreach ($admin_pages as $menu_page => $title) { if (auth()->can($menu_page)) { $admin_menu[] = toolbar_item_link( |