Skip to content

Commit

Permalink
dev/core#5670 My Account and Edit my account pages
Browse files Browse the repository at this point in the history
  • Loading branch information
herbdool committed Feb 26, 2025
1 parent ec63081 commit 1cbaeae
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 2 deletions.
13 changes: 11 additions & 2 deletions CRM/Core/BAO/Navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -928,13 +928,22 @@ public static function buildHomeMenu(&$menu) {
];
}
else {
$item['child'][] = [
'attributes' => [
'label' => ts('My Account'),
'name' => 'My Account',
'url' => 'civicrm/my-account',
'icon' => 'crm-i fa-user',
'weight' => 2,
],
];
$item['child'][] = [
'attributes' => [
'label' => ts('Change Password'),
'name' => 'Change Password',
'url' => 'civicrm/admin/user/password',
'icon' => 'crm-i fa-keyboard',
'weight' => 2,
'weight' => 3,
],
];
}
Expand All @@ -944,7 +953,7 @@ public static function buildHomeMenu(&$menu) {
'name' => 'Log out',
'url' => 'civicrm/logout?reset=1',
'icon' => 'crm-i fa-person-walking-arrow-right',
'weight' => 3,
'weight' => 4,
],
];
return;
Expand Down
17 changes: 17 additions & 0 deletions ext/standaloneusers/ang/afformEditMyAccount.aff.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<af-form ctrl="afform">
<af-entity password="password123haha" type="User" name="User1" label="User 1" actions="{create: false, update: true}" security="RBAC" url-autofill="1" data="{}" />
<div class="af-markup">
<p><a href="/civicrm/my-account">My Account</a></p>
</div>
<fieldset af-fieldset="User1" class="af-container" af-title="Account info">
<div class="af-markup"></div>
<af-field name="username" />
<af-field name="uf_name" defn="{help_pre: 'Email used for password resets.', input_attrs: {placeholder: 'Leave blank to use the primary email from the selected contact'}}" />
<af-field name="timezone" defn="{help_pre: 'Set the timezone of the user. Date and times will be shown in this timezone. You can also leave it empty to use the default system timezone (which is a server setting).', input_attrs: {placeholder: 'Server default timezone'}}" />
<af-field name="language" defn="{help_pre: 'Set the user interface language of this user. You can also leave it empty to use the default system language.', input_attrs: {placeholder: 'System default language'}}" />
<div class="af-container af-container-style-pane">
<af-field name="roles" defn="{input_type: 'DisplayOnly', input_attrs: {}}" />
</div>
</fieldset>
<button class="af-button btn btn-primary" crm-icon="fa-check" ng-click="afform.submit()">Submit</button>
</af-form>
13 changes: 13 additions & 0 deletions ext/standaloneusers/ang/afformEditMyAccount.aff.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
use CRM_BobBase_ExtensionUtil as E;

return [
'type' => 'form',
'title' => E::ts('Edit my account'),
'icon' => 'fa-user',
'server_route' => 'civicrm/user/edit',
'permission' => [
'edit my contact',
],
'redirect' => '/civicrm/my-account',
];
3 changes: 3 additions & 0 deletions ext/standaloneusers/ang/afsearchMyAccount.aff.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div af-fieldset="">
<crm-search-display-grid search-name="My_account" display-name="My_account" filters="{'contact_id': options.contact_id}"></crm-search-display-grid>
</div>
11 changes: 11 additions & 0 deletions ext/standaloneusers/ang/afsearchMyAccount.aff.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
use CRM_BobBase_ExtensionUtil as E;

return [
'type' => 'search',
'title' => E::ts('My Account'),
'placement' => [],
'summary_contact_type' => ['Individual'],
'icon' => 'fa-user',
'server_route' => 'civicrm/my-account',
];
132 changes: 132 additions & 0 deletions ext/standaloneusers/managed/SavedSearch_My_account.mgd.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<?php
use CRM_BobBase_ExtensionUtil as E;

return [
[
'name' => 'SavedSearch_My_account',
'entity' => 'SavedSearch',
'cleanup' => 'unused',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'My_account',
'label' => E::ts('My account'),
'api_entity' => 'UFMatch',
'api_params' => [
'version' => 4,
'select' => [
'uf_id',
'contact_id',
'contact_id.display_name',
'uf_name',
],
'orderBy' => [],
'where' => [
[
'contact_id',
'=',
'user_contact_id',
],
],
'groupBy' => [],
'join' => [
[
'Contact AS UFMatch_Contact_contact_id_01',
'LEFT',
[
'contact_id',
'=',
'UFMatch_Contact_contact_id_01.id',
],
],
],
'having' => [],
],
],
'match' => ['name'],
],
],
[
'name' => 'SavedSearch_My_account_SearchDisplay_My_account',
'entity' => 'SearchDisplay',
'cleanup' => 'unused',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'My_account',
'label' => E::ts('My account'),
'saved_search_id.name' => 'My_account',
'type' => 'grid',
'settings' => [
'colno' => '2',
'limit' => 0,
'sort' => [],
'pager' => FALSE,
'columns' => [
[
'type' => 'field',
'key' => 'contact_id.display_name',
'dataType' => 'String',
'label' => E::ts('Donor'),
'link' => [
'path' => '',
'entity' => 'Contact',
'action' => 'view',
'join' => 'contact_id',
'target' => '',
],
'title' => E::ts('View Donor'),
'break' => TRUE,
],
[
'type' => 'field',
'key' => 'uf_name',
'dataType' => 'String',
'label' => E::ts('Username'),
'break' => TRUE,
],
[
'size' => '',
'links' => [
[
'path' => '/civicrm/user/edit#?User1=[uf_id]',
'icon' => 'fa-key',
'text' => E::ts('Update account'),
'style' => 'default',
'condition' => [],
'task' => '',
'entity' => '',
'action' => '',
'join' => '',
'target' => '',
],
[
'path' => '/civicrm/admin/user/password',
'icon' => 'fa-keyboard',
'text' => E::ts('Update password'),
'style' => 'default',
'condition' => [],
'task' => '',
'entity' => '',
'action' => '',
'join' => '',
'target' => '',
],
'type' => 'buttons',
'label' => E::ts('Actions'),
'break' => TRUE,
],
],
'placeholder' => 5,
],
'acl_bypass' => TRUE,
],
'match' => [
'saved_search_id',
'name',
],
],
],
];

0 comments on commit 1cbaeae

Please sign in to comment.