hi, I am trying to expose a function that will update metadata on an entity/object. i have initialized this object ($game) in another function and added the metadata:
$game->squares=array("TL"=>0, "TC"=>0, "TR"=>0, "L"=>0, "C"=>0, "R"=>0, "BL"=>0,"BC"=>0,"BR"=>0);
and my function to edit this is:
$player=get_loggedin_userid();
$game->squares[$space]=$player;
return $game->squares[$space];
where $space is of TL, TC, TR.... sent over the network as a parameter. This returns nothing to my client. i have returned $player and $space for debugging purposes and this returns what is expected. Seems as though what is not working is the squares array. I have a feeling the type of $space is not correct.
Any Ideas? Any help would be appreciated, thanks!
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
i figured it out. the users did not have write permissions.
i added the permissions_check plugin hook and it works fine now
i actually saw that part on relationships, but i was too far into the project to redo everything. i will look into that next.
thanks
Avines, you may sometimes also experience trouble when saving single element to metadata array. It's generally safer to use serialize/unserialize when storing arrays in metadata.
I just abandoned the idea of arrays. I ended up with much more coding than had anticipated, but it works nontheless.
- Previous
- 1
- 2
- Next
You must log in to post replies.