Skip to content

[11.9] Add custom attribute support to Users #705

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

igittigitt
Copy link

Added options to user lookup functions:

  • "with_custom_attributes" (true|false) to also get users custom attributes in resulting array
  • "custom_attributes" can contain an array of custom attributes to lookup users

Added functions:

  • "customAttributes(int $id)" to get all custom attributes defined for the user
  • "customAttribute(int $id, string $key)" to get single attribute by name
  • "createCustomAttribute(int $id, string $key, string $value)" to add another attribute (key/value)
  • "updateCustomAttribute(int $id, string $key, string $value)" to update (or create) an existing attribute
  • "removeCustomAttribute(int $id, string $key)" to delete an custom attribute by key

@GrahamCampbell GrahamCampbell changed the base branch from 11.7 to 11.8 April 24, 2022 18:50
@GrahamCampbell GrahamCampbell changed the title add user custom_attributes handling Add custom attribute support to Users Apr 24, 2022
@GrahamCampbell GrahamCampbell changed the title Add custom attribute support to Users [11.8] Add custom attribute support to Users Apr 24, 2022
Copy link
Member

@GrahamCampbell GrahamCampbell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. I've left some feedback to be addressed.

*/
public function customAttribute(int $id, string $key)
{
return $this->get('users/'.self::encodePath($id).'/custom_attributes/'.$key);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you forgot to encode the key

/**
* @param int $id
* @param string $key
* @param string $value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

invalid phpdoc

@GrahamCampbell GrahamCampbell changed the base branch from 11.8 to 11.9 April 24, 2022 19:04
@GrahamCampbell GrahamCampbell changed the title [11.8] Add custom attribute support to Users [11.9] Add custom attribute support to Users Apr 24, 2022
@stale
Copy link

stale bot commented Aug 31, 2022

This issue has been automatically marked as stale because there has been no recent activity. It will be closed after 30 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Aug 31, 2022
@stale stale bot closed this Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants