vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   vB4 Template Conditionals List (https://vborg.vbsupport.ru/showthread.php?t=231525)

BirdOPrey5 08-29-2010 04:58 PM

Hmmm... you could force users to use a specific style for that forum, and in that style you could remove the code for the new thread button completely... but that seems overkill... the IF condition should work... I'm surprised it's not.

ICannt.org 08-31-2010 10:32 PM

I was surprised it didn't work either, unless there's something I might have missed?

midnz 09-02-2010 08:37 AM

Quote:

Originally Posted by ICannt.org (Post 2090948)
Essentially, we've got Easy Forms installed and we want users to only be able to submit a form on particular forums so they can follow a pre-defined template instead of being able to post whatever they want.
I've got a "Notice" on the forums saying with a bit of text, including a link to the needed form, but I know of no other way to hide the "New Thread" button.

I originally tried simply taking away permissions for Registered Users to Create New Threads, but then that wouldn't let them upload attachments to the form - which is a necessity.

If you know of any other way to do this, that would be greatly appreciated.

You can make a plugin so that if the "New Thread" button is used it generates your form.

Hook Location: newthread_start
Two examples in the code below - (change the forum ID numbers and the form addresses)
PHP Code:

if (in_array($forumid, array(1,2))) {
header'Location: http://www.xxxxxxx.org/forums/misc.php?do=form&fid=3' ) ;
}
if (
$forumid==4)
{
header'Location: http://www.xxxxxxx.org/forums/misc.php?do=form&fid=5' ) ;



moonclamp 09-03-2010 12:46 AM

I want a user to be able to disable and enable a plugin that starts:

if ($vbulletin->options['mob_detect_enabled'] == 1)

So, I've created a profile field (for a setting) and I want to use this conditional inside the plugin so that ordinary members can disable it (it uses the style_fetch hook).

I think I need to add something like this at the top of the plugin, but in php ...

HTML Code:

<vb:if condition="$bbuserinfo['fieldXXX'] === 'off'">
Stuff
<vb:else />
Different Stuff
</vb:if>

Can anyone tell me how I write the same thing in PHP to get it to work?

BirdOPrey5 09-03-2010 01:48 AM

Try

Code:

if ($vbulletin->options['mob_detect_enabled'] == 1 AND $bbuserinfo['fieldX'] == "off")
{
php stff
}
else
{
other php stuff
}


moonclamp 09-03-2010 04:17 AM

No that didn't do it ... but that may be down to my lack of php understanding.

BirdOPrey5 09-03-2010 01:38 PM

Yeah the problem is the $bbuserinfo - there are various ways to access the same data, different ways work in different places... it may be something like $vboptions->bbuserinfo['fieldX'] or even $this->registry->bbuserinfo['fieldX'] but honestly I'm not sure of the exact syntax off hand, if you search around for it you should be able to find one that works, that's what I usually do.

XLCR GODFATHER 09-03-2010 02:18 PM

try

Code:

$userinfo['fieldxx']
worked for me

moonclamp 09-03-2010 03:54 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2093269)
it may be something like $vboptions->bbuserinfo['fieldX']

I tried that one to no avail.
Quote:

Originally Posted by BirdOPrey5 (Post 2093269)
or even $this->registry->bbuserinfo['fieldX']

I'll have a go with the above a bit later (when nobody is on my site), thanks :)

Quote:

Originally Posted by XLCR GODFATHER (Post 2093289)
try

Code:

$userinfo['fieldxx']
worked for me

Already tried that, and unfortunately it didn't do it.

ICannt.org 09-04-2010 04:58 AM

Quote:

Originally Posted by midnz (Post 2092716)
You can make a plugin so that if the "New Thread" button is used it generates your form.

This worked!

Thanks to the people who helped, greatly appreciated. :)


All times are GMT. The time now is 01:04 PM.

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

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01610 seconds
  • Memory Usage 1,744KB
  • 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
  • (3)bbcode_code_printable
  • (1)bbcode_html_printable
  • (1)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete