Jump to the post that solved this thread.
Solved: 6 Months, 2 Weeks ago Account Switcher: Hide accounts of specific groups from account selection list.
#2
Solved: 6 Months, 2 Weeks ago
I found the solution through some digging. This will only hide accounts in the drop down of as_header and possibly in the sidebar. They will still appear on the accountswitcher.php page and in account lists under the members.php page.

To hide accounts with X group (in this case, groups 8 and 9) from the master account in the as_header list: locate as_functions.php, find this bit near line 67:
 // Get all attached accounts
                foreach ($accounts as $key => $account) {
                    $attachedPostUser = htmlspecialchars_uni($account['username']);
                    $userUid = (int)$account['uid'];
                    $userAvatar = $eas->attached_avatar($account['avatar'], $account['avatardimensions']);

Insert beneath it to hide the groups desired from the master account, replacing the (x,y) in the array with the groups you do not wish to show, or replacing the whole array with the desired group id number :
if (is_member(array(x,y), $account['uid'])) continue;



Further, to hide this from other attached accounts, near line 237, find this bit of code:
// Get all attached accounts
                    foreach ($accounts as $key => $account) {
                        $userUid = (int)$account['uid'];
                        $attachedPostUser = htmlspecialchars_uni($account['username']);
                        $userAvatar = $eas->attached_avatar($account['avatar'], $account['avatardimensions']);

                        // Leave current user out
                        if ($account['uid'] == $mybb->user['uid']) {
                            continue;
                        }

Similar to above, insert this beneath it to hide the account ids desired, replacing the (x,y) in the array with the groups you do not wish to show, or replacing the whole array with the desired group id number:
if (is_member(array(x,y), $account['uid'])) continue;



And lastly, to hide it from the post author section on new replies/threads, find this code near line 504:
// Get all attached accounts
                        foreach ($accounts as $key => $account) {
                            if ($account['as_uid'] == $mybb->user['uid']) {

Similar to above, insert this beneath it to hide the account ids desired, replacing the (x,y) in the array with the groups you do not wish to show, or replacing the whole array with the desired group id number:
if (is_member(array(x,y), $account['uid'])) continue;
Reply
Jump to the post that solved this thread.


Messages In This Thread
RE: Account Switcher: Hide accounts of specific groups from account selection list. - by Cardéstal - 2022-07-15, 05:54 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)