Announcement

Collapse
No announcement yet.

Get CMS section in plugin code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • tpearl5
    replied
    Anyone ever figure this out? I want to say if section and articles in that section, do something.

    Leave a comment:


  • Archimedes
    replied
    If I use vB::$vbulletin->nodeid in my plugin, hook: global_bootstrap_complete I get an php error:
    Class 'vB' not found in /forum/includes/class_bootstrap.php

    No I do a workaround via the ($_GET['r'] - but this isn't a clean solution.

    Any update on this?

    Leave a comment:


  • Merwech
    replied
    Any update to this request ? (i'm in 4.0.4 and it still doesn't work)

    I also need to get the sectionid info in my templates and can't figure of a way to make it works.

    Leave a comment:


  • alfanexus
    replied
    Okay I still struggle with this, since this might be a problem with execution order I guess that there is no guarantee that it will work in 4.04, so I have made a paid request here at vbulletin.org. If any one can help me then this might be a job for you: http://www.vbulletin.org/forum/showthread.php?p=2025843

    Leave a comment:


  • alfanexus
    replied
    Yes already tried to use $GLOBALS['sectionid']. But I diden't think about execution order of the hooks, this might be the problem, I don't know the order of them.

    So I guess I am back to waiting for a solution in vb 4.04. Thanks for your effort

    Leave a comment:


  • Lynne
    replied
    Is the hook located at process_templates_complete rendered before or after the hook located at vbcms_article_populate_end. If it is before, then it is not going to have the sectionid. You may need to try $GLOBALS['sectionid'] (but, of course, if the hook is run before, then that won't work either).

    Leave a comment:


  • alfanexus
    replied
    At first I was also under the impression that Edwins offering was a fix *until* 4.0.4 came out. But I am not sure anymore.
    What I did was creating a plugin with hook location vbcms_article_populate_end and added the code:
    global $sectionid;
    $sectionid = $this->content->getParentId();

    This gets the section id alright (I have testet this by outputting the sectioned), and from my understanding $sectionid would now be a global variable that can be used any place. But when I create another plugin with with hook location process_templates_complete and try to use $sectionid the variable is just empty. So maybe something else ware is resetting the content of $sectionid;

    Edwin also said that I could add the section id in vbcms_section_populate_end if I like, but in vb 4.03 there is no hook called vbcms_section_populate_end, so maby this will not work until 4.04 anyway?

    I have searched for this all over vbulletin.com, vbulletin.org and google, and I see that others are asking the same, but havent fount any working solution yet

    Leave a comment:


  • Lynne
    replied
    I haven't tested it either.

    Leave a comment:


  • cellarius
    replied
    Oh, but I may have misread it, too - didn't test. As Lynne, I've been wrong before, and I doubt it would be the last time

    Leave a comment:


  • Lynne
    replied
    Edwin suggested your would need to add two plugins. Did you add both?

    (I was under the impression that Edwin was offering that code as a fix *until* 4.0.4 came out. Perhaps I'm wrong.... (has been known to happen! ))

    Leave a comment:


  • alfanexus
    replied
    Oh crap, I understood it as I could make it global with this code in 4.03 and that it would be built in 4.04.

    Well I will then just have to wait another month or whenever 4.04 is released before I upgrade to Vbulletin 4 on my live site...

    If anyone has another solution that works right now please let me know, VB 4 has so many new great features I would like to introduce to my uses that is still on a vb 3.8 site

    Leave a comment:


  • cellarius
    replied
    Originally posted by alfanexus View Post
    What Am I doing wrong?
    You missed the line where Edwin stated that this would not yet work in 4.0.3, but in the next version (i.e. 4.0.4).

    Leave a comment:


  • alfanexus
    replied
    Thank you very much, but I still have some trouble...

    I have created a plugin with hook location vbcms_article_populate_end and added the code:
    global $sectionid;
    $sectionid = $this->content->getParentId();


    Then I have a plugin with hook location process_templates_complete and there I have added the code:
    if ($sectionid == 3)
    {
    ......
    }

    But even though the sectionid is 3 I dont get into the "if" What Am I doing wrong?

    Leave a comment:


  • Edwin Brown
    replied
    I've added code to the current code to make sure sectionid is available, but it's not in v403. You could attach something like this to the hook "vbcms_article_populate_end"

    global $sectionid;
    $sectionid = $this->content->getParentId();

    and to vbcms_section_populate_end if you like


    global $sectionid;
    $sectionid = $this->content->getNodeId();

    Leave a comment:


  • alfanexus
    replied
    It seems that $sectionid is uses at some places, but I can not get it to work when I create a plugin using Process_templates_complete.

    Please anyone? How do I get the section id so it can be used in my tabs plugin?

    Leave a comment:

widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X