From c8fc3ad7cd47a1545da030109ba743105417c047 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 14 May 2018 19:19:25 -0700 Subject: refactor the 'where does the register link point?' logic --- boot.php | 46 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 10 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index b2186246d..b19817197 100755 --- a/boot.php +++ b/boot.php @@ -1559,17 +1559,43 @@ function fix_system_urls($oldurl, $newurl) { * @return string Parsed HTML code. */ function login($register = false, $form_id = 'main-login', $hiddens = false, $login_page = true) { + $o = ''; - $reg = false; - $reglink = get_config('system', 'register_link'); - if(! strlen($reglink)) - $reglink = 'register'; - - $reg = array( - 'title' => t('Create an account to access services and applications'), - 'desc' => t('Register'), - 'link' => (($register) ? $reglink : 'pubsites') - ); + $reg = null; + + // Here's the current description of how the register link works (2018-05-15) + + // Register links are enabled on the site home page and login page and navbar. + // They are not shown by default on other pages which may require login. + + // If the register link is enabled and registration is closed, the request is directed + // to /pubsites. If registration is allowed, /register is the default destination + + // system.register_link can over-ride the default behaviour and redirect to an arbitrary + // webpage for paid/custom or organisational registrations, regardless of whether + // registration is allowed. + + // system.register_link may or may not be the same destination as system.sellpage + + // system.sellpage is the destination linked from the /pubsites page on other sites. If + // system.sellpage is not set, the 'register' link in /pubsites will go to 'register' on your + // site. + + // If system.register_link is set to the word 'none', no registration link will be shown on + // your site. + + + $register_policy = get_config('system','register_policy'); + + $reglink = get_config('system', 'register_link', z_root() . '/' . ((intval($register_policy) === REGISTER_CLOSED) ? 'pubsites' : 'register')); + + if($reglink !== 'none') { + $reg = [ + 'title' => t('Create an account to access services and applications'), + 'desc' => t('Register'), + 'link' => $reglink + ]; + } $dest_url = z_root() . '/' . App::$query_string; -- cgit v1.2.3