Plugin developers usually want to use the magic set method ($entity->name = 'value').
Use this method if you want to explicitly set the owner or access of the metadata.
You cannot set the owner/access before the entity has been saved.
public setMetadata ( string $name, mixed $value, string $value_type = '', boolean $multiple = false, integer $owner_guid, integer $access_id = null ) : boolean | ||
$name | string | Name of the metadata |
$value | mixed | Value of the metadata (doesn't support assoc arrays) |
$value_type | string | 'text', 'integer', or '' for automatic detection |
$multiple | boolean | Allow multiple values for a single name. Does not support associative arrays. |
$owner_guid | integer | GUID of entity that owns the metadata. Default is owner of entity. |
$access_id | integer | Who can read the metadata relative to the owner (deprecated). Default is the access level of the entity. Use ACCESS_PUBLIC for compatibility with Elgg 3.0 |
return | boolean |