Changeset 260 for trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/user_sync_xoops.php
- Timestamp:
- Jun 8, 2009, 11:43:01 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/user_sync_xoops.php
r232 r260 82 82 83 83 /* 84 * WP User ID exists is checked.. 85 */ 86 function is_used_wp_user_id($uid){ 87 global $xoops_db; 88 $sql = "SELECT ID FROM " . get_wp_prefix() . "users WHERE ID = $uid"; 89 $uid = $xoops_db->get_var($sql); 90 if (empty($uid)) 91 return false; 92 else 93 return true; 94 } 95 96 /* 84 97 * The user data of XOOPS is written in the WordPress user data. 85 98 * If $sync_uid is 0, all users are written. … … 162 175 $is_update = true; 163 176 }else{ 164 $wu_sql = "INSERT INTO $db_xpress_users "; 165 $wu_sql .= "(user_login , user_pass ,user_email , user_url , user_nicename " ; 166 $wu_sql .= " , user_registered , user_status , display_name) "; 167 $wu_sql .= "VALUES "; 168 $wu_sql .= "('$xoops_user->uname', '$xoops_user->pass', '$xoops_user->email', '$xoops_user->url', '$xoops_user->uname' "; 169 $wu_sql .= " , '$user_regist_time', $user_status, '$user_display_name')"; 170 $xoops_db->query($wu_sql); 171 // $wp_user_id = get_wp_user_id($user_login_name) ; 172 $wp_user_id = mysql_insert_id(); 177 if (is_used_wp_user_id($xoops_user->uid) ) { // WP User ID has already been used. 178 $wu_sql = "INSERT INTO $db_xpress_users "; 179 $wu_sql .= "(user_login , user_pass ,user_email , user_url , user_nicename " ; 180 $wu_sql .= " , user_registered , user_status , display_name) "; 181 $wu_sql .= "VALUES "; 182 $wu_sql .= "('$xoops_user->uname', '$xoops_user->pass', '$xoops_user->email', '$xoops_user->url', '$xoops_user->uname' "; 183 $wu_sql .= " , '$user_regist_time', $user_status, '$user_display_name')"; 184 $xoops_db->query($wu_sql); 185 $wp_user_id = mysql_insert_id(); 186 } else { // WP User ID has not been used yet. 187 $wu_sql = "INSERT INTO $db_xpress_users "; 188 $wu_sql .= "(ID , user_login , user_pass ,user_email , user_url , user_nicename " ; 189 $wu_sql .= " , user_registered , user_status , display_name) "; 190 $wu_sql .= "VALUES "; 191 $wu_sql .= "('$xoops_user->uid', '$xoops_user->uname', '$xoops_user->pass', '$xoops_user->email', '$xoops_user->url', '$xoops_user->uname' "; 192 $wu_sql .= " , '$user_regist_time', $user_status, '$user_display_name')"; 193 $xoops_db->query($wu_sql); 194 $wp_user_id = $xoops_user->uid; 195 } 173 196 $sycc_user = new WP_User($wp_user_id); 174 197 $sycc_user->set_role($capabillities_name);
Note: See TracChangeset
for help on using the changeset viewer.