From 9ea2af6a3d3e18efa79f62afddc3d2e918d19b5b Mon Sep 17 00:00:00 2001 From: Bradley Taylor Date: Sun, 30 Jan 2022 11:51:55 +0000 Subject: [PATCH] Avoid PHP notices on the UF settings page. This primarially benefits non Drupal environments, specifically WordPress and Joomla. --- CRM/Admin/Form/Setting/UF.php | 13 ++++++++++--- templates/CRM/Admin/Form/Setting/UF.tpl | 8 +++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CRM/Admin/Form/Setting/UF.php b/CRM/Admin/Form/Setting/UF.php index 16aedbc90f..54078cddc9 100644 --- a/CRM/Admin/Form/Setting/UF.php +++ b/CRM/Admin/Form/Setting/UF.php @@ -32,16 +32,21 @@ class CRM_Admin_Form_Setting_UF extends CRM_Admin_Form_Setting { $this->_uf = $config->userFramework; $this->_settings['syncCMSEmail'] = CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME; - if ($this->_uf == 'WordPress') { - $this->_settings['wpBasePage'] = CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME; - } + $this->assign('wpBasePageEnabled', FALSE); + $this->assign('userFrameworkUsersTableNameEnabled', FALSE); $this->setTitle( ts('Settings - %1 Integration', [1 => $this->_uf]) ); + if ($this->_uf == 'WordPress') { + $this->_settings['wpBasePage'] = CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME; + $this->assign('wpBasePageEnabled', TRUE); + } + if ($config->userSystem->is_drupal) { $this->_settings['userFrameworkUsersTableName'] = CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME; + $this->assign('userFrameworkUsersTableNameEnabled', TRUE); } // find out if drupal has its database prefixed @@ -62,6 +67,8 @@ class CRM_Admin_Form_Setting_UF extends CRM_Admin_Form_Setting { } } + $this->assign('tablePrefixes', FALSE); + if ($config->userSystem->viewsExists() && ( $config->dsn != $config->userFrameworkDSN || !empty($drupal_prefix) diff --git a/templates/CRM/Admin/Form/Setting/UF.tpl b/templates/CRM/Admin/Form/Setting/UF.tpl index 0f9398cbd3..be63b58336 100644 --- a/templates/CRM/Admin/Form/Setting/UF.tpl +++ b/templates/CRM/Admin/Form/Setting/UF.tpl @@ -13,12 +13,14 @@
{include file="CRM/common/formButtons.tpl" location="top"}
- + {if $userFrameworkUsersTableNameEnabled} + - {if !empty($form.wpBasePage)} - + {/if} + {if $wpBasePageEnabled} +
{$form.userFrameworkUsersTableName.label} {$form.userFrameworkUsersTableName.html}
{$form.wpBasePage.label} {$config->userFrameworkBaseURL}{$form.wpBasePage.html}

{ts 1=$config->userFrameworkBaseURL}By default, CiviCRM will generate front-facing pages using the home page at %1 as its base. If you want to use a different template for CiviCRM pages, set the path here.{/ts}

-- 2.25.1