Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scheduled Imports #9

Open
VR51 opened this issue Aug 5, 2021 · 3 comments
Open

Scheduled Imports #9

VR51 opened this issue Aug 5, 2021 · 3 comments

Comments

@VR51
Copy link

VR51 commented Aug 5, 2021

I have a CSV file hosted on a server that lists regularly updated user profile information. I have a download link for this CSV file. I want to automate the import process.

  1. Is there a code snippet to enable scheduled CSV imports? Maybe a snippet that allows site admins to set a cron job that passes the CSV file URL to Import Users from CSV; or
  2. Is there function I can add to a PHP file in which I can set static import options (e.g file to import, 'update profiles that already exist') then ping the PHP file when I want the import to run?

I'm open to other ideas. I'm considering editing the plugin to make it suit my particular use case but I'd prefer to use a code snippet if one already exists.

Thank you,
Lee

@VR51
Copy link
Author

VR51 commented Aug 6, 2021

I've written a snippet to automate the import process. The snippet can be found here https://gist.github.com/VR51/bd90a1dabfa32a90a122ff8760fd0fd3

The snippet goes into functions.php. It sets a WP cron job to run a function that passes preset values to import_csv().

Please do let me know if you see any gotchas or can add improvements to the snippet.

@VR51 VR51 closed this as completed Aug 6, 2021
@VR51 VR51 reopened this Aug 19, 2021
@VR51
Copy link
Author

VR51 commented Aug 19, 2021

Thought I had already updated this. I forked this plugin and made a few feature changes. The fork can be found here https://github.com/VR51/import-users-from-csv

This fork includes scheduled imports, option to delete the error log file and various minor changes to the settings page.

I have a few more changes to make to the fork. When I've finished I will issue a pull request.

@andrewlimaza
Copy link

Thanks for sharing this, I'll look over this when I get a chance! Sorry I don't monitor the Github issues too closely always.

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

No branches or pull requests

2 participants