From f5310d9e9ff4d5e5e4180c236a37cfbc21ef8b86 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 17 Nov 2014 16:12:55 -0500 Subject: [PATCH] benefits: Display member button. * CRM/Admin/Form/Setting/MemberDashboard.php (CRM_Admin_Form_Setting_MemberDashboard) [buildQuickForm]: Add input for static button URL. [postProcess]: Save static button URL. * CRM/Memberdashboard/Page/Benefits.php (CRM_Memberdashboard_Page_Benefits) [run]: Add 'contact' and 'buttonUrl' smarty variables. * settings/MemberDashboard.setting.php (memberdashboard_button_static_url): New setting. * templates/CRM/Admin/Form/Setting/MemberDashboard.tpl: Render static button URL form field. * templates/CRM/Memberdashboard/Page/Benefits.tpl: Render member button. --- CRM/Admin/Form/Setting/MemberDashboard.php | 8 ++++++-- CRM/Memberdashboard/Page/Benefits.php | 6 ++++++ settings/MemberDashboard.setting.php | 11 +++++++++++ .../CRM/Admin/Form/Setting/MemberDashboard.tpl | 8 ++++++++ templates/CRM/Memberdashboard/Page/Benefits.tpl | 15 +++++++++++++++ 5 files changed, 46 insertions(+), 2 deletions(-) diff --git a/CRM/Admin/Form/Setting/MemberDashboard.php b/CRM/Admin/Form/Setting/MemberDashboard.php index a2b32f3..e065f8f 100644 --- a/CRM/Admin/Form/Setting/MemberDashboard.php +++ b/CRM/Admin/Form/Setting/MemberDashboard.php @@ -45,6 +45,8 @@ class CRM_Admin_Form_Setting_MemberDashboard extends CRM_Admin_Form_Setting { public function buildQuickForm() { $this->add('select', 'memberdashboard_info_profile_id', 'Member Info Profile', $this->fetchProfiles()); + $this->add('text', 'memberdashboard_button_static_url', + 'Member Button Static Image URL'); $this->add('text', 'memberdashboard_button_api_url', 'Member Button API URL'); $this->add('text', 'memberdashboard_button_api_user', @@ -64,13 +66,15 @@ class CRM_Admin_Form_Setting_MemberDashboard extends CRM_Admin_Form_Setting { public function postProcess() { $params = $this->exportValues(); $profileKey = 'memberdashboard_info_profile_id'; - $urlKey = 'memberdashboard_button_api_url'; + $staticUrlKey = 'memberdashboard_button_static_url'; + $apiUrlKey = 'memberdashboard_button_api_url'; $userKey = 'memberdashboard_button_api_user'; $passwordKey = 'memberdashboard_button_api_password'; civicrm_api3('setting', 'create', array( $profileKey => $params[$profileKey], - $urlKey => $params[$urlKey], + $staticUrlKey => $params[$staticUrlKey], + $apiUrlKey => $params[$apiUrlKey], $userKey => $params[$userKey], $passwordKey => $params[$passwordKey] )); diff --git a/CRM/Memberdashboard/Page/Benefits.php b/CRM/Memberdashboard/Page/Benefits.php index 41a7da1..ac6bfdb 100644 --- a/CRM/Memberdashboard/Page/Benefits.php +++ b/CRM/Memberdashboard/Page/Benefits.php @@ -161,12 +161,18 @@ class CRM_Memberdashboard_Page_Benefits extends CRM_Memberdashboard_Page { } $emailAliases = $this->loadEmailAliases(); + $buttonUrl = civicrm_api3('setting', 'getvalue', array( + 'name' => 'memberdashboard_button_static_url', + 'group' => MEMBERDASHBOARD_SETTINGS_GROUP + )); CRM_Utils_System::setTitle(ts('Benefits')); + $this->assign('contact', $this->contact); $this->assign('user', $user); $this->assign('emailAliases', $emailAliases); $this->assign('hasValidMembership', $this->hasValidMembership()); + $this->assign('buttonUrl', $buttonUrl); parent::run(); } diff --git a/settings/MemberDashboard.setting.php b/settings/MemberDashboard.setting.php index 4456566..79ca7b5 100644 --- a/settings/MemberDashboard.setting.php +++ b/settings/MemberDashboard.setting.php @@ -32,6 +32,17 @@ return array( 'description' => 'Info Profile ID', 'help_text' => 'Profile ID for member-editable contact information' ), + 'memberdashboard_button_static_url' => array( + 'group_name' => 'Member Dashboard Preferences', + 'group' => 'memberdashboard', + 'name' => 'memberdashboard_button_static_url', + 'type' => 'String', + 'default' => '', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Member button static image directory URL', + 'help_text' => 'The location of the member button static image files' + ), 'memberdashboard_button_api_url' => array( 'group_name' => 'Member Dashboard Preferences', 'group' => 'memberdashboard', diff --git a/templates/CRM/Admin/Form/Setting/MemberDashboard.tpl b/templates/CRM/Admin/Form/Setting/MemberDashboard.tpl index 3484fec..bf21d81 100644 --- a/templates/CRM/Admin/Form/Setting/MemberDashboard.tpl +++ b/templates/CRM/Admin/Form/Setting/MemberDashboard.tpl @@ -37,6 +37,14 @@ {$form.memberdashboard_info_profile_id.html} + + + {$form.memberdashboard_button_static_url.label} + + + {$form.memberdashboard_button_static_url.html} + + {$form.memberdashboard_button_api_url.label} diff --git a/templates/CRM/Memberdashboard/Page/Benefits.tpl b/templates/CRM/Memberdashboard/Page/Benefits.tpl index 158f876..213cbca 100644 --- a/templates/CRM/Memberdashboard/Page/Benefits.tpl +++ b/templates/CRM/Memberdashboard/Page/Benefits.tpl @@ -108,6 +108,21 @@ + {if !empty($buttonUrl) } +
Member button
+ +

+ Display this member button proudly on your website to show how + long you have been an FSF member! +

+ +
+
+ +
+
+ {/if} +
Member Forums

-- 2.25.1