- Timestamp:
- May 23, 2009, 1:55:58 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/plugins/xpressme/include/user_sync_xoops.php
r175 r230 100 100 101 101 $xoops_users = $xoops_db->get_results($xu_sql); 102 102 103 if (empty($xoops_users)){ 103 104 $message .= '...ERR ('. $xu_sql . ')'; … … 109 110 $capabillities_name = $role['capabillities']; 110 111 $allway_update = $role['allway_update']; 112 113 $wp_user_id = get_wp_user_id($xoops_user->uname) ; 114 111 115 if (empty($capabillities_name)){ 116 if ($sync_uid != 0){ 117 if ($wp_user_id) { 118 if ($allway_update){ 119 $message .= '...NOT XPRESS USER ' . $xoops_user->uname; 120 return false; 121 } 122 } else { 123 $message .= '...NOT XPRESS USER ' . $xoops_user->uname; 124 return false; 125 } 126 } else { 112 127 $message .= "...PASS '" . $xoops_user->uname ."'[uid=".$xoops_user->uid ."](not xpress user)"; 113 if ($sync_uid != 0){ 114 $message .= '...NOT XPRESS USER ' . $xoops_user->uname; 115 return false; 116 } 117 } else { 118 $user_regist_time = date('Y-m-d H:i:s' , $xoops_user->user_regdate); 119 $user_status = 0; 120 $user_display_name =empty($xoops_user->name) ? $xoops_user->uname :$xoops_user->name ; 121 122 $is_update = false; 123 124 $wp_user_id = get_wp_user_id($xoops_user->uname) ; 125 if ($wp_user_id){ 126 $wu_sql = "UPDATE $db_xpress_users "; 127 $wu_sql .= 'SET '; 128 $wu_sql .= "user_pass = '$xoops_user->pass', "; 129 $wu_sql .= "user_email = '$xoops_user->email', "; 130 $wu_sql .= "user_url = '$xoops_user->url', "; 131 $wu_sql .= "user_nicename = '$xoops_user->uname', "; 132 $wu_sql .= "user_registered = '$user_regist_time', "; 133 $wu_sql .= "user_status = 0 "; 134 $wu_sql .= "WHERE (user_login = '$xoops_user->uname' )"; 135 136 $xoops_db->query($wu_sql); 137 if ($allway_update){ 138 $sycc_user = new WP_User($wp_user_id); 139 $sycc_user->set_role($capabillities_name); 140 $message .= '...UPDATE ' . $xoops_user->uname . '(' . $capabillities_name . ')'; 141 142 } else { 143 $message .= '...UPDATE ' . $xoops_user->uname . '(Level Not Change)'; 144 } 145 if (!check_user_meta_prefix($wp_user_id)){ 146 repair_user_meta_prefix(); 147 } 148 149 $is_update = true; 150 }else{ 151 $wu_sql = "INSERT INTO $db_xpress_users "; 152 $wu_sql .= "(user_login , user_pass ,user_email , user_url , user_nicename " ; 153 $wu_sql .= " , user_registered , user_status , display_name) "; 154 $wu_sql .= "VALUES "; 155 $wu_sql .= "('$xoops_user->uname', '$xoops_user->pass', '$xoops_user->email', '$xoops_user->url', '$xoops_user->uname' "; 156 $wu_sql .= " , '$user_regist_time', $user_status, '$user_display_name')"; 157 $xoops_db->query($wu_sql); 128 continue; 129 } 130 } 131 132 $user_regist_time = date('Y-m-d H:i:s' , $xoops_user->user_regdate); 133 $user_status = 0; 134 $user_display_name =empty($xoops_user->name) ? $xoops_user->uname :$xoops_user->name ; 135 136 $is_update = false; 137 138 if ($wp_user_id){ 139 $wu_sql = "UPDATE $db_xpress_users "; 140 $wu_sql .= 'SET '; 141 $wu_sql .= "user_pass = '$xoops_user->pass', "; 142 $wu_sql .= "user_email = '$xoops_user->email', "; 143 $wu_sql .= "user_url = '$xoops_user->url', "; 144 $wu_sql .= "user_nicename = '$xoops_user->uname', "; 145 $wu_sql .= "user_registered = '$user_regist_time', "; 146 $wu_sql .= "user_status = 0 "; 147 $wu_sql .= "WHERE (user_login = '$xoops_user->uname' )"; 148 149 $xoops_db->query($wu_sql); 150 if ($allway_update){ 151 $sycc_user = new WP_User($wp_user_id); 152 $sycc_user->set_role($capabillities_name); 153 $message .= '...UPDATE ' . $xoops_user->uname . '(' . $capabillities_name . ')'; 154 155 } else { 156 $message .= '...UPDATE ' . $xoops_user->uname . '(Level Not Change)'; 157 } 158 if (!check_user_meta_prefix($wp_user_id)){ 159 repair_user_meta_prefix(); 160 } 161 162 $is_update = true; 163 }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); 158 171 // $wp_user_id = get_wp_user_id($user_login_name) ; 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 172 $wp_user_id = mysql_insert_id(); 173 $sycc_user = new WP_User($wp_user_id); 174 $sycc_user->set_role($capabillities_name); 175 $message .= '...INSERT ' . $user_login_name . '(' . $capabillities_name . ')'; 176 } 177 178 $user_nickname = empty($xoops_user->name) ? $xoops_user->uname :$xoops_user->name ; 179 $user_rich_editing = 'true'; 180 $user_first_name = $xoops_user->uname; 181 $user_last_name = ''; 182 $user_description = ''; 183 $user_jabber = ''; 184 185 update_usermeta( $wp_user_id,'nickname',$user_nickname); 186 update_usermeta( $wp_user_id,'first_name',$user_first_name); 187 update_usermeta( $wp_user_id,'last_name',$user_last_name); 188 update_usermeta( $wp_user_id,'description',$user_description); 189 update_usermeta( $wp_user_id,'jabber',$user_jabber); 190 update_usermeta( $wp_user_id,'aim',$xoops_user->user_aim); 191 update_usermeta( $wp_user_id,'yim',$xoops_user->user_yim); 192 if ($is_update === false ) { 193 update_usermeta( $wp_user_id,'rich_editing',$user_rich_editing); 194 } 182 195 183 }184 196 } 185 197 $message .= "...END";
Note: See TracChangeset
for help on using the changeset viewer.