Hi everyone,
How can I use ElggBatch to create up to 1000 new user?
Regards,
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.
- Nikolai Shcherbin@rivervanrain

Nikolai Shcherbin - 0 likes
- Jerome Bakker@jeabakker

Jerome Bakker - 2 likes
- Hermand Pessek@rheman

Hermand Pessek - 0 likes
- Jerome Bakker@jeabakker

Jerome Bakker - 1 like
- Hermand Pessek@rheman

Hermand Pessek - 0 likes
- Hermand Pessek@rheman

Hermand Pessek - 0 likes
- Jerome Bakker@jeabakker

Jerome Bakker - 1 like
- Hermand Pessek@rheman

Hermand Pessek - 0 likes
You must log in to post replies.ElggBatch is a lazy-loading proxy for a result array from a fetching function.
Use for() loops, e.g.:
Do you need the users to be created based on actual data, or is testing data enough?
If you only need testing data, you can use the CLI command 'elgg-cli database:seed -t user -l 1000' this will generate 1000 testing users with random profile data.
https://learn.elgg.org/en/stable/intro/elgg-cli.html
Thanks a lot, @jeabakker!
That’s exactly what I was looking for.
I do have one more question: I developed my own custom seeder for user creation.
When using the "Seeder Inspect" in developer tools, I see two available seeders for users:
Seed Handler: Piwal\Piwal\Seeder
How can I execute my custom seeder for user creation from the command line?
Regards,
make sure your handler has it's own seeder type (with the function getType(), see https://github.com/Elgg/Elgg/blob/2137ec9dca0f354f2b1943c508a846d442ff4385/engine/classes/Elgg/Database/Seeds/Users.php#L141-L143). For example 'user2' or 'myusers'.
you can call the seeder with the cli 'elgg-cli database:seed -t user2 -l <number of users>'.
if you don't want all your users to be created in the same second you can add the params '--create_since=<date>' and '--create_until=<later date>'.
if you want your users to have icons you can add '--image_folder=<path to your Elgg installation>\.scripts\seeder\images\'
Thanks a lot. it works
I’ve integrated the Gravatar third-party libraries with PHP Faker, and it's working as expected. Now, I’m trying to generate a fake user avatar using Gravatar, but I’ve encountered an issue.
Here's how I retrieve the avatar path from the temp directory (
/tmp/e3395a721f569696dd6e9509dd20c8bb.jpg
), and it works fine:After that, I set the user’s avatar using the following method:
When trying to see the user profile the avatar is not displayed, and I have the following error in the log file
After investigation
The directory /var/data/elgg-6.x.x/5000/5667/profile/ does not contain a file named 5667medium.webp. It only contains a file named 5667master.jpg
So 5667medium.webp has not been generated.
Could someone help me ?
Regards,
can it be that the cli uses a different user than the webserver?
In your seeding (cli) only a master icon is created. Then on the website when you view a user the thumbnails are created which are needed. If the webserver can write the thumbnail (like it says in the error log) you won't see a thumbnail.
So check the permissions on the dataroot folder.
I found the issue. I was not running the cli as apache user.
Thanks a lot