没想到这个问题到了 Discuz! X3 了还没解决,不知道官方团队是没注意到这个问题,还是遇到了瓶颈,下面是我搜到的网上的教程,但大部分教程不是隐藏就是需要注册回复,转发到这儿,方便大家直接查阅。
修改文件:source/include/spacecp/spacecp_usergroup.php
找到代码:

  1. $groupexpirynew = $groupterms['ext'][$groupid];

替换为:

  1. $groupexpirynew = $groupterms['ext'][$extgroupidsnew];

找到代码:

  1. $expirylist[$group['groupid']]['grouptitle'] = in_array($group['groupid'], $expgrouparray) ? '' : $group['grouptitle'];
  2.                 }
  3.         }

因为不同版本代码有变,所以如果搜不到全部,就只搜一下:

  1. $expirylist[$group['groupid']]['grouptitle']

在这段代码下面 (注意:一定是在两个大括号之后) 添加:

  1. if($expgrouparray) {
  2. $extgroupidarray = array();
  3. foreach(explode(" ", $_G['forum_extgroupids']) as $extgroupid) {
  4. if(($extgroupid = intval($extgroupid)) && !in_array($extgroupid, $expgrouparray)) {
  5. $extgroupidarray[] = $extgroupid;
  6. }
  7. }
  8. $groupidnew = $_G['groupid'];
  9. $adminidnew = $_G['adminid'];
  10. foreach($expgrouparray as $expgroupid) {
  11. if($expgroupid == $_G['groupid']) {
  12. if(!empty($groupterms['main']['groupid'])) {
  13. $groupidnew = $groupterms['main']['groupid'];
  14. $adminidnew = $groupterms['main']['adminid'];
  15. } else {
  16. $groupidnew = DB::result_first("SELECT groupid FROM
    ".DB::table('common_usergroup')." WHERE type='member' AND
    '".$_G['member']['credits']."'>=creditshigher AND
    '$credits'<creditslower LIMIT 1");
  17. if(in_array($_G['adminid'], array(1, 2, 3))) {
  18. $query = DB::query("SELECT groupid FROM
    ".DB::table('common_usergroup')." WHERE groupid IN
    (".dimplode($extgroupidarray).") AND radminid='$_G[adminid]' LIMIT 1");
  19. $adminidnew = (DB::num_rows($query)) ? $_G['adminid'] : 0;
  20. } else {
  21. $adminidnew = 0;
  22. }
  23. }
  24. unset($groupterms['main']);
  25. }
  26. unset($groupterms['ext'][$expgroupid]);
  27. }
  28. require_once libfile('function/forum');
  29. $groupexpirynew = groupexpiry($groupterms);
  30. $extgroupidsnew = implode(" ", $extgroupidarray);
  31. $grouptermsnew = addslashes(serialize($groupterms));
  32. DB::query("UPDATE ".DB::table('common_member')." SET
    adminid='$adminidnew', groupid='$groupidnew',
    extgroupids='$extgroupidsnew', groupexpiry='$groupexpirynew' WHERE
    uid='$_G[uid]'");
  33. DB::query("UPDATE ".DB::table('common_member_field_forum')." SET groupterms='$grouptermsnew' WHERE uid='$_G[uid]'");
  34. }

正常情况下,直接生效,但如果看不出来变化,就后台更新一下缓存,就 OK 了。