Select users with a_ or m_

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
Kailey
Community Team Leader
Community Team Leader
Posts: 3732
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Snay
Contact:

Select users with a_ or m_

Post by Kailey »

I need to filter out a list of users with a_ or m_ permissions, but not sure how to go about this with the SQL below.

Code: Select all

$sql = 'SELECT user_id
    FROM ' . USERS_TABLE . '
    WHERE ' . $db->sql_in_set('user_id', $array) . "
        AND user_id <> " . $this->user->data['user_id'];
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
    unset($array[$row['user_id']]);
}
Kailey Snay - Community Team Leader
Knowledge Base | Documentation | Community rules

If you have any questions about the rules/customs of this website, feel free to send me a PM.
User avatar
RMcGirr83
Former Team Member
Posts: 22016
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: Select users with a_ or m_

Post by RMcGirr83 »

Look on GitHub for my stop forum spam extension. Within core there is sfsgroups which should help.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beer Image
User avatar
Kailey
Community Team Leader
Community Team Leader
Posts: 3732
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Snay
Contact:

Re: Select users with a_ or m_

Post by Kailey »

That does, thanks a bunch!
Kailey Snay - Community Team Leader
Knowledge Base | Documentation | Community rules

If you have any questions about the rules/customs of this website, feel free to send me a PM.
User avatar
Toxyy
Registered User
Posts: 942
Joined: Mon Oct 24, 2016 3:22 pm
Location: Namek
Contact:

Re: Select users with a_ or m_

Post by Toxyy »

Code: Select all

$admins = $this->auth->acl_get_list(false, 'a_', false);
$mods = $this->auth->acl_get_list(false, 'm_', false);
This is expensive to run so keep it to once per page if you can.
Last edited by Toxyy on Fri Oct 19, 2018 9:38 pm, edited 1 time in total.
I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

Some of my extensions:
[3.3][BETA] Post Form Templates || [3.3][BETA] Anonymous Posts || [3.2][3.3][BETA] ACP Merge Child Forums || [3.2][BETA] Sticky Ad || [3.2][DEV] User Delete Topics || [3.3][DEV] Moderate While Searching || [3.3][RC] Short Number Twig Extension
User avatar
Kailey
Community Team Leader
Community Team Leader
Posts: 3732
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Snay
Contact:

Re: Select users with a_ or m_

Post by Kailey »

I plan on it as well as using caching. Thanks for the input though. ;)
Kailey Snay - Community Team Leader
Knowledge Base | Documentation | Community rules

If you have any questions about the rules/customs of this website, feel free to send me a PM.
Post Reply

Return to “Extension Writers Discussion”