Add users to database

Hi I try to insert my existing users to databese with this code:

In PHPmyAdmin

INSERT INTO elggusers_entity (guid, name, username, password, email, banned, prev_last_action, last_login, prev_last_login)

VALUE('1003','Johnny','john', '5e6b0666320d89ecf45cbcc6d901bd70', 'john@domain.de', 'no', 0, 0, 0)

It works but I get the error when I try to login on my page with john

We couldn't log you in. This may be because you haven't validated your account yet, the details you supplied were incorrect, or you have made too many incorrect login attempts. Make sure your details are correct and please try again.

Any Ideas why?

  • :) Thanks Dhrup

    I try to copy my users from joomla database to elgg.

  • to (2) Why I don't do that? Because of my english.

    Thanks for helping Dhrup I will try your suggestion. I think it is more elegant solution to add users. :)))

     

     

  • hi dhrup... i've been looking for this....

    i have a small network of people that i am building a elgg site for to help keep track of work...

    how do i use the above to add 10 people at a time? do i just create a page and plug that code in multiple times?

    also...

    once i add those people is there any kind of plugin where i can add all members as a friend to each of the members i set up?

    i'm going to do it manually but if there's a quicker way that would be awesom!

     

  • @brooklyntam

    I think you must put something in variables and than use foreach or while function of php it somewher in internet... the solution :)

     

  • here is the script now

     

    // Benutzer auswählen
    //$user abfrage = mysql_query("SELECT name, id, email FROM jv_users ORDER BY id "); 

    $auswahl=mysql_fetch_object(mysql_query("SELECT name, id, email FROM jv_users ORDER BY id "));

    // Jetzt SCHREIBE ICH IN DIE VARIABLEN
    // Benutzername und der Name
    $username = ;
    $name = ;

    //Passwort für alle Gleich
    $password = zTfG45DqQ;

    //Email des Benutzers
    $email = substr($auswahl->WHERE `email` = $email);

    //Benutzer ID
    $benutzer_id = ;

    //Dieses Stück Script trägt die Benutzer in
    $guid = register_user($username, $password, $name, $email, true);
    $new_user = get_entity($guid);
    $new_user->access_id = $benutzer_id;
    $new_user->admin_created = true;
    $new_user->enable();

  • @alfalive - Ich werde versuchen es - Vielen Dank!

    @dhrup - thanks for the heads up will set up a dev site to test with!

     

    attempt at translation:

    // Benutzer auswählen = User to select
    //$user abfrage = mysql_query("SELECT name, id, email FROM jv_users ORDER BY id "); 

    $auswahl=mysql_fetch_object(mysql_query("SELECT name, id, email FROM jv_users ORDER BY id "));

     

    // Jetzt SCHREIBE ICH IN DIE VARIABLEN = Now I write in the variables
    // Benutzername und der Name = User name and the name
    $username = ;
    $name = ;

     

    //Passwort für alle Gleich = Add the same password for all

    $password = zTfG45DqQ;

     

    //Email des Benutzers = Email User
    $email = substr($auswahl->WHERE `email` = $email);

     

    //Benutzer ID = User ID
    $benutzer_id = ;

     

    //Dieses Stück Script trägt die Benutzer in = This piece of script, the user

    $guid = register_user($username, $password, $name, $email, true);
    $new_user = get_entity($guid);
    $new_user->access_id = $benutzer_id;
    $new_user->admin_created = true;
    $new_user->enable();

  • one thing i don't know how to do is load it using the elgg's API functions.

    still researching that //www.freefever.com/animatedgifs/animated/stickman3.gif” cannot be displayed, because it contains errors.

  • The script that I posted is incomplete! Just to show what I did.

     

     

  • If you want to import users and friends, you can use my migration plugin (oddbod). You would have to export your users as ODD files though. Once you do that, you can import them by just pointing the plugin at the exported users file.

  • Thanks for oddbod. But I can't use it because I use joomla on cheap hosting. So I can not install ruby.