diff options
author | Mario <mario@mariovavti.com> | 2021-04-08 12:38:38 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-04-08 12:38:38 +0000 |
commit | cf62e07bec8ffe6b9e5c92d56c13ee3cbe06b5bf (patch) | |
tree | f9842fdf61038c023bd6088576f40f893850256c /Zotlabs/Module/Admin/Accounts.php | |
parent | ec4526b5f47af05bc0ffe0bb5f997d3d82b14b5a (diff) | |
download | volse-hubzilla-cf62e07bec8ffe6b9e5c92d56c13ee3cbe06b5bf.tar.gz volse-hubzilla-cf62e07bec8ffe6b9e5c92d56c13ee3cbe06b5bf.tar.bz2 volse-hubzilla-cf62e07bec8ffe6b9e5c92d56c13ee3cbe06b5bf.zip |
register: default to auto-create channel and fix auto create channel if register approval is configured
Diffstat (limited to 'Zotlabs/Module/Admin/Accounts.php')
-rw-r--r-- | Zotlabs/Module/Admin/Accounts.php | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/Zotlabs/Module/Admin/Accounts.php b/Zotlabs/Module/Admin/Accounts.php index 856ff9155..ac46c43aa 100644 --- a/Zotlabs/Module/Admin/Accounts.php +++ b/Zotlabs/Module/Admin/Accounts.php @@ -70,18 +70,44 @@ class Accounts { intval($_SESSION[self::MYP]['i'][$zarat]) ); if ($rs && ($rs[0]['reg_flags'] & ~ 48) == 0) { - // create account - $rc='ok'.$rs[0]['reg_id']; + $rc = 'ok'.$rs[0]['reg_id']; $ac = create_account_from_register($rs[0]); - if ( $ac['success'] ) $rc .= '✔'; + if ( $ac['success'] ) { + $rc .= '✔'; + + $auto_create = get_config('system','auto_channel_create',1); + + if($auto_create) { + $reonar = json_decode($rs[0]['reg_stuff'], true); + // prepare channel creation + if($reonar['chan.name']) + set_aconfig($ac['account']['account_id'], 'register', 'channel_name', $reonar['chan.name']); + + if($reonar['chan.did1']) + set_aconfig($ac['account']['account_id'], 'register', 'channel_address', $reonar['chan.did1']); + + $permissions_role = get_config('system','default_permissions_role'); + if($permissions_role) + set_aconfig($ac['account']['account_id'], 'register', 'permissions_role', $permissions_role); + // create channel + $new_channel = auto_channel_create($ac['account']['account_id']); + + if($new_channel['success']) { + $rc .= ' c,ok' . $new_channel['channel']['channel_id'] . '✔'; + } + else { + $rc .= ' c ×'; + } + } + + + } } else { - $rc='oh×'; + $rc='oh ×'; } } - - // echo json_encode(array('re' => $zarop, 'at' => '_' . $zarat, 'rc' => $rc)); } killme(); |