try :-
remove_metadata($certificate_guid, 'ref1');
create_metadata($certificate_guid, 'ref1', $val1, 'text', $certificate_guid, ACCESS_PUBLIC);
no luck. As soon as I remove the admin privileges from the user, it doesn´t edit. :(
thanks anyway and enjoy the rest of your weekend.
Depending on who is executing the code, and who has write access to the metadata, it may be that you need to use the permissions plugin hook to grant permission.
Try this:
in start.php
// override permissions for the certificate_permission_overwrite context
register_plugin_hook('permissions_check', 'all', 'certificate_permissions_check');function certificate_permissions_check(){
if(get_context() == "certificate_permission_overwrite"){
return true;
}
return NULL;
}
And where you are editing your metadata prepend and append the following:
$context = get_context();
set_context('certificate_permission_overwrite');
// do you metadata stuff here
set_context($context);
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.