XPressME Integration Kit

Trac

Changeset 264 for trunk


Ignore:
Timestamp:
Jun 9, 2009, 8:45:31 AM (15 years ago)
Author:
toemon
Message:

fixed #144 UIDのないコメントの投稿者の名前とメールアドレスからXOOPSユーザIDを取得する

Location:
trunk/xpressme_integration_kit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/xpressme_integration_kit/include/general_functions.php

    r261 r264  
    9191        } 
    9292} 
     93 
     94// XOOPS user ID is get from the name and the mail address of the contributor of the comment that is not user_id.  
     95if (!function_exists('wp_comment_author_to_xoops_uid')){ 
     96        function wp_comment_author_to_xoops_uid($name = '',$email = ''){ 
     97                global $xoopsDB,$xoops_db; 
     98                if (empty($name) || empty($email)) return 0; 
     99                 
     100                if (empty($xoops_db)) { // not load XPressME 
     101                        $xoops_user_tbl = $xoopsDB->prefix('users'); 
     102                        $wp_user_tbl = $xoopsDB->prefix($wp_prefix . "_users"); 
     103 
     104                        $xoops_uid = 0; 
     105                        $xoops_user_SQL ="SELECT uid FROM $xoops_user_tbl WHERE uname = '$name' AND email = '$email'"; 
     106                        $xoops_user_Res = $xoopsDB->query($xoops_user_SQL, 0, 0); 
     107                        if ($xoopsDB->getRowsNum($xoops_user_Res)  > 0){ 
     108                                $xoops_user_Row = $xoopsDB->fetchArray($xoops_user_Res); 
     109                                $xoops_uid = $xoops_user_Row['uid']; 
     110                        }        
     111                        return $xoops_uid; 
     112                } else { // load XPressME or not Load XOOPS 
     113                        $xoops_user_tbl = get_xoops_prefix() . 'users'; 
     114                        $xoops_uid = $xoops_db->get_var("SELECT uid FROM $xoops_user_tbl WHERE uname = '$name' AND email = '$email'"); 
     115                        if (empty($xoops_uid)) return 0; 
     116                        return $xoops_uid; 
     117                }                        
     118        } 
     119} 
     120 
    93121?> 
  • trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/d3forum_comment_synchro.php

    r261 r264  
    495495        $modified_time = strtotime($row->comment_date); // or   $row2['comment_date_gmt'] 
    496496        require_once (get_xpress_dir_path() . 'include/general_functions.php'); 
    497         $uid =  wp_uid_to_xoops_uid($row->user_id,$mydirname); 
     497        if (empty($row->user_id)){ 
     498                $uid = wp_comment_author_to_xoops_uid($row->comment_author,$row->comment_author_email); 
     499        } else { 
     500                $uid = wp_uid_to_xoops_uid($row->user_id,$mydirname); 
     501        } 
    498502        $poster_ip = "'" . addslashes($row->comment_author_IP ). "'"; 
    499503        $modifier_ip = "'" . addslashes($row->comment_author_IP) . "'"; 
  • trunk/xpressme_integration_kit/xoops_version.php

    r252 r264  
    4040 
    4141// status 
    42 $modversion['codename'] = "Bata-1"; 
     42$modversion['codename'] = "Bata-2"; 
    4343 
    4444// onInstall, onUpdate, onUninstall 
Note: See TracChangeset for help on using the changeset viewer.