Solve Discuz! X2 and Discuz! The user group does not change automatically after the X3 user group expires.

Source: Internet
Author: User
I didn't expect this problem to happen to Discuz! The X3 has not been solved yet. I don't know if the official team hasn't noticed this problem or has encountered a bottleneck. The following is the online tutorial I found. However, most of the tutorials are either hidden or need to be registered and replied, forward it here for your convenience. Modify the File: source/include/spacecp/spacecp_usergroup.php

I didn't expect this problem to happen to Discuz! The X3 has not been solved yet. I don't know if the official team hasn't noticed this problem or has encountered a bottleneck. The following is the online tutorial I found. However, most of the tutorials are either hidden or need to be registered and replied, forward it here for your convenience.

Modify the File: source/include/spacecp/spacecp_usergroup.php

Find the code:

$ Groupexpirynew = $ groupterms ['text'] [$ groupid];

Replace:

$ Groupexpirynew = $ groupterms ['text'] [$ extgroupidsnew];

Find the code:

$ Expirylist [$ group ['groupid'] ['grouptitle'] = in_array ($ group ['groupid'], $ expgrouparray )? '': $ Group ['grouptitle'];
}
}

Because the code of different versions has changed, if you cannot find all of them, you can only search for them:

$ Expirylist [$ group ['groupid'] ['grouptitle']

Add the following code (note: it must be after two braces:

If ($ expgrouparray ){
$ Extgroupidarray = array ();
Foreach (explode ("\ t", $ _ G ['forum _ extgroupids ']) as $ extgroupid ){
If ($ extgroupid = intval ($ extgroupid ))&&! In_array ($ extgroupid, $ expgrouparray )){
$ Extgroupidarray [] = $ extgroupid;
}
}
$ Groupidnew = $ _ G ['groupid'];
$ Adminidnew = $ _ G ['adminid'];
Foreach ($ expgrouparray as $ expgroupid ){
If ($ expgroupid === _ G ['groupid']) {
If (! Empty ($ groupterms ['main'] ['groupid']) {
$ Groupidnew = $ groupterms ['main'] ['groupid'];
$ Adminidnew = $ groupterms ['main'] ['adminid'];
} Else {
$ Groupidnew = DB: result_first ("SELECT groupid FROM ". DB: table ('Common _ usergroup '). "WHERE type = 'member' AND '". $ _ G ['member'] ['credit']. "'> = creditshigher AND' $ credits' If (in_array ($ _ G ['adminid'], array (1, 2, 3 ))){
$ Query = DB: query ("SELECT groupid FROM ". DB: table ('Common _ usergroup '). "WHERE groupid IN (". dimplode ($ extgroupidarray ). ") AND radminid = '$ _ G [adminid] 'limit 1 ");
$ Adminidnew = (DB: num_rows ($ query ))? $ _ G ['adminid']: 0;
} Else {
$ Adminidnew = 0;
}
}
Unset ($ groupterms ['main']);
}
Unset ($ groupterms ['text'] [$ expgroupid]);
}
Require_once libfile ('function/forum ');
$ Groupexpirynew = groupexpiry ($ groupterms );
$ Extgroupidsnew = implode ("\ t", $ extgroupidarray );
$ Grouptermsnew = addslashes (serialize ($ groupterms ));
DB: query ("UPDATE ". DB: table ('Common _ member '). "SET adminid = '$ adminidnew', groupid =' $ groupidnew', extgroupids = '$ extgroupidsnew ', groupexpiry = '$ groupexpirynew' WHERE uid = '$ _ G [uid]' ");
DB: query ("UPDATE ". DB: table ('Common _ member_field_forum '). "SET groupterms = '$ grouptermsnew' WHERE uid = '$ _ G [uid]'");
}

Normally, it takes effect directly, but if it cannot be seen, it will be OK to update the cache in the background.

This solution comes from the internet. it is feasible to perform a test. if you have more complicated problems, I am not able to reply in detail. I hope you can understand it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.