vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Combining a conditional with an array (https://vborg.vbsupport.ru/showthread.php?t=327203)

RichieBoy67 04-08-2019 12:49 PM

Combining a conditional with an array
 
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.

z3r0 04-08-2019 05:32 PM

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

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 04-08-2019 05:48 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.

RichieBoy67 04-08-2019 05:52 PM

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 [DATE]1554759075[/DATE] at [TIME]1554759075[/TIME] ---------------

What about this?

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

--------------- Added [DATE]1554819211[/DATE] at [TIME]1554819211[/TIME] ---------------

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

z3r0 04-09-2019 02:31 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.

RichieBoy67 04-09-2019 07:36 PM

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 04-10-2019 01:32 PM

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:
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

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:
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.


All times are GMT. The time now is 04:27 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01120 seconds
  • Memory Usage 1,740KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (11)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete