Please dig into the code. Everything you needed is included in the package. FYI see http://reference.elgg.org/users_8php.html#a748009867ea453c217f7530c2de1247d
Pls, stay tuned on the same topic and don't create the duplicates
Also - now that I reread your code when I'm awake:
What's the call to the action for anyway?
The logged in user/guid/is logged in can all be determined through js without an additional call to the server
var user = elgg.get_logged_in_user_entity();
var guid = elgg.get_logged_in_user_guid();
var is_logged = elgg.is_logged_in();
See https://github.com/Elgg/Elgg/blob/master/js/lib/session.js#L82
Thanks to all, i've solved some problems but i have a new one.
in my php, action page all ELGG functions work, but not elgg_get_page_owner_entity()
This is my code:
$control_logged_guid = json_decode($_POST['o_guid']); //recived from elgg.action{...}
$control_owner_guid = json_decode($_POST['l_guid']);
$guid = elgg_get_logged_in_user_guid();
$logged = elgg_get_logged_in_user_entity();
//$owner = elgg_get_page_owner_entity(); DO NOT WORK!!! return false!!
$friends=$logged->getFriends();
$dim=count($friends);
$logged_name=$logged['name'];
$logged_icon=$logged->getIcon("small");
$logged_guid=$guid;
$logged_url=$logged->getUrl();
$user_data = array (
'owner_guid'=>$logged_guid,
'owner_name'=>$logged_name,
'owner_icon_url'=>$logged_icon,
'logged_in_url'=>$logged_url,
);
for($i=0;$i<$dim;$i++){
$friends_data[$i] = array (
'name'=>$friends[$i]["name"],
'icon_url'=>$friends[$i]->getIcon("small"),
'page_url'=>$friends[$i]->getUrl(),
'guid'=>$friends[$i]["guid"],
);
}
$data_array = array (
$user_data, $friends_data,
);
echo json_encode($data_array);
when i se in my Chrome Debugger, if i use that function i have this message:
POST http://lare.biz/action/yourplugin/yourfile.php 500 (Internal Server Error)
thx for response.
Not every page has an owner. Actions do not have owners.
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.