From 2f06e9360f2c26bcc6e58a4c406b8e120e31ac59 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 26 Sep 2016 19:35:01 +0000 Subject: [PATCH] "Company" is now "Organisation" and there is an auto update --- boot.php | 2 +- mod/settings.php | 31 +++++++++++++++++++------------ update.php | 5 +++++ view/templates/pagetypes.tpl | 4 ++-- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/boot.php b/boot.php index 0ef450f3e..44374eefe 100644 --- a/boot.php +++ b/boot.php @@ -187,7 +187,7 @@ define ( 'PAGE_PRVGROUP', 5 ); * @{ */ define ( 'ACCOUNT_TYPE_PERSON', 0 ); -define ( 'ACCOUNT_TYPE_COMPANY', 1 ); +define ( 'ACCOUNT_TYPE_ORGANISATION',1 ); define ( 'ACCOUNT_TYPE_NEWS', 2 ); define ( 'ACCOUNT_TYPE_COMMUNITY', 3 ); /** @}*/ diff --git a/mod/settings.php b/mod/settings.php index eb6c53e58..908d82845 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -457,7 +457,7 @@ function settings_post(&$a) { // Adjust the page flag if the account type doesn't fit to the page flag. if (($account_type == ACCOUNT_TYPE_PERSON) AND !in_array($page_flags, array(PAGE_NORMAL, PAGE_SOAPBOX, PAGE_FREELOVE))) $page_flags = PAGE_NORMAL; - elseif (($account_type == ACCOUNT_TYPE_COMPANY) AND !in_array($page_flags, array(PAGE_SOAPBOX))) + elseif (($account_type == ACCOUNT_TYPE_ORGANISATION) AND !in_array($page_flags, array(PAGE_SOAPBOX))) $page_flags = PAGE_SOAPBOX; elseif (($account_type == ACCOUNT_TYPE_NEWS) AND !in_array($page_flags, array(PAGE_SOAPBOX))) $page_flags = PAGE_SOAPBOX; @@ -1077,24 +1077,31 @@ function settings_content(&$a) { if(! strlen($a->user['timezone'])) $timezone = date_default_timezone_get(); + // Set the account type to "Community" when the page is a community page but the account type doesn't fit + // This is only happening on the first visit after the update + if (in_array($a->user['page-flags'], array(PAGE_COMMUNITY, PAGE_PRVGROUP)) AND + ($a->user['account-type'] != ACCOUNT_TYPE_COMMUNITY)) + $a->user['account-type'] = ACCOUNT_TYPE_COMMUNITY; + $pageset_tpl = get_markup_template('pagetypes.tpl'); $pagetype = replace_macros($pageset_tpl, array( - '$account_types'=> t("Account Types"), - '$user' => t("Personal Page Subtypes"), - '$community' => t("Community Forum Subtypes"), - '$account_type' => $a->user['account-type'], - '$type_person' => ACCOUNT_TYPE_PERSON, - '$type_company' => ACCOUNT_TYPE_COMPANY, - '$type_news' => ACCOUNT_TYPE_NEWS, - '$type_community' => ACCOUNT_TYPE_COMMUNITY, + '$account_types' => t("Account Types"), + '$user' => t("Personal Page Subtypes"), + '$community' => t("Community Forum Subtypes"), + '$account_type' => $a->user['account-type'], + '$type_person' => ACCOUNT_TYPE_PERSON, + '$type_organisation' => ACCOUNT_TYPE_ORGANISATION, + '$type_news' => ACCOUNT_TYPE_NEWS, + '$type_community' => ACCOUNT_TYPE_COMMUNITY, + '$account_person' => array('account-type', t('Personal Page'), ACCOUNT_TYPE_PERSON, t('This account is a regular personal profile'), ($a->user['account-type'] == ACCOUNT_TYPE_PERSON)), - '$account_company' => array('account-type', t('Company Page'), ACCOUNT_TYPE_COMPANY, - t('This account is a company profile'), - ($a->user['account-type'] == ACCOUNT_TYPE_COMPANY)), + '$account_organisation' => array('account-type', t('Organisation Page'), ACCOUNT_TYPE_ORGANISATION, + t('This account is a profile for an organisation'), + ($a->user['account-type'] == ACCOUNT_TYPE_ORGANISATION)), '$account_news' => array('account-type', t('News Page'), ACCOUNT_TYPE_NEWS, t('This account is a news account/reflector'), diff --git a/update.php b/update.php index bd37e382e..31f7852a2 100644 --- a/update.php +++ b/update.php @@ -1723,3 +1723,8 @@ function update_1190() { return UPDATE_SUCCESS; } + +function update_1202() { + $r = q("UPDATE `user` SET `account-type` = %d WHERE `page-flags` IN (%d, %d)", + dbesc(ACCOUNT_TYPE_COMMUNITY), dbesc(PAGE_COMMUNITY), dbesc(PAGE_PRVGROUP)); +} diff --git a/view/templates/pagetypes.tpl b/view/templates/pagetypes.tpl index ddb5f07b6..b970f7745 100644 --- a/view/templates/pagetypes.tpl +++ b/view/templates/pagetypes.tpl @@ -1,6 +1,6 @@

{{$account_types}}

{{include file="field_radio.tpl" field=$account_person}} -{{include file="field_radio.tpl" field=$account_company}} +{{include file="field_radio.tpl" field=$account_organisation}} {{include file="field_radio.tpl" field=$account_news}} {{include file="field_radio.tpl" field=$account_community}} @@ -11,7 +11,7 @@ {{include file="field_radio.tpl" field=$page_freelove}} {{/if}} -{{if $account_type == $type_company}} +{{if $account_type == $type_organisation}} {{/if}}