getting user data from external script

Im trying to create a chat sub system for my elgg users, my chat script which is indepenet (not being called by elgg's system) needs to get the  GUID of the currently logged user and it's friends list.

should i be loading using require() input.php,entities.php and then call getInput()/getEntity() ?

im not sure how am i suppose to do that. any suggestions ? how do i access the data of elgg, from outside elgg ?

  • If you're not wanting to load up the entire Elgg engine you'll have to write custom SQL to grab the friends list from the relationships table.  Cherry picking files to include probably won't work.

    Also, if you just want to grab the guid that's passed as get/post, you don't need to use Elgg's get_input()--just use PHP's $_GET/$_POST superglobal.

  • I havnet checked it yet, but i dont think i'd have access to that data inside my script, my $_GET/$_POST variabled will not contain the fields of the elgg system. my script is not being loaded (using require on include) from inside an elgg php page so they dont share variables.

    My script is being loaded using javascript lines executed inside the elgg pages, also $_GET/$_POST data can be manipulated by the user which can be unsafe.

    lets say i want to load the elgg engine and have access to functions like get_input(), how do one do that ?

  • require_once 'elgg/engine/start.php';  will pull in the entire engine.

    You'll have to adjust the path, of course...