Adding user through PHP or any way

Dear All,

I have two site installed  1) Simple PHP based website 2) Elgg website . Both are on the same server

When a user gets created on first PHP based website , I want to connect to elgg database ( It is accesble ) and create an elgg user . I wrote a PHP code and trying to insert record into elgg_users_entity table .But not sure how to generate "password" ( based on what algorithm ) ?  Or is there any PHP file I can copy it to my first website and call elgg API to create an user ? Kindly let me if it is the first way ( through PHP code) what other tables I have to populate ( for default widgets and or there any other)

Thanks for your help


  • include the Elgg engine in your PHP code and use the built in methods to add a user.

  • @bujji

    this has been done already since early 2009, tho most developers will not do it for free. i coded (most likely the first) automatic elgg user creator last year in about april. if you're interested in any custom work in this area - send me a PM..;-)

  • The function you want is register_user(). You can include the Elgg engine directly in your script or expose a method for registration through the web services.

  • Thanks a lot RPGRealms , DhrupDeScoop and Cash for your suggestions . I am working on it now .

    DhrupDeScoop :- Most developers will not do it for free , But I hope DhrupDeScoop does it :) :) . Just kidding . Thanks , I will ping you if I need any help .

  • bujji1  there is a plugin called "coreg"  that make the trick

    i just uploaded the zip to my site

    if you need it is here

    no need to make a new wheel :)

  • Thanks a lot Georges for your help . But got into a issue when installing it .It is not your code issue , but environment issue . I use wiredtree VPS for hosting . They are chaning all Hyphens (- ) to underscores(_) and the environment variable you asked me to set has Hyphen , so that is causing the problem . Can I change the env variable in the code to _(Underscore) and see ..?

    Thanks for your help






  • i used it whitout setting any variables 

    those variables are for accessing the svript from another host 

    if you run it from your web site it work like a charm 

    just one thing     Enable the RESTful API = ON in site config  (/pg/admin/site/)

  • Thanks for your reply . I am using 1.7.1 . Can I use it with this version ? Moreover I am not finding the folder structured you talked about ( /pg/admin/site)

    The ones I found are ...



    Could you please let me know the file name I have to modfy ? Thanks for your help

  • this is not a folder is an url

  • Thanks a lot for your response . It is enabled . When I try to get to register a user I got the below warining message , but the user is not registered

    Warning: htmlentities() expects parameter 1 to be string, array given in /home/teluguk/public_html/elggTest.php on line 26

    If I hit  , I am getting the response back in XML format ( ofcourse with faultString since the input data is missing)

    I printed the response I got using print_r method when I try to regsiter and the response is

    Array ( [0] => Array ( [faultCode] => -32400 [faultString] => ErrorXML-RPC Client IP,, not permitted to access )

    any thoughts ?