vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Parentlist array (https://vborg.vbsupport.ru/showthread.php?t=282407)

mescalin 05-04-2012 07:48 AM

Parentlist array
 
Hello,

I'm trying to construct a very basic plugin but i couldnt manage to use an array for parentlist field in new posts.

Can you give me an example to do that? I want to write a conditional for forumid=15 and all its subforums without adding all subforum ids one by one using parentlist field.

Thanks..

kh99 05-04-2012 09:59 AM

You give very few details of what you want to do (such as hook location, etc), but if you're talking about the forum parentlist, then there is also a childlist that contains the ids of a forum's children.

mescalin 05-04-2012 12:05 PM

Currently i use this conditional in newpost complete.

Code:

if (in_array($foruminfo['forumid'], array(1,2,3..........etc)))
However, if i use forum id i need to write all forumids under a category one by one. I would like to write a conditional that uses main forum category id so i dont need to write all forum ids.

kh99 05-04-2012 12:12 PM

Try something like:


Code:

if (in_array($foruminfo['forumid'], split(',',$vbulletin->forumcache[$categoryid]['childlist'])))

mescalin 05-04-2012 12:42 PM

I tried smth like that but didn't work. Probably i couldnt construct the conditional with a specific categoryid.

Code:

if ( $vbulletin->forumcache[$categoryid] == 48 AND in_array($foruminfo['forumid'], split(',',$vbulletin->forumcache[$categoryid]['childlist'])))

Also i wonder if that conditional works if it's not a category but a regular forum with many subforums under it.

kh99 05-04-2012 12:52 PM

Sorry, that's my fault. There is no variable $categoryid, that was just an example. For instance if you want to check if the current forum is a child of forum 15, then you'd do this:

Code:

if (in_array($foruminfo['forumid'], split(',',$vbulletin->forumcache[15]['childlist'])))

I should also mention that each forum is in its own childlist, so if you didn't want to include forum 15 in your condition then you'd have to check for that (although if 15 is a non-posting forum then it won't matter).

mescalin 05-04-2012 01:04 PM

Thank you! That worked perfectly.

It's geat to have experts as you around here..


All times are GMT. The time now is 09:29 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.01150 seconds
  • Memory Usage 1,714KB
  • 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
  • (4)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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