织梦dede整合discuz后会员注册后不用激活实现方法(2)

   //note 用户删除 API 接口
   $rs = $this->db->ExecuteNoneQuery2("DELETE FROM `dede_member` WHERE mid IN ($uids) AND matt<>10 limit 1");
   if($rs > 0)
   {
    $this->db->ExecuteNoneQuery("DELETE FROM `dede_member_tj` WHERE mid IN ($uids) limit 1");
    $this->db->ExecuteNoneQuery("DELETE FROM `dede_member_space` WHERE mid IN ($uids) limit 1");
    $this->db->ExecuteNoneQuery("DELETE FROM `dede_member_company` WHERE mid IN ($uids) limit 1");
    $this->db->ExecuteNoneQuery("DELETE FROM `dede_member_person` WHERE mid IN ($uids) limit 1");
  
    //删除用户相关数据
    $this->db->ExecuteNoneQuery("DELETE FROM `dede_member_stow` WHERE mid IN ($uids) ");
    $this->db->ExecuteNoneQuery("DELETE FROM `dede_member_flink` WHERE mid IN ($uids) ");
    $this->db->ExecuteNoneQuery("DELETE FROM `dede_member_guestbook` WHERE mid IN ($uids) ");
    $this->db->ExecuteNoneQuery("DELETE FROM `dede_member_operation` WHERE mid IN ($uids) ");
    $this->db->ExecuteNoneQuery("DELETE FROM `dede_member_pms` WHERE toid IN ($uids) OR fromid IN ($uids) ");
    $this->db->ExecuteNoneQuery("DELETE FROM `dede_member_friends` WHERE mid IN ($uids) OR fid IN ($uids) ");
    $this->db->ExecuteNoneQuery("DELETE FROM `dede_member_vhistory` WHERE mid IN ($uids) OR vid IN ($uids) ");
    $this->db->ExecuteNoneQuery("DELETE FROM `dede_feedback` WHERE mid IN ($uids) ");
    $this->db->ExecuteNoneQuery("UPDATE `dede_archives` SET mid='0' WHERE mid IN ($uids)");
   }
   else
   {
    exit(API_RETURN_FORBIDDEN);
   }

   return API_RETURN_SUCCEED;
}

function renameuser($get, $post)
{
   $uids = $this->get_uids($get['ids']);
  
  
   $usernameold = $get['oldusername'];
   $usernamenew = $get['newusername'];
   if(!API_RENAMEUSER)
   {
    return API_RETURN_FORBIDDEN;
   }

   //note 获取标签 API 接口
   $rs = $this->db->ExecuteNoneQuery2("UPDATE `dede_member` SET userid='$usernamenew' WHERE userid='$usernamenew' AND matt<>10 limit 1");
   if($rs > 0)
   {
    $this->db->ExecuteNoneQuery("UPDATE `dede_archives` SET writer='$usernamenew' WHERE writer='$usernamenew'");
    $this->db->ExecuteNoneQuery("UPDATE `dede_member_pms` SET floginid=REPLACE(floginid, '\t$usernameold', '\t$usernamenew'),tologinid=REPLACE(tologinid, '\t$usernameold', '\t$usernamenew')");
   
   
    $row = $this->db->GetOne("SHOW TABLE STATUS");
    $db_tables = $row['Name']; unset($row);
   
    if(in_array($this->tablepre.'guestbook',$db_tables))
    {
     $this->db->ExecuteNoneQuery("UPDATE `dede_guestbook` SET uname='$usernamenew' WHERE uname='$usernamenew'");
    }
   
    if(in_array($this->tablepre.'story_books',$db_tables))
    {
     $this->db->ExecuteNoneQuery("UPDATE `dede_story_books` SET author='$usernamenew' WHERE author='$usernamenew'");
    }
   
    if(in_array($this->tablepre.'groups',$db_tables))
    {
     $this->db->ExecuteNoneQuery("UPDATE `dede_groups` SET creater='$usernamenew' WHERE creater='$usernamenew'");
     $this->db->ExecuteNoneQuery("UPDATE `dede_group_threads` SET author='$usernamenew' WHERE author='$usernamenew'");
     $this->db->ExecuteNoneQuery("UPDATE `dede_group_user` SET username='$usernamenew' WHERE username='$usernamenew'");
     $this->db->ExecuteNoneQuery("UPDATE `dede_group_posts` SET author='$usernamenew' WHERE author='$usernamenew'");
     $this->db->ExecuteNoneQuery("UPDATE `dede_group_guestbook` SET uname='$usernamenew' WHERE uname='$usernamenew'");
     $this->db->ExecuteNoneQuery("UPDATE `dede_groups` SET ismaster=REPLACE(ismaster, '\t$usernameold', '\t$usernamenew')");
    }
   
    return API_RETURN_SUCCEED;
   }
   else
   {
    return API_RETURN_FORBIDDEN;
   }
}

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/c8d5d8fa55c6b5c32a897c09ccd717cf.html