Not signed in (Sign In)

Categories

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

Help keep Vanilla free:
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthorRoss
    • CommentTimeAug 9th 2006
     # 1
    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
    •  
      CommentAuthorMark
    • CommentTimeAug 9th 2006
     # 2
    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.
    • CommentAuthorRoss
    • CommentTimeAug 10th 2006
     # 3
    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
    •  
      CommentAuthorMark
    • CommentTimeAug 10th 2006
     # 4
    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();
    • CommentAuthorRoss
    • CommentTimeAug 14th 2006
     # 5
    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
    •  
      CommentAuthorMark
    • CommentTimeAug 14th 2006 edited
     # 6
    This is already in there and it has everything you need:

    $this->DelegateParameters['Discussion'] = &$Discussion;
    $this->DelegateParameters['DiscussionList'] = &$DiscussionList;

    $this->CallDelegate('PostDiscussionOptionsRender');
  1.  # 7
    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.
    •  
      CommentAuthorWallPhone
    • CommentTimeDec 6th 2007
     # 8
    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.
  2.  # 9
    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*
    •  
      CommentAuthorWallPhone
    • CommentTimeMar 27th 2008
     # 10
    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');
Add your comments
    Username Password
  • Format comments as