| « Reflections on Learning Technologies 2009 | Be HypeAware » |
b2evolution is a superb multi-user, multi-blogging tool - far easier to setup than WordpressMU for multi-blog sites.
At the moment, though, users have to be added manually - either through self-registration or through the admin backend.
I was looking for a script to help automate this for a corporate blogging site I'm working on. There was nothing in the b2evolution forums, but I found one on the Mambo forum - written by Wayne Stewart: http://forum.mamboserver.com/showthread.php?t=17358
I've adapted it for b2evolution, and added some more code to test whether the users already exist. If they do, then the script exits and asks you to check the existing users in the PHP file. Otherwise you'd end up with multiple users with the same username - bad news!
The attached zip file contains a php file and a sample csv file. The PHP file should be placed alongside the CSV file in your b2evolution folder structure, and run directly from the browser address bar.
Please note:
- This is alpha software. There are no warranties, and I can't guarantee I'll be able to support you if you try it out.
- For security, please remove the CSV file and the import script from your server after each run
Things that would improve it...
- Integrate the script more fully with b2evolution's authentication and permissions system, so only admins can run it
- Incorporate a browse function to allow CSV files to be uploaded
- Make the preset variables populatable from a form
- Make the testing mode switchable from a form
I've tried to make the code as fully commented as possible (keeping most of Wayne's original comments). If there are any questions, give me a shout.
[Update: v0.2 uploaded with Testing Mode on by default]
12 comments
And I thought when I saw there was a post it would be about the snow, my mistake then.
Cheers
James
Snow! Nothing so trivial :-) Although, I suppose it is being described as an “extreme weather event"! Just a little bit OTT…
I am really new at this stuff. I uploaded these files to my b2evo site. Now how and where to I run the php code?
Hi Dave,
Let’s say you’ve uploaded them to a folder on your site called /bulkupload.
All you have to do then is put the following address in your browser: http://www.yourwebsite.com/bulkupload/b2evo_import.php
That will run the script.
Cheers,
Mark
Hi Mark,
Thanks for the script - it was exactly what I was looking for. I thought I’d mention that it seems there’s a typo in the latest version of the import script which leads to an error:
evo_users not updated. Error is: Incorrect datetime value: ‘’ for column ‘dateYMDhour’ at row 1
Checking the script, I saw that the INSERT SQL query lists the date value as $dateYMBtime - changing this to $dateYMDtime got rid of the error and imported my users with no problem.
Thanks again,
Matt
@Matt,
Thanks for the feedback. As soon as I get a chance I’ll update the script.
I will check out your acript. Thanks for the information.
Our Team have dropped Wordpress in preference to b2e for multi blog sites. Way simpler
Use this script !
Great info on b2e - it is a remarkable platform and I’m nearly a convert - the script should prove valuable, thanks
this is nice but it only loads the first line of my CVS file (just one user) what am I doing wrong