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
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.
Shortly:
1 - Register action and set some inputs, e.g.
2 - Create call
Also, look at Elgg API web services
The page owner is supplied as a json object on every page
As mentioned for other info you'll need to create a callback/webservice or a view that loads it into each page. Keep in mind a page owner isn't always an ElggUser
Thanks to all!
This information handle me to go a little bit on in my plugin develop.
However i have a new problem:
I have correctly registered the action. my php file is linked with my javascript one and the are able to pass simple data like strings, number or boolean value...
...BUT: all elgg function that i call on my php file like
$owner = elgg_get_logged_in_user_entity();
$guid = elgg_get_logged_in_user_guid();
$logged = elgg_is_logged_in();
give a bad result . I explain.
elgg_get_logged_in_user_entity(); ---> give NULL
$guid = elgg_get_logged_in_user_guid(); ---> give 0
$logged = elgg_is_logged_in(); ---> give false
i think is a session problem. but i need that all those function must work for give back data to my js.
it is a handler problem? How to declare it correctly ?? it's a session problem???
thanks a lot for future answers.
@Arthy What's callback?
Sometimes, an example better of the words :)
Look at this code
My fault. i use an echo into my php for sending back variables value. i'll post my code now.
my js:
elgg.action('friendsgallery/myfile.php',{
dataType: "json",
success: function(response){
alert(response);
console.log("Response: " +response);
alert("Page Owner is: " +elgg.page_owner.name) ;
alert("Page Owner Entity is: " +elgg.page_owner.guid);
if(response){
//do something
}
else{
//error message
}
My php file is this:
<?php
require_once("/home/mydomain/public_html/engine/lib/elgglib.php");
require_once("/home/mydomain/public_html/engine/lib/pageowner.php");
require_once("/home/mydomain/public_html/engine/lib/output.php");
require_once("/home/mydomain/public_html/engine/lib/configuration.php");
require_once("/home/mydomain/public_html/engine/lib/sessions.php");
$my_variabile="somevar";
$owner = elgg_get_logged_in_user_entity();
$guid = elgg_get_logged_in_user_guid();
$logged = elgg_is_logged_in();
echo json_encode($logged);
?>
the problem is:
if i send back to my js the variable $my_variable, there is no problem
it works perfectly.
but if i try to send the variables $owner, $guid or $logged, i have as result in my js response rispecrively:
- NULL
- 0
- false
and i do not understand why!!!
thanks for answers.
Please i need help!!!!
You do not need this:
If your action is properly registered. If it isn't, then requiring these files isn't enough to properly boot the elgg system.
Elgg really does need an in depth documentations for this
You can boot elgg by
- Previous
- 1
- 2
- Next
You must log in to post replies.