Extract with a jquery/js or ajax/php owner_page name, his friends name, utl of pages and icons

hi i'm a begginer in ELGG, so i have a question...i really need to know how to Extract with a jquery/js or ajax/php:
1)owner_page name,

2)his friends name,

3)url of pages and icons?

regards.Thanks

  • 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.

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking