Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 4255
Latest: andreios
New This Month: 3
New This Week: 1
New Today: 0
Stats
Total Posts: 43259
Total Topics: 7518
Most Online Today: 297
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 258
Total: 258

Author Topic: Show to certain membergroups only  (Read 2577 times)

0 Members and 1 Guest are viewing this topic.

Offline shuban

  • Hero Member
  • *****
  • Posts: 665
    • View Profile
    • Biology Forums
Show to certain membergroups only
« on: November 03, 2014, 08:57:02 pm »
I find that this doesn't work... If a member is not part of group 2 or 3 or 4, etc., then echo 'Whatever';

Code: [Select]
if(!in_array($user_info['groups'], array(2,3,5,6,7,8,16,17,18,21,22,23)))
echo'Whatever';

However if I use:

Code: [Select]
if((!in_array(2, $user_info['groups']) && !in_array(3, $user_info['groups']) && !in_array(5, $user_info['groups']) && !in_array(6, $user_info['groups']) && !in_array(7, $user_info['groups']) && !in_array(8, $user_info['groups']) && !in_array(16, $user_info['groups']) && !in_array(17, $user_info['groups']) && !in_array(18, $user_info['groups']) && !in_array(21, $user_info['groups']) && !in_array(22, $user_info['groups']) && !in_array(23, $user_info['groups'])))
It does work :S

The member whom I'm testing this with is someone who is in group 3 (global admin) and group 17 (post-based member group).

What am I doing wrong here?
« Last Edit: November 03, 2014, 09:20:28 pm by shuban »

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16436
    • View Profile
Re: Show to certain membergroups only
« Reply #1 on: November 04, 2014, 08:03:56 am »
Well because $user_info['groups'] is an array as well and doesn't work like that since users can have more than one group.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline shuban

  • Hero Member
  • *****
  • Posts: 665
    • View Profile
    • Biology Forums
Re: Show to certain membergroups only
« Reply #2 on: November 04, 2014, 10:30:12 am »
So how do I combine the 2nd one instead of having the huge query?

 

Related Topics

  Subject / Started by Replies Last post
0 Replies
4472 Views
Last post April 21, 2007, 10:13:58 pm
by olandir
4 Replies
4562 Views
Last post March 29, 2010, 02:50:28 pm
by SMFHacks
0 Replies
2796 Views
Last post July 16, 2010, 01:42:35 pm
by 4x4uk
11 Replies
8209 Views
Last post January 25, 2011, 08:21:02 am
by SMFHacks
1 Replies
1348 Views
Last post September 30, 2021, 02:07:34 pm
by SMFHacks

+- Recent Topics

No thumbnails on new uploads by SMFHacks
March 27, 2024, 02:10:41 pm

Display the Contact Page for guests by SMFHacks
March 27, 2024, 10:55:43 am

is it possible to add support for odysee.com by fvlog19
March 21, 2024, 08:47:51 am

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

an idea for new mod (( content type with different display )) by SMFHacks
February 27, 2024, 01:36:27 pm

[Mod] RSS Feed Poster by SMFHacks
February 27, 2024, 11:57:18 am

find duplicate pictures by fvlog19
February 14, 2024, 02:22:40 pm

Error uploading video. by SMFHacks
February 08, 2024, 02:04:16 pm

Gallery icon as last added image by fvlog19
February 01, 2024, 01:04:56 pm

Powered by EzPortal