[1] | 1 | <?php
|
---|
| 2 | /**
|
---|
| 3 | * XPressME - WordPress for XOOPS
|
---|
| 4 | *
|
---|
| 5 | *
|
---|
| 6 | * @copyright XPressME Project http://www.toemon.com
|
---|
| 7 | * @license http://www.fsf.org/copyleft/gpl.html GNU public license
|
---|
| 8 | * @author toemon
|
---|
| 9 | * @since 2.04
|
---|
| 10 | * @version $Id$
|
---|
| 11 | * @package module::xpress
|
---|
| 12 | */
|
---|
| 13 |
|
---|
| 14 |
|
---|
| 15 | //
|
---|
| 16 | // wordpress user data vs xoops user data
|
---|
| 17 | // wordpress database info from http://adiary.blog.abk.nu/080
|
---|
| 18 | //
|
---|
| 19 | // wordpress xpress
|
---|
| 20 | //------------------------------------------------------------------------------------------
|
---|
| 21 | // users.ID [bigint(20)] users.uid [mediumint(8)]
|
---|
| 22 | // users.user_login [varchar(60)] users.uname [varchar(60)]
|
---|
| 23 | // users.user_pass [varchar(64)] users.pass [varchar(32)]
|
---|
| 24 | // users.user_email [varchar(100)] users.email [varchar(60)]
|
---|
| 25 | // users.user_url[varchar(100)] users.url [varchar(100)]
|
---|
| 26 | // users.dateYMDhour [datetime]
|
---|
| 27 | // users.user_nicename [varchar(50)] users.uname [varchar(60)]
|
---|
| 28 | // users.user_registerd [datetime] date('Y-m-d H:i:s' , users.regdate[int(10)])
|
---|
| 29 | // users.user_activation_key [varchar(60)] null
|
---|
| 30 | // users.user_status [int(11)] 0
|
---|
| 31 | // users.display_name [varchar(250)] empty(users.name) ? users.uname :users.name
|
---|
| 32 | //
|
---|
| 33 | // usermeta[meta_key] get_xpress_user_level(uid);
|
---|
| 34 | // user_level 10:admim
|
---|
| 35 | // 7: editor
|
---|
| 36 | // 2: auther
|
---|
| 37 | // 1: contributor
|
---|
| 38 | // 0: subscriber
|
---|
| 39 | // nickname users.name [varchar(25)]
|
---|
| 40 | // capabillities
|
---|
| 41 | // at user_level 10:admim 'a:1:{s:13:"administrator";b:1;}'
|
---|
| 42 | // 7: editor 'a:1:{s:6:"editor";b:1;}'
|
---|
| 43 | // 2: auther 'a:1:{s:6:"author";b:1;}'
|
---|
| 44 | // 1: contributor 'a:1:{s:11:"contributor";b:1;}'
|
---|
| 45 | // 0: subscriber 'a:1:{s:10:"subscriber";b:1;}'
|
---|
| 46 | //
|
---|
| 47 | // first_name
|
---|
| 48 | // last_name
|
---|
| 49 | // description
|
---|
| 50 | // jabber
|
---|
| 51 | // aim users.user_aim
|
---|
| 52 | // yim users.user_yim
|
---|
| 53 | //
|
---|
| 54 | //
|
---|
| 55 |
|
---|
| 56 |
|
---|
| 57 | function get_xpress_mid($mydirname){
|
---|
| 58 | $xoopsDB =& Database::getInstance();
|
---|
| 59 | $module_tbl = $xoopsDB->prefix('modules');
|
---|
| 60 | $module_dir = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
|
---|
| 61 | $module_id = 0;
|
---|
| 62 |
|
---|
| 63 | $sql = "SELECT mid FROM $module_tbl WHERE dirname LIKE '$mydirname'";
|
---|
| 64 | $result = $xoopsDB->query($sql, 0, 0);
|
---|
| 65 | if ($xoopsDB->getRowsNum($result) > 0){
|
---|
| 66 | $row = $xoopsDB->fetchArray($result);
|
---|
| 67 | $module_id = $row['mid'];
|
---|
| 68 | }
|
---|
| 69 | return $module_id;
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 |
|
---|
[69] | 73 | function get_xoops_group_capabillities_name($mydirname , $uid=0){
|
---|
[1] | 74 | if ($uid == 0){
|
---|
[69] | 75 | return '';
|
---|
[1] | 76 | }
|
---|
| 77 |
|
---|
| 78 | global $xoopsModule;
|
---|
| 79 | $xoopsDB =& Database::getInstance();
|
---|
| 80 | $db_groups_users_link = $xoopsDB->prefix('groups_users_link');
|
---|
| 81 | $db_group_permission = $xoopsDB->prefix('group_permission');
|
---|
| 82 | $module_tbl = $xoopsDB->prefix('modules');
|
---|
| 83 |
|
---|
| 84 | $module_id = get_xpress_mid($mydirname);
|
---|
| 85 | $sql = "SELECT uid FROM $db_groups_users_link WHERE groupid = 1 AND uid = $uid";
|
---|
| 86 |
|
---|
| 87 | $result = $xoopsDB->query($sql, 0, 0);
|
---|
| 88 | if ($xoopsDB->getRowsNum($result) > 0){
|
---|
[69] | 89 | return 'administrator';
|
---|
[1] | 90 | }
|
---|
| 91 |
|
---|
| 92 | $sql = "SELECT Max($db_group_permission.gperm_itemid) AS user_level ,$db_groups_users_link.uid ";
|
---|
| 93 | $sql .= "FROM $db_groups_users_link LEFT JOIN $db_group_permission ON $db_groups_users_link.groupid = $db_group_permission.gperm_groupid ";
|
---|
| 94 | $sql .= "WHERE $db_group_permission.gperm_modid = $module_id ";
|
---|
| 95 | $sql .= "GROUP BY $db_groups_users_link.uid ";
|
---|
| 96 | $sql .= "HAVING $db_groups_users_link.uid = $uid";
|
---|
| 97 | $result = $xoopsDB->query($sql, 0, 0);
|
---|
| 98 | if ($result === false){
|
---|
[69] | 99 | return '';
|
---|
[1] | 100 | }else{
|
---|
| 101 | if ($xoopsDB->getRowsNum($result) > 0){
|
---|
| 102 | $row = $xoopsDB->fetchArray($result);
|
---|
| 103 | $level = $row['user_level'];
|
---|
[69] | 104 | switch($level) {
|
---|
| 105 | case 5:
|
---|
| 106 | return 'administrator';
|
---|
| 107 | case 4:
|
---|
| 108 | return 'editor';
|
---|
| 109 | case 3:
|
---|
| 110 | return 'author';
|
---|
| 111 | case 2:
|
---|
| 112 | return 'contributor';
|
---|
| 113 | case 1:
|
---|
| 114 | return 'subscriber';
|
---|
| 115 | default:
|
---|
| 116 | return '';
|
---|
| 117 | }
|
---|
[1] | 118 | } else {
|
---|
[69] | 119 | return '';
|
---|
[1] | 120 | }
|
---|
| 121 | }
|
---|
| 122 | }
|
---|
[69] | 123 |
|
---|
[1] | 124 | //endif;
|
---|
| 125 |
|
---|
| 126 | //if( ! function_exists( 'get_xpress_prefix' ) ) :
|
---|
| 127 | function get_xpress_prefix($mydirname){
|
---|
| 128 | global $xoopsModule;
|
---|
| 129 | if ($mydirname == 'wordpress'){
|
---|
| 130 | return 'wp_';
|
---|
| 131 | } else {
|
---|
| 132 | return $mydirname . '_';
|
---|
| 133 | }
|
---|
| 134 | }
|
---|
| 135 | //endif;
|
---|
| 136 |
|
---|
| 137 | //if( ! function_exists( 'xpress_user_found' ) ) :
|
---|
| 138 | function xpress_user_found($mydirname, $uid){
|
---|
| 139 | $wp_prefix = get_xpress_prefix($mydirname);
|
---|
| 140 | $xoopsDB =& Database::getInstance();
|
---|
| 141 | $db_xpress_users = $xoopsDB->prefix($wp_prefix . 'users');
|
---|
| 142 |
|
---|
| 143 | $sql = "SELECT ID FROM $db_xpress_users WHERE ID = $uid";
|
---|
| 144 | $res = $xoopsDB->query($sql, 0, 0);
|
---|
| 145 | if ($res === false){
|
---|
| 146 | return false;
|
---|
| 147 | } else {
|
---|
| 148 | if ($xoopsDB->getRowsNum($res) > 0){
|
---|
| 149 | return true;
|
---|
| 150 | } else {
|
---|
| 151 | return false;
|
---|
| 152 | }
|
---|
| 153 | }
|
---|
| 154 | }
|
---|
| 155 | //endif;
|
---|
| 156 |
|
---|
| 157 |
|
---|
| 158 | //if( ! function_exists( 'xpress_usermeta_sync' ) ) :
|
---|
[69] | 159 | function xpress_usermeta_sync($mydirname , $uid,$meta_key,$meta_value, &$message){
|
---|
[1] | 160 | $wp_prefix = get_xpress_prefix($mydirname);
|
---|
[69] | 161 | $meta_key = "'" . $meta_key . "'";
|
---|
| 162 | $xoopsDB =& Database::getInstance();
|
---|
[1] | 163 | $db_xpress_usermeta = $xoopsDB->prefix($wp_prefix . 'usermeta');
|
---|
| 164 | $sql = "SELECT user_id FROM $db_xpress_usermeta WHERE (user_id = $uid) AND (meta_key = $meta_key)";
|
---|
| 165 | $res = $xoopsDB->query($sql, 0, 0);
|
---|
| 166 |
|
---|
| 167 | if ($res === false){
|
---|
| 168 | $sql2 = "INSERT INTO $db_xpress_usermeta (user_id,meta_key,meta_value) VALUES ($uid,$meta_key,$meta_value)";
|
---|
| 169 | }else {
|
---|
| 170 | if ($xoopsDB->getRowsNum($res) > 0){
|
---|
| 171 |
|
---|
| 172 | $sql2 = "UPDATE $db_xpress_usermeta SET meta_value = $meta_value WHERE (user_id = $uid) AND (meta_key = $meta_key)";
|
---|
| 173 | } else {
|
---|
| 174 | $sql2 = "INSERT INTO $db_xpress_usermeta (user_id,meta_key,meta_value) VALUES ($uid,$meta_key,$meta_value)";
|
---|
| 175 | }
|
---|
| 176 | }
|
---|
| 177 | $res = $xoopsDB->queryF($sql2, 0, 0);
|
---|
| 178 | if ($res === false) {
|
---|
[69] | 179 | $message .= "...ERR($sql2)";
|
---|
| 180 | return false;
|
---|
[1] | 181 | } else {
|
---|
[69] | 182 | return true;
|
---|
[1] | 183 | }
|
---|
| 184 |
|
---|
| 185 | }
|
---|
| 186 | //endif;
|
---|
| 187 |
|
---|
| 188 | function sql_str($text = ''){
|
---|
| 189 | return "'" . $text . "'";
|
---|
| 190 | }
|
---|
| 191 |
|
---|
| 192 | //if( ! function_exists( 'xpress_user_sync' ) ) :
|
---|
[69] | 193 | function xpress_user_sync($sync_uid = 0, &$message){
|
---|
[1] | 194 | $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
|
---|
| 195 |
|
---|
| 196 | if( is_object( @$GLOBALS["xoopsModule"] ) ) {
|
---|
| 197 | $wp_prefix = get_xpress_prefix($mydirname);
|
---|
| 198 | $xoopsDB =& Database::getInstance();
|
---|
| 199 | $db_xoops_users = $xoopsDB->prefix('users');
|
---|
| 200 | $db_xpress_users = $xoopsDB->prefix($wp_prefix . 'users');
|
---|
| 201 |
|
---|
[69] | 202 | $message = 'Do Sync';
|
---|
[1] | 203 |
|
---|
| 204 | if ($sync_uid == 0) {
|
---|
| 205 | $xu_sql = "SELECT uid ,name ,uname ,pass ,email, url, user_regdate, user_aim, user_yim FROM $db_xoops_users";
|
---|
| 206 | } else {
|
---|
| 207 | $xu_sql = "SELECT uid ,name ,uname ,pass ,email, url, user_regdate, user_aim, user_yim FROM $db_xoops_users WHERE uid = $sync_uid";
|
---|
| 208 | }
|
---|
| 209 |
|
---|
| 210 | $xu_res = $xoopsDB->query($xu_sql, 0, 0);
|
---|
| 211 | if ($xu_res === false){
|
---|
[69] | 212 | $message .= '...ERR ('. $xu_sql . ')';
|
---|
| 213 | return false;
|
---|
[1] | 214 | }else {
|
---|
| 215 | while($xu_row = $xoopsDB->fetchArray($xu_res)){
|
---|
[69] | 216 | $capabillities_name = get_xoops_group_capabillities_name($mydirname , $xu_row['uid']);
|
---|
| 217 | if (empty($capabillities_name)){
|
---|
| 218 | $message .= "...PASS '" . $xu_row['uname'] ."'[uid=".$xu_row['uid'] ."](not xpress user)";
|
---|
[1] | 219 | if ($sync_uid != 0){
|
---|
[69] | 220 | $message .= '...NOT XPRESS USER ' . $xu_row['uname'];
|
---|
| 221 | return false;
|
---|
[1] | 222 | }
|
---|
| 223 | } else {
|
---|
| 224 | $user_ID = $xu_row['uid'];
|
---|
[69] | 225 | if ($capabillities_name != 'administrator' ){
|
---|
[1] | 226 | if (!empty($GLOBALS["xoopsModuleConfig"]["use_wp_userlevel"])){
|
---|
[69] | 227 | $capabillities_name = get_option('default_role');
|
---|
[1] | 228 | }
|
---|
| 229 | }
|
---|
| 230 | $user_login_name = sql_str($xu_row['uname']);
|
---|
| 231 | $user_pass_md5 = sql_str( $xu_row['pass']);
|
---|
| 232 | $user_email = sql_str( $xu_row['email']);
|
---|
| 233 | $user_url = sql_str( $xu_row['url']);
|
---|
| 234 | $user_regist_time = sql_str(date('Y-m-d H:i:s' , $xu_row['user_regdate']));
|
---|
| 235 | $user_nicename = sql_str( $xu_row['uname']);
|
---|
| 236 | $user_status = 0;
|
---|
| 237 | $user_display_name =sql_str( empty($xu_row['name']) ? $xu_row['uname'] :$xu_row['name'] );
|
---|
| 238 | $user_nickname = sql_str( empty($xu_row['name']) ? $xu_row['uname'] :$xu_row['name'] );
|
---|
| 239 | $user_aim = sql_str( $xu_row['user_aim']);
|
---|
| 240 | $user_yim = sql_str( $xu_row['user_yim']);
|
---|
| 241 | $user_first_name = sql_str( $xu_row['uname']);
|
---|
| 242 | $user_last_name = sql_str('');
|
---|
| 243 | $user_description = sql_str('');
|
---|
| 244 | $user_jabber = sql_str('');
|
---|
| 245 | $user_rich_editing = sql_str('true');
|
---|
| 246 |
|
---|
| 247 | $is_update = false;
|
---|
| 248 | if (xpress_user_found($mydirname, $user_ID)){
|
---|
| 249 | $wu_sql = "UPDATE $db_xpress_users ";
|
---|
| 250 | $wu_sql .= 'SET ';
|
---|
| 251 | $wu_sql .= "user_login = $user_login_name, ";
|
---|
| 252 | $wu_sql .= "user_pass = $user_pass_md5, ";
|
---|
| 253 | $wu_sql .= "user_email = $user_email, ";
|
---|
| 254 | $wu_sql .= "user_url = $user_url, ";
|
---|
| 255 | $wu_sql .= "user_nicename = $user_nicename, ";
|
---|
| 256 | $wu_sql .= "user_registered = $user_regist_time, ";
|
---|
| 257 | $wu_sql .= "user_status = 0 ";
|
---|
| 258 | $wu_sql .= "WHERE (ID = $user_ID )";
|
---|
| 259 | if (!empty($GLOBALS["xoopsModuleConfig"]["use_wp_userlevel"])){
|
---|
[69] | 260 | $message .= '...UPDATE ' . $user_login_name . '(Level Not Change)';
|
---|
[1] | 261 | } else {
|
---|
[69] | 262 | $message .= '...UPDATE ' . $user_login_name . '(' . $capabillities_name . ')';
|
---|
[1] | 263 | }
|
---|
| 264 | $is_update = true;
|
---|
| 265 | }else{
|
---|
| 266 | $wu_sql = "INSERT INTO $db_xpress_users ";
|
---|
| 267 | $wu_sql .= "(ID , user_login , user_pass ,user_email , user_url , user_nicename " ;
|
---|
| 268 | $wu_sql .= " , user_registered , user_status , display_name) ";
|
---|
| 269 | $wu_sql .= "VALUES ";
|
---|
| 270 | $wu_sql .= "($user_ID, $user_login_name, $user_pass_md5, $user_email, $user_url, $user_nicename ";
|
---|
| 271 | $wu_sql .= " , $user_regist_time, $user_status, $user_display_name)";
|
---|
| 272 | if (!empty($GLOBALS["xoopsModuleConfig"]["use_wp_userlevel"])){
|
---|
[69] | 273 | $message .= '...INSERT ' . $user_login_name . '(' . $capabillities_name . '-WP Default)';
|
---|
[1] | 274 | } else {
|
---|
[69] | 275 | $message .= '...INSERT ' . $user_login_name . '(' . $capabillities_name . ')';
|
---|
[1] | 276 | }
|
---|
| 277 | }
|
---|
| 278 |
|
---|
| 279 | $wu_res = $xoopsDB->queryF($wu_sql, 0, 0);
|
---|
| 280 |
|
---|
| 281 | if ($wu_res === false){
|
---|
[69] | 282 | $message .= '...ERR(' . $wu_sql . ')';
|
---|
| 283 | return false;
|
---|
[1] | 284 | }
|
---|
| 285 |
|
---|
| 286 | if (!empty($GLOBALS["xoopsModuleConfig"]["use_wp_userlevel"])){
|
---|
| 287 | if (!$is_update){
|
---|
| 288 | $sycc_user = new WP_User($user_ID);
|
---|
| 289 | $sycc_user->set_role($capabillities_name);
|
---|
| 290 | }
|
---|
| 291 | } else {
|
---|
| 292 | $sycc_user = new WP_User($user_ID);
|
---|
| 293 | $sycc_user->set_role($capabillities_name);
|
---|
| 294 | }
|
---|
| 295 |
|
---|
[69] | 296 | // if( $is_update === false){
|
---|
| 297 | if(!xpress_usermeta_sync($mydirname, $user_ID,'nickname',$user_nickname,$message) )return false;
|
---|
| 298 | if(!xpress_usermeta_sync($mydirname, $user_ID,'first_name',$user_first_name,$message) )return false;
|
---|
| 299 | if(!xpress_usermeta_sync($mydirname, $user_ID,'last_name',$user_last_name,$message) )return false;
|
---|
| 300 | if(!xpress_usermeta_sync($mydirname, $user_ID,'description',$user_description,$message) )return false;
|
---|
| 301 | if(!xpress_usermeta_sync($mydirname, $user_ID,'jabber',$user_jabber,$message) )return false;
|
---|
| 302 | // }
|
---|
| 303 | if(!xpress_usermeta_sync($mydirname, $user_ID,'aim',$user_aim,$message) )return false;
|
---|
| 304 | if(!xpress_usermeta_sync($mydirname, $user_ID,'yim',$user_yim,$message) )return false;
|
---|
[1] | 305 | if ($is_update === false ) {
|
---|
[69] | 306 | if(!xpress_usermeta_sync($mydirname, $user_ID,'rich_editing',$user_rich_editing,$message) )return false;
|
---|
[1] | 307 | }
|
---|
| 308 | }
|
---|
| 309 | }
|
---|
| 310 | }
|
---|
[69] | 311 | $message .= "...END";
|
---|
| 312 | return true;
|
---|
[1] | 313 | }
|
---|
| 314 | }
|
---|
| 315 | //endif;
|
---|
| 316 |
|
---|
[69] | 317 |
|
---|
| 318 |
|
---|
[1] | 319 | //if( ! function_exists( 'check_user_role_prefix' ) ) :
|
---|
| 320 | function check_user_role_prefix($mydirname){
|
---|
| 321 | $wp_prefix = get_xpress_prefix($mydirname);
|
---|
| 322 | $xoopsDB =& Database::getInstance();
|
---|
| 323 | $db_xpress_usermeta = $xoopsDB->prefix($wp_prefix . 'usermeta');
|
---|
| 324 | $user_meta_prefix =$xoopsDB->prefix($wp_prefix);
|
---|
| 325 |
|
---|
| 326 | $sql = "SELECT * FROM $db_xpress_usermeta WHERE meta_key LIKE '%_" . $wp_prefix . "user_level' OR meta_key LIKE '%_" . $wp_prefix . "capabilities' OR meta_key LIKE '%_" . $wp_prefix . "autosave_draft_ids'";
|
---|
| 327 | $result = $xoopsDB->query($sql, 0, 0);
|
---|
| 328 | if ($result === false){
|
---|
| 329 | return -1;
|
---|
| 330 | }else{
|
---|
| 331 | $i=0;
|
---|
| 332 | while($row = $xoopsDB->fetchArray($result)){
|
---|
| 333 | $meta_key = $row['meta_key'];
|
---|
| 334 | if (strpos($meta_key,$user_meta_prefix) === false) {
|
---|
| 335 | $i++;
|
---|
| 336 | }
|
---|
| 337 | }
|
---|
| 338 | return $i;
|
---|
| 339 | }
|
---|
| 340 | }
|
---|
| 341 | //endif;
|
---|
| 342 |
|
---|
| 343 | //if( ! function_exists( 'same_metakey_delete' ) ) :
|
---|
| 344 | function same_metakey_delete($mydirname,$metakey){
|
---|
| 345 | $wp_prefix = get_xpress_prefix($mydirname);
|
---|
| 346 | $xoopsDB =& Database::getInstance();
|
---|
| 347 | $db_xpress_usermeta = $xoopsDB->prefix($wp_prefix . 'usermeta');
|
---|
| 348 | $user_meta_prefix =$xoopsDB->prefix($wp_prefix);
|
---|
| 349 |
|
---|
| 350 | $sql = "DELETE FROM $db_xpress_usermeta WHERE meta_key LIKE '$metakey'";
|
---|
| 351 | $result = $xoopsDB->query($sql, 0, 0);
|
---|
| 352 | if ($result === false){
|
---|
| 353 | return false;
|
---|
| 354 | }else{
|
---|
| 355 | return true;
|
---|
| 356 | }
|
---|
| 357 | }
|
---|
| 358 | //endif;
|
---|
| 359 |
|
---|
| 360 | //if( ! function_exists( 'repair_user_role_prefix' ) ) :
|
---|
| 361 | function repair_user_role_prefix($mydirname){
|
---|
| 362 | $wp_prefix = get_xpress_prefix($mydirname);
|
---|
| 363 | $xoopsDB =& Database::getInstance();
|
---|
| 364 | $db_xpress_usermeta = $xoopsDB->prefix($wp_prefix . 'usermeta');
|
---|
| 365 | $user_meta_prefix =$xoopsDB->prefix($wp_prefix);
|
---|
| 366 | $ret = '';
|
---|
| 367 |
|
---|
| 368 | $sql = "SELECT * FROM $db_xpress_usermeta WHERE meta_key LIKE '%_" . $wp_prefix . "user_level' OR meta_key LIKE '%_" . $wp_prefix . "capabilities' OR meta_key LIKE '%_" . $wp_prefix . "autosave_draft_ids'";
|
---|
| 369 | $result = $xoopsDB->queryF($sql, 0, 0);
|
---|
| 370 | if ($result === false){
|
---|
| 371 | return -1;
|
---|
| 372 | }else{
|
---|
| 373 | $i=0;
|
---|
| 374 | while($row = $xoopsDB->fetchArray($result)){
|
---|
| 375 | $meta_key = $row['meta_key'];
|
---|
| 376 | $umeta_id = $row['umeta_id'];
|
---|
| 377 | if (strpos($meta_key,$user_meta_prefix) === false) {
|
---|
| 378 | $new_meta_key = '';
|
---|
| 379 | if (strpos($meta_key,$wp_prefix.'user_level')){
|
---|
| 380 | $new_meta_key = $xoopsDB->prefix($wp_prefix . 'user_level');
|
---|
| 381 | }
|
---|
| 382 |
|
---|
| 383 | if (strpos($meta_key,$wp_prefix.'capabilities')){
|
---|
| 384 | $new_meta_key = $xoopsDB->prefix($wp_prefix . 'capabilities');
|
---|
| 385 | }
|
---|
| 386 |
|
---|
| 387 | if (strpos($meta_key,$wp_prefix.'autosave_draft_ids')){
|
---|
| 388 | $new_meta_key = $xoopsDB->prefix($wp_prefix . 'autosave_draft_ids');
|
---|
| 389 | }
|
---|
| 390 |
|
---|
| 391 | if (!empty($new_meta_key)){
|
---|
| 392 | same_metakey_delete($mydirname,$new_meta_key);
|
---|
| 393 |
|
---|
| 394 | $repair_sql = "UPDATE $db_xpress_usermeta ";
|
---|
| 395 | $repair_sql .= 'SET ';
|
---|
| 396 | $repair_sql .= "meta_key = '$new_meta_key' ";
|
---|
| 397 | $repair_sql .= "WHERE (umeta_id = $umeta_id )";
|
---|
| 398 | $repair_res = $xoopsDB->queryF($repair_sql, 0, 0);
|
---|
| 399 | if ($repair_res === false){
|
---|
| 400 | $ret .= '...ERR(' . $meta_key . '->' . $new_meta_key . ')<br>';
|
---|
| 401 | } else {
|
---|
| 402 | $ret .= '...DO(' . $meta_key . '->' . $new_meta_key . ')<br>';
|
---|
| 403 | }
|
---|
| 404 | }
|
---|
| 405 | }
|
---|
| 406 | }
|
---|
| 407 | }
|
---|
| 408 | return $ret;
|
---|
| 409 | }
|
---|
| 410 | //endif;
|
---|
| 411 |
|
---|
| 412 | ?> |
---|