-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathuser.php
55 lines (47 loc) · 2.12 KB
/
user.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
set_time_limit( 1800 );
require_once 'config.php';
$wpdb = new wpdb( WPDP_USER, WPDP_PASS, WPDP_DB, WPDP_HOST );
$joomdb = new wpdb( JOOM_USER, JOOM_PASS, JOOM_DB, JOOM_HOST );
$users = $joomdb->get_results( 'select * from ' . JOOM_PREFIX . 'users' );
if ( $users ) {
foreach ($users as $user) {
$user_data = array(
'ID' => $user->id,
'user_pass' => $user->password,
'user_login' => $user->username,
'user_email' => $user->email,
'display_name' => $user->name,
'user_registered' => $user->registerDate,
);
$user_metadata_capabilities = array(
'user_id' => $user->id,
'meta_key' => 'wp_capabilities',
'meta_value' => 'a:1:{s:10:"subscriber";b:1;}' // change subscriber to something else if you want to
);
$user_metadata_joomlapass = array(
'user_id' => $user->id,
'meta_key' => 'joomlapass',
'meta_value' => $user->password
);
$user_metadata_user_level = array(
'user_id' => $user->id,
'meta_key' => 'wp_user_level',
'meta_value' => '0' // change wp_user_level if you want to
);
$wpdb->insert(''. WPDP_PREFIX . 'users', $user_data);
$wpdb->insert(''. WPDP_PREFIX . 'usermeta', $user_metadata_joomlapass);
// $wpdb->insert(''. WPDP_PREFIX . 'usermeta', $user_metadata_user_level);
//In Simple SQL
/*
INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`)
VALUES ('newadmin', MD5('pass123'), 'firstname lastname', 'email@example.com', '0');
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES (NULL, (Select max(id) FROM wp_users), 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES (NULL, (Select max(id) FROM wp_users), 'wp_user_level', '10');
*/
}
}
echo '<br>';
echo 'Users are Transferred';