HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.

how to make extensions?

edited February 2006 in Vanilla 1.0 Help
does a 'how to make an extensions for vanilla forums' exist? i've already find a way to add a item in forum menu but i've got problems with class settings...

Comments

  • The easiest way is to take a simple extension and mess with stuff until it does what you want. Mark's been a little busy lately to work on documentation.
  • edited January 2006

    if(in_array($Context->SelfUrl, array('index.php', 'comments.php', 'search.php', 'account.php', 'settings.php', 'categories.php', 'post.php')) &&
    $Context->Session->User->RoleID)
    {
    $Menu->AddTab($Context->GetDefinition("Musik"), "musik", "index.php?Musik=Afficher", "MusikTab");
    }

    $Musik = $_GET['Musik'];
    if ($Musik == 'Afficher') {
    $Body = ...contents to be posted...
    }

    How to do that?
  • edited January 2006
    Veiled where I am :

    if (isset($_GET['Musik'])) {
    class Musik {

    function Render() {
    echo "salut la companie";
    }

    }

    $Musik = $Context->ObjectFactory->NewContextObject($Context, "Musik");
    $Body->AddControl($Musik);

    $Page->AddControl("Head_Render", $Head);
    $Page->AddControl("Menu_Render", $Menu);
    $Page->AddControl("Panel_Render", $Panel);
    $Page->AddControl("Body_Render", $Body);
    $Page->AddControl("Foot_Render", $Foot);
    $Page->FireEvents();

    }
    the script work but i've got the fatal error : Call to a member function on a non-object in c:\program files\easyphp1-8\www\vanilla\index.php on line 24

    what's wrong ?
  • I think you have to exit()/die()/return/whatever if you've created the page in the extension. Try putting in an exit() after the $Page->FireEvents() and see how it works out.
  • MarkMark Vanilla Staff
    Also, a "NewContextObject" is a new object that has the context object inserted into it's constructor method, so assuming we're using 0.9.3 your Musik class would need a constructor with:

    class Musik extends Control { function Musik(&$Context) { $this->Name = "Musik"; $this->Context = &$Context; } }
  • That did not change anything, I always have the fatal error : Call to menber function on a non-object in $Context->Session->Check(agSAFE_REDIRECT);
  • MarkMark Vanilla Staff
    What version of Vanilla are you using?
  • 0.9.2.6
  • MarkMark Vanilla Staff
    And what exactly are you trying to do?
    Are you trying to add a whole new page for the tab you added?
  • edited January 2006
    http://forumz.aboutblank.free.fr/index.php?Musik=Afficher => http://musik.aboutblank.free.fr/extension/Musik.rar
  • how to remove <a class="PanelButton StartDiscussionButton" href="post.php">Start a new discussion</a> only in musik page?
This discussion has been closed.