Last active
December 18, 2015 04:18
-
-
Save hypeJunction/5724079 to your computer and use it in GitHub Desktop.
Elgg/Elgg #5598
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$user = elgg_get_logged_in_user_entity(); | |
// Create test blog entry with some metadata | |
$location = 'New York City, USA'; | |
$tags = array('photography', 'web design', 'art'); | |
$blog = new ElggObject(); | |
$blog->subtype = 'blog'; | |
$blog->title = 'Some title'; | |
$blog->description = 'Some content'; | |
$blog->owner_guid = $user->guid; | |
$blog->container_guid = $user->guid; | |
$blog->access_id = ACCESS_PUBLIC; | |
$blog->location = $location; | |
$blog->tags = $tags; | |
$blog->save(); | |
exit; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Try assinging some new metadata using create_metadata() | |
$location = 'Berlin, Germany'; | |
$tags = array('fashion', 'design clothing', 'sprint collection'); | |
$blogs = elgg_get_entities(array( | |
'types' => 'object', | |
'subtypes' => 'blog', | |
'limit' => 1 | |
)); | |
$blog = $blogs[0]; | |
$user = elgg_get_logged_in_user_entity(); | |
print_r($blog->location); | |
print_r($blog->tags); | |
create_metadata($blog->guid, 'location', $location, '', $blog->owner_guid, ACCESS_FRIENDS); | |
foreach ($tags as $tag) { | |
create_metadata($blog->guid, 'tags', $tag, '', $blog->owner_guid, ACCESS_FRIENDS, true); | |
} | |
print_r($blog->location); | |
print_r($blog->tags); | |
exit; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment