最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

cms - How can I import users into WordPress?

programmeradmin1浏览0评论

I have a spreadsheet (XLS) of names, email addresses, and passwords from another content management system. Is there a way to import these folks as users (I think subscriber level, but some may be Editors as well) into WordPress?

I have a spreadsheet (XLS) of names, email addresses, and passwords from another content management system. Is there a way to import these folks as users (I think subscriber level, but some may be Editors as well) into WordPress?

Share Improve this question asked Aug 11, 2010 at 20:36 artlungartlung 3,0976 gold badges29 silver badges37 bronze badges
Add a comment  | 

4 Answers 4

Reset to default 6

A new file, import.php:

<?php

define('WP_INSTALLING', true); // this is required. i forget why!

include '/path/to/wordpress/wp-load.php';
include ABSPATH . WPINC . '/registration.php'; // wp_insert_user()

$userdata = array('user_login' => 'jdoe', 'user_pass' => 'foobar');
$user_id = wp_insert_user($userdata);

Check wp_insert_user() for other possible fields. Run update_usermeta() for any additional needed meta fields. (Including user level, though there may be convenience functions.)

Note that here at work we redefine the wp_authenticate() function (it's in pluggable.php, so it can be replaced by defining it in your own plugin) and creating user accounts on-demand if they don't exist at login time.

I would use a plugin for that. When done, remove the plugin.

This one by Dagon Design seems to do the trick, but it was not updated for wordpress 3. Don't know if it will work, so you migth want to try it on a sample wordpress.

You can also directly import them using the SQL databases, running an SQL query using the code from the downloaded SQL file from the previous server which contains all the users. That's what I would do, it is very easy.

You can easily migrate users using the free plugin Import export WordPress users

发布评论

评论列表(0)

  1. 暂无评论