user import

15 views
Skip to first unread message

nushret

unread,
Aug 15, 2015, 10:01:58 AM8/15/15
to uFlex
Hi
How do I add multiple users with csv? is it possible?

Pablo Tejada

unread,
Aug 15, 2015, 10:14:38 AM8/15/15
to uFlex

Hi,

It is possible, but there is no built-in support for this. It can be done with a custom PHP script or a MySQL import.


On Sat, Aug 15, 2015, 10:02 AM nushret <nku...@gmail.com> wrote:
Hi
How do I add multiple users with csv? is it possible?

--
Project's home page http://ptejada.com/projects/uFlex/
---
You received this message because you are subscribed to the Google Groups "uFlex" group.
To unsubscribe from this group and stop receiving emails from it, send an email to uflex+un...@googlegroups.com.
To post to this group, send email to uf...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/uflex/c5175ff9-2020-4751-acd1-1806e48bbb3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

Sincerely,

Pablo Tejada

From Mobile

nushret

unread,
Aug 15, 2015, 10:44:40 AM8/15/15
to uFlex
Thanks Pablo
How do I create hashed passwords, I don't know it

for example

user1  123456     hashed(123456) -> how do i hashed manually?
user2   647463    hashed(647463) -> how do i hashed manually?
user3   352425    hashed(352425) -> how do i hashed manually?

Help me with example code




15 Ağustos 2015 Cumartesi 17:14:38 UTC+3 tarihinde Pablo yazdı:

Pablo

unread,
Aug 15, 2015, 1:21:02 PM8/15/15
to uFlex
Hi,

The password will be automatically hashed when using the User::register() method. Please see example below:

$user = new User();

// If all you have is the username and password then you must disable the email requirement
$user->addValidation('Email','0-50','');

// Assuming $allUsers is a multi-dimensional array representation of the rows and columns
foreach($allRows as $row)
{
/*
* Assign each element of the array to a variable, this assumes there are only two elements:
* the username and the clear text password
*/
list($username, $password) = $row;

/*
* Register the user
*/
$user->register(array(
'Username' => $username,
'Password' => $password,
));
}

nushret

unread,
Aug 15, 2015, 2:04:23 PM8/15/15
to uFlex

 i have an error

Fatal error: Class 'User' not found 
i think $user = new User(); is


15 Ağustos 2015 Cumartesi 20:21:02 UTC+3 tarihinde Pablo yazdı:

Pablo Tejada

unread,
Aug 15, 2015, 3:26:07 PM8/15/15
to uFlex
Hi,
You will need to import the user class:
use ptejada\uFlex\User;
Or use the full qualified path for the user class:
$user = new \ptejada\uFlex\User();

The sample that I provided is not full working script for your import, just an example on how to loop to all users and create them.





For more options, visit https://groups.google.com/d/optout.

nushret

unread,
Aug 16, 2015, 5:20:12 AM8/16/15
to uFlex
Hi Pablo 
Thank you no error now
But don't registered any user. my final code is below



Kodu burainclude './uFlex/core/config.php';
include './uFlex/core/validations.php';
$user = new ptejada\uFlex\User();
$user->start();

// If all you have is the username and password then you must disable the email requirement
$user->addValidation('Email','0-50','');

// Assuming $allUsers is a multi-dimensional array representation of the rows and columns

$allRows = array(
array("User1", "123456","as...@aaaa.com"),
array("User2", "34455","asaft...@aaaa.com"),
array("User3", "65656","as...@atyytaa.com")
);

foreach($allRows as $row)
{
    /*
     * Assign each element of the array to a variable, this assumes there are only two elements: 
     * the username and the clear text password
     */
// print_r($row);
 
    list($username, $password, $email) = $row;

    /*
     * Register the user 
     
   */
   $user->register(array(
        'Username' => $username,
        'Password' => $password,
'Email' => $email,
'Activated' => 1
    ));
}ya girin...





15 Ağustos 2015 Cumartesi 22:26:07 UTC+3 tarihinde Pablo yazdı:

nushret

unread,
Aug 16, 2015, 5:27:06 AM8/16/15
to uFlex
15 Ağustos 2015 Cumartesi 17:01:58 UTC+3 tarihinde nushret yazdı:

nushret

unread,
Aug 16, 2015, 6:23:15 AM8/16/15
to uFlex
Now users inserted database but i don't login with imported users




15 Ağustos 2015 Cumartesi 17:01:58 UTC+3 tarihinde nushret yazdı:
Hi
Clipboard01.jpg

nushret

unread,
Aug 16, 2015, 6:43:42 AM8/16/15
to uFlex
Thank you Pablo

Everything is ok.
i'm doing import users  :)


15 Ağustos 2015 Cumartesi 17:01:58 UTC+3 tarihinde nushret yazdı:
Hi
Reply all
Reply to author
Forward
0 new messages