Skip to content

feat: async CSV user import#1174

Open
niStee wants to merge 4 commits into
CatoTH:mainfrom
niStee:feature/csv-user-import
Open

feat: async CSV user import#1174
niStee wants to merge 4 commits into
CatoTH:mainfrom
niStee:feature/csv-user-import

Conversation

@niStee

@niStee niStee commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Closes #1138

Problem

Bulk adding users via the textarea form caps out quickly due to PHP max execution timeouts.

Solution

This PR introduces a robust CSV importer that chunks the upload from the frontend.

  • Uploads the CSV file once to a temporary server path.
  • JS polls the backend in batches.
  • PHP reads chunks using fseek() and fgetcsv().
  • Safely supports mapping existing users via a collision behavior dropdown (Skip, Merge Groups, Replace Groups).
  • Can optionally send welcome emails.

@niStee niStee force-pushed the feature/csv-user-import branch 2 times, most recently from f52022a to ecb0fc3 Compare June 6, 2026 02:42
@CatoTH

CatoTH commented Jun 6, 2026

Copy link
Copy Markdown
Owner

I can review / test this later. What I saw: it's english-only. It would be nice to make this translatable; pattern would be something like:
PHP Side:
messages/en/admin.php - define the keys and translations. Relevant quirk right now: it needs to be marked as js=true to be exposed into JS.
No need to define other translations, though feel free to add Dutch if you want :)

JS SIde:

import translations from "/js/vue/Translate.vue.js";
...
translations.getTranslation("user", "pw_min_x_chars");

Also, it would be good to have a sample CSV somewhere in docs/ .

@niStee

niStee commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

I've added the translations using Translate.vue.js and added a sample CSV to the docs/ directory! I also merged the latest main branch so it's completely up to date and ready for review.

@niStee niStee marked this pull request as ready for review June 11, 2026 02:17
Closes CatoTH#1138

This adds a scalable CSV user import tool directly to the
Users admin interface. It parses the CSV in chunks asynchronously
using Javascript and PHP's fseek, bypassing execution time limits
for large files without needing a backend job queue.
@niStee niStee force-pushed the feature/csv-user-import branch from 58de097 to f66e125 Compare June 11, 2026 07:14
Comment thread views/admin/users/_users_add_accounts.php Outdated
Comment thread views/admin/users/_users_add_accounts.php Outdated
Comment thread views/admin/users/_users_add_accounts.php Outdated
Comment thread controllers/admin/UsersController.php Outdated
Comment thread docs/sample_user_import.csv
Comment thread controllers/admin/UsersController.php Outdated
Comment thread web/js/modules/backend/UserAdminCsvImport.js Outdated
@niStee niStee requested a review from CatoTH June 19, 2026 20:24
@CatoTH

CatoTH commented Jun 20, 2026

Copy link
Copy Markdown
Owner

There were still some issues - but I could fix them in this Commit: cf4efb0 . I can either merge my MR, or you can cherry pick it if you want and then I can merge yours.

If you want to add yourself to the AUTHORS file, go ahead. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bulk CSV user import with invite emails

2 participants