Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: How to bind a user using WP API
sidebar_position: 6
sidebar_position: 30
slug: /knowledge-base/bind-user-via-api
tags:
- Knowledge base
Expand Down
32 changes: 32 additions & 0 deletions datapress/knowledge_base/devInfo/users/bound_user_details.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: Accessing bound user contact details
sidebar_position: 25
slug: /knowledge-base/bound-user-details
tags:
- Knowledge base
- DataPress
- Retrieve
- User Binding
---

If you need to access information about the currently logged-in user in PHP. It can be easily done by using **UserService** class that has methods to return the current user information including the linked CRM record (if available).

Once the bound contact is retrieved, **WebApiClient** class can be used to access additional information. Connection required for the toolkit to work properly is provided by the **ConnectionService** class.

```php
use AlexaCRM\Nextgen\ConnectionService;
use AlexaCRM\Nextgen\UserService;
use AlexaCRM\Xrm\ColumnSet;
use AlexaCRM\Xrm\EntityReference;

$userService = UserService::instance();

if ($userService->isBound()){
$contact = $userService->getBoundRecord();

/** @var EntityReference $accountRef */
$accountRef = $contact['parentcustomerid'];
$account = ConnectionService::instance()->getClient()->Retrieve('account', $accountRef->Id, new ColumnSet(['accountnumber']));
$accountNum = $account['accountnumber'];
}
```
2 changes: 1 addition & 1 deletion datapress/knowledge_base/devInfo/users/bound_users.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: How to display a list of bound users in WordPress
sidebar_position: 5
sidebar_position: 20
slug: /knowledge-base/bound-users
tags:
- Knowledge base
Expand Down
2 changes: 1 addition & 1 deletion datapress/knowledge_base/devInfo/users/crm_dev.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Automating User Management in PowerApps with Flows
sidebar_position: 8
sidebar_position: 50
slug: /knowledge-base/user-management-in-powerapps
tags:
- User Management
Expand Down
2 changes: 1 addition & 1 deletion datapress/knowledge_base/devInfo/users/manage_user.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Manage users
sidebar_position: 4
sidebar_position: 10
slug: /knowledge-base/manage-users
tags:
- Knowledge base
Expand Down
27 changes: 27 additions & 0 deletions datapress/knowledge_base/devInfo/users/user_edit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: Editing user profile
sidebar_position: 27
slug: /knowledge-base/user-editing
tags:
- Knowledge base
- DataPress
- Binding
- User
---

If a page is bound to a contact table then passing contact identifier in the query string will set the `binding` object and allow record editing using, for example, a Gravity form that relies on the record binding.

Allowing user to edit their own Dataverse record is slightly different. We already know the contact id and shouldn’t pass it via the query string.

This can be used, for example, to build a page that uses Gravity Form for user profile editing.

```php
// Let's assume that profile page ID is 42
add_filter( 'integration-cds/binding/bound-record', function( $record, $post ) {
if ( $post->ID !== 42 ) {
return $record;
}

return \AlexaCRM\Nextgen\UserService\UserService::instance()->getBoundRecord();
}, 10, 2 );
```
2 changes: 1 addition & 1 deletion datapress/knowledge_base/devInfo/users/wp_users_table.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: WordPress Users Table
sidebar_position: 7
sidebar_position: 40
slug: /knowledge-base/wp-users-table
tags:
- Knowledge base
Expand Down