View Full Version : Combining a conditional with an array
RichieBoy67
04-08-2019, 12:49 PM
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
04-08-2019, 01:41 PM
This might help you out:
https://vborg.vbsupport.ru/showthread.php?t=231525
RichieBoy67
04-08-2019, 02:07 PM
Thanks but I already know about that thread. I am needing to combine an array with another conditional. Not find a conditional.
I'm not at my PC to check but I think it may need to be $GLOBALS['forumid'] not $forum['forumid']
RichieBoy67
04-08-2019, 05:35 PM
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
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
04-08-2019, 05:52 PM
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 1554759075 at 1554759075 ---------------
What about this?
<vb:if condition="!in_array($GLOBALS['forumid'], array(494,520,527,528,531,537)) AND $bbuserinfo['usergroupid'] != 1">
--------------- Added 1554819211 at 1554819211 ---------------
I have not made any progress with this at all. What am I missing?
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
04-09-2019, 07:36 PM
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
04-10-2019, 01:32 PM
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:
if (!isset($vbulletin->userinfo['userid']) OR $vbulletin->userinfo['userid'] == 0)
{
$vbulletin->url = 'https://www.whateverpageyouwantotredirectto.com/';
eval(print_standard_redirect('no permission'));
}
RichieBoy67
04-10-2019, 01:34 PM
: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:
if (!isset($vbulletin->userinfo['userid']) OR $vbulletin->userinfo['userid'] == 0)
{
$vbulletin->url = 'https://www.whateverpageyouwantotredirectto.com/';
eval(print_standard_redirect('no permission'));
}
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.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.