vBulletin Mods

The Official vBulletin Modifications Site
https://www.vbulletin.org/forum/showthread.php?t=327203

Combining a conditional with an array
by RichieBoy67
08 Apr 2019 14:49

Hey everyone,

I am trying to hide certain forums from being visible to guests on forumhome. I have the conditional to hide them but I do not know how to keep them hidden for guests only.

This is what I have to hide:
<vb:if condition="!in_array($forum['forumid'], array(###,###,###,###))">

I believe I add

AND $show['member']

but when I do the entire forum home becomes invisible so apparently I am doing it wrong. :)

Thanks everyone!

In Omnibus 08 Apr 2019 15:41

This might help you out:

https://www.vbulletin.org/forum/showthread.php?t=231525

RichieBoy67 08 Apr 2019 16:07

Thanks but I already know about that thread. I am needing to combine an array with another conditional. Not find a conditional.

z3r0 08 Apr 2019 19:32

I'm not at my PC to check but I think it may need to be $GLOBALS['forumid'] not $forum['forumid']

RichieBoy67 08 Apr 2019 19:35

Quote:

Originally Posted by z3r0 (Post 2599045)
I'm not at my PC to check but I think it may need to be $GLOBALS['forumid'] not $forum['forumid']

Thanks, the array part works alone as far as hiding those forums from the forum page but I cannot get them to show for members only. Is that way? Because I am not suing $GLOABALS?

Thanks again,
Rich

z3r0 08 Apr 2019 19:48

I've no idea why, but I've just done a quick search of the site and there are lots of examples of $GLOBALS['forumid'] with an array joined with other conditions.

RichieBoy67 08 Apr 2019 19:52

Quote:

Originally Posted by z3r0 (Post 2599047)
I've no idea why, but I've just done a quick search of the site and there are lots of examples of $GLOBALS['forumid'] with an array joined with other conditions.

I will try that but I think I have this wrong even if I make that change.

<vb:if condition="!in_array($forum['forumid'], array(494,520,527,528,531,537)) AND $show['member']">

Thanks

--------------- Added 08 Apr 2019 at 21:31 ---------------

What about this?

<vb:if condition="!in_array($GLOBALS['forumid'], array(494,520,527,528,531,537)) AND $bbuserinfo['usergroupid'] != 1">

--------------- Added 09 Apr 2019 at 14:13 ---------------

I have not made any progress with this at all. What am I missing?

z3r0 09 Apr 2019 16:31

I've just reread your first post, there is no need for a condition, just set the forum permissions to not show to unregistered/not logged in for each forum you want to hide from guests.

RichieBoy67 09 Apr 2019 21:36

Quote:

Originally Posted by z3r0 (Post 2599063)
I've just reread your first post, there is no need for a condition, just set the forum permissions to not show to unregistered/not logged in for each forum you want to hide from guests.

You can only hide the content that way. Everyone can still see the forum. Anyways, Dave figured it out for me. I had everything right but he added an empty if statement. Genius. I was pulling my hair out.

Kane@airrifle 10 Apr 2019 15:32

1 Attachment(s)
Quote:

Originally Posted by RichieBoy67 (Post 2599069)
You can only hide the content that way. Everyone can still see the forum. Anyways, Dave figured it out for me. I had everything right but he added an empty if statement. Genius. I was pulling my hair out.

:confused:

In the forum permissions manager you can set zero access to everything for any user group. Works perfectly well on my 4.2.5 forums.

If you are paranoid about links from private forums being shared on other platforms you can also make a redirect plugin to replace the standard "no permission" message a non credentialed user may receive.

EG:
Hook: error_fetch
Title: Redirect Private Threads
Code:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


RichieBoy67 10 Apr 2019 15:34

Quote:

Originally Posted by Kane@airrifle (Post 2599079)
:confused:

In the forum permissions manager you can set zero access to everything for any user group. Works perfectly well on my 4.2.5 forums.

If you are paranoid about links from private forums being shared on other platforms you can also make a redirect plugin to replace the standard "no permission" message a non credentialed user may receive.

EG:
Hook: error_fetch
Title: Redirect Private Threads
Code:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Yes, no access but those forums will still be visible, just not the threads. I wanted the forums to be completely invisible to guests which is accomplished now.

Thanks for the reply.


All times are GMT. The time now is 20:12.

Powered by vBulletin® Version 3.8.12
Copyright © 2019, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.