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

Delegate Request - Search Form

edited March 2008 in Vanilla 1.0 Help
Hi, I'm trying to override the search query for users and allow extensions to override it also and I'm not sure of the best approach - so any advice, ideas welcome. For example, I want to extend the user search, to search any user labels that have been set. Also I want to edit the PreDefined Attributes Add-on to be able to extend the Users query - so that it will search any extra data as well. I dont really want to have an extra radio option on the search form for users and attributes.. I'm not sure how best to approach this - as ideally any extensions should know nothing about the rest of the user search and any extensions that modifiy it - so passing the sqlbuilder back and forth might remove any dependancies and add flexibilty? Alternatively, is there another way to override the search control with out hacking the core? The actual function that does the search for users is in the UserManager class - so simply hacking that would be easy - but it would be nice to do it the Vanilla way and not break when the core gets updated in future. Any ideas, thoughts? Ross

Comments

  • Options
    MarkMark Vanilla Staff
    All of this is possible with delegation - you just need to tell me where you want it.

    Alternately, you can completely override core vanilla classes using the ObjectFactory if worse comes to worse.
  • Options
    Ah excellent stuff, Can you insert the following to: People.Class.UserManager.php before the $s->DefineSearch(); is called on line 474. $this->DelegateParameters['SqlBuilder'] = &$s; $this->CallDelegate('extendUserGetSearchBuilder'); Cheers Ross
  • Options
    MarkMark Vanilla Staff
    Okay, I've done it, but I have it a different delegate name. It appears in svn like this:

    $s->AddSelect('Icon', 'r', 'RoleIcon'); $this->DelegateParameters['SqlBuilder'] = &$s; $this->CallDelegate('PreDefineSearch'); $s->DefineSearch();
  • Options
    Hi Mark,

    I have another request for adding extra information to the discussion list on the index page:
    discussion.php line 46:

    $this->DelegateParameters['DiscussionList'] = &$DiscussionList; $this->DelegateParameters['DiscussionID'] = $Discussion->DiscussionID; $this->CallDelegate('extendDiscussionList');

    Regards,

    Ross
  • Options
    MarkMark Vanilla Staff
    edited August 2006
    This is already in there and it has everything you need:

    $this->DelegateParameters['Discussion'] = &$Discussion; $this->DelegateParameters['DiscussionList'] = &$DiscussionList; $this->CallDelegate('PostDiscussionOptionsRender');
  • Options
    Sorry for bumping up an old discussion, but I'm having an issue where the PostDiscussionOptionsRender is NOT being called on the search results page for the Discussion Topic Search. I'm specifically using a modified version of the DiscussionCounters plugin, which runs on the PostDiscussionOptionsRender and works perfectly fine for any of the other DiscussionGrid views. Any insight would be welcome.
  • Options
    Maybe it has something to do with the search being run from Vanilla.Control.SearchForm.php instead of the usual Vanilla.Control.DiscussionGrid.php.

    I don't see anything offhand that would keep this from working, will see if I can figure it out.
  • Options
    sorry but I've got some seriouse trouble, understanding the solution... I want to do the same as Ross once posted - search also (only - except Name) in (predefined)Attributes for Users... to list for example all the users, who have got "Berlin" or "single" in their Profile if one is searching for it. Unfortunately, at the moment I'm not as familar as needed with this system to fix this all alone, so I hope there is someone, who may help me. *pls*
  • Options
    I think you would need to attach to both contexts that the delegate would be called, like this: $Context->AddToDelegate('DiscussionGrid', 'PostDiscussionOptionsRender', 'YourFunctionName'); $Context->AddToDelegate('SearchForm', 'PostDiscussionOptionsRender', 'YourFunctionName');
This discussion has been closed.