Hello Gurus !
I'm a newbie here... I wrote a testing php script-file of
<?php
function get_user_by_username($username) { return _elgg_services()->usersTable->getByUsername($username);}
echo get_user_by_username("drleos")."\n";
?>
When running the file as php -f <script-file>, I get "PHP Fatal error: Call to undefined function _elgg_services() in <script-file> on line 10". But the "_elgg_services" function is used in various files under elgg/mod/.
How should I know that function known to php? Please advise kindly...
jh
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.
- Juho Jaakkola@juho.jaakkola

Juho Jaakkola - 0 likes
- JHalifax@halifax

JHalifax - 0 likes
- ihayredinov@ihayredinov

ihayredinov - 0 likes
- JHalifax@halifax

JHalifax - 0 likes
- Steve Clay@steve_clay

Steve Clay - 0 likes
- Jose Alemany Bordera@jalemany1

Jose Alemany Bordera - 0 likes
You must log in to post replies.In Elgg 1:
In Elgg 2:
The correct path to the autoload.php file depends on where your own script is located.
Thank you so much Juho!
The 2nd option is the right for me. :) May I have one question more? If I wanted to use other function (than given in my inquiry) do I need to use the same what you advised me to get the functions defined, or something else ?
Thank you so much..
That is what plugins are for, you can call any core function in a plugin without having to boot the engine manually. There is lots in the docs http://learn.elgg.org/en/2.0/guides/plugins/plugin-skeleton.html
Hi Ismayil,
Thank you so much. I'll read what you recommended me.
Thank you again.
jh
Note, not all Elgg APIs are public. Anything starting with "_" or marked @access private is off-limits and will change or be removed without notice!
[Moderator: this comment was off-topic. It was moved to its own topic. Read it here.]