Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Postale - additional member field search - how to


Reply

2 Posts   602 Views

Avatar
ccburns

2 April 2011 at 5:00pm Community Member, 74 Posts

Hi All (but specifically UncleCheese),

Hoping you might be able to help me out here.

I have extended the Member class to include a fair few additional fields (code posted below). Basically I am building a site for long-term traveling families (or nomadic families) like me called VagabondFamily.org.

Each family will be able to create a Family Profile on the site. I then display the profile etc.

I have also installed the Postale module so that families can DM one another. At this point I have one member account per family so I don't really use the FirstName field, but instead use the additional field AccountNickName.

I would really like for the facebook style search functionality to look into this field as well at the FirstName, LastName and probably also a couple of other fields like TwitterAccount, Website, MothersName, FathersName.

I'm not super at digging so deep into the code base but I saw a comment that I think might help me, but I don't really know how to use the information and hoping you might be able to give me a bit of direction.

/postale/code/MessagesPage.php - Line 26.

Thanks in advance for any advice you might have.

Regards,
Colin

   /**
    * @var string A filter clause for the members search. For more advanced functionality,
    * use {@link getSearchableMembers()} in a decorator
    */
   public static $members_filter = null;

<?php
//mysite/code/Family.php
class Family extends DataObjectDecorator{
   function extraStatics(){
      return array(
         'db' => array(
            'AccountNickName' => 'Varchar(50)',
          'TwitterAccount' => 'Varchar(15)',
      'FacebookProfile' => "Varchar(100)",
       'RSSFeed' => "Varchar(100)",
       'Website' => "Varchar(100)",
       'MothersName' => 'Varchar(15)',
       'FathersName' => 'Varchar(15)',
       'WhereAreYouFrom' => 'Varchar(150)',
       'HowManyChildren' => "enum('One on the way, 1 Child,2 Children,3 Children,4 Children,5 Children,6 Children,7 Children, 8 Children, More than 8 Children')",
       'AgeOfYoungestChild' => 'Varchar(50)',
            'AgeOfEldestChild' => 'Varchar(50)',
       'NorthAmerica' => 'Boolean',
       'CentralAmerica' => 'Boolean',
       'Caribbean' => 'Boolean',
       'SouthAmerica' => 'Boolean',
       'MiddleEast' => 'Boolean',
            'IndianSubcontinent' => 'Boolean',
            'SouthEastAsia' => 'Boolean',
            'NorthEastAsia' => 'Boolean',
            'AustralasiaAndPacific' => 'Boolean',
            'WesternEurope' => 'Boolean',
            'EasternEurope' => 'Boolean',
            'Africa' => 'Boolean',
       'TravelStatus' => "enum('Dreaming, Planning, On the Road, Finished')",
       'TravelDuration' => "enum('less than 1 month, 1 month, 1-3 months, 3-6 months, 6-12 months, 1-2 years, indefinite')",
       'DepartureDate' => 'Date',
            'WhenWillYouFinish' => 'Date',
       'TravelBudget' => "enum('Super Budget ( < than \$50/day), Budget (< than \$100/day), Medium (\$100 - \$200/day), Luxury ( > \$200/day)')",
       'WhatDoYouWantToAchieve' => 'Text',
       'FamilyInfo' => 'Text',
       'GreatestFear' => 'Text',
       'Enabled' => 'Boolean',
         ),
         'defaults' => array(
          'TwitterAccount' => '@'
         ),
         'has_one' => array(
'FamilyProfileImage' => 'Image',
),
      );
   }
}
?>

Avatar
ccburns

2 April 2011 at 7:08pm Community Member, 74 Posts

Just incase anyone cares, I just hacked & bastardised UncleCheeses code to get things working the way I wanted them to work.

The code now displays a new caption, searches on a new set of fields and works beautifully.

A very very big thank-you to UncleCheese for coding all of this up...

Cheers,
Colin