16 protected $_profile_data = [];
45 $this->_profile_data =
null;
48 $this->$profile_field_name =
$value;
59 if (
_elgg_services()->userCapabilities->canBypassPermissionsCheck()) {
61 return $this->{$profile_field_name};
64 if (empty($this->guid)) {
67 'annotation_name' =>
"profile:{$profile_field_name}",
74 if (empty($annotations)) {
78 if (!is_array($annotations)) {
79 $annotations = [$annotations];
108 if (!isset($this->_profile_data[$logged_in_user_guid])) {
125 $this->_profile_data[$logged_in_user_guid] = $profile_data;
128 return $this->_profile_data[$logged_in_user_guid];
142 $this->_profile_data =
null;
Database abstraction query builder.
_elgg_services()
Get the global service provider.
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
deleteProfileData(string $profile_field_name)
Remove profile data.
annotate($name, $value, $access_id=ACCESS_PRIVATE, $owner_guid=0, $value_type='')
Adds an annotation to an entity.
getAnnotations(array $options=[])
Gets an array of annotations.
getAllProfileAnnotations()
Returns all profile annotations.
deleteAnnotations(?string $name=null)
Deletes all annotations on this object (annotations.entity_guid = $this->guid).
getProfileData(string $profile_field_name)
Get profile data.
trait ProfileData
Adds methods to save profile data to an ElggEntity.
deleteMetadata(?string $name=null)
Deletes all metadata on this object (metadata.entity_guid = $this->guid).
setProfileData(string $profile_field_name, $value, int $access_id=ACCESS_PRIVATE)
Store profile data.
elgg_get_logged_in_user_guid()
Return the current logged in user by guid.