Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Topic started by: Filipina on April 14, 2009, 12:24:33 AM

Title: Profile Search
Post by: Filipina on April 14, 2009, 12:24:33 AM
Hello and glad to be here. Trouble connecting to SMF at times but all seems well today.

I have SMF 1.1.8 default Theme and a million mods, almost.

Ok, I have had a million people tell me a dating site on SMF is a bad idea. I don't care because I have 3500 members, SMF Gallery Pro, decent traffic, so I like things just the way they are.

I tried searching this but maybe I do not enter the correct terms. Is it possible, or how would I go about getting the search function to zoom in on profiles only with an age paramater. You know like someone types in "25" or "1981-1983" and gets a list of members matching this criteria.  Am I dreaming? LOL

I am willing to add something to the profile template if it can work.  Or maybe there is a way to customize the search function I am not aware of. Something tells be it might be tied into the date of birth question on registration  :)

Thanks for any ideas.
Title: Re: Profile Search
Post by: fals on April 14, 2009, 07:28:37 AM
Well, i know how to search for birthdate/year :-)

You need to altor your Sources/Memberlist.php
Look for:
    // Set up the columns...
    $context['columns'] = array(
        'isOnline' => array(
            'label' => $txt['online8'],
            'width' => '20'
        ),
        'realName' => array(
            'label' => $txt[35]
        ),


Add after:

        'birthdate' => array(
            'label' => $txt[420]
        ),


Look for:
    // List out the different sorting methods...
    $sort_methods = array(
        'isOnline' => array(
            'down' => '(ISNULL(lo.logTime)' . (!allowedTo('moderate_forum') ? ' OR NOT mem.showOnline' : '') . ') ASC, realName ASC',
            'up' => '(ISNULL(lo.logTime)' . (!allowedTo('moderate_forum') ? ' OR NOT mem.showOnline' : '') . ') DESC, realName DESC'
        ),
        'realName' => array(
            'down' => 'mem.realName ASC',
            'up' => 'mem.realName DESC'
        ),


Add after:
 
      'birthdate' => array(
            'down' => 'mem.birthdate DESC',
            'up' => 'mem.birthdate ASC'
        ),


Look for:
        // Search for websites.
        if (in_array('website', $_POST['fields']))
            $fields += array(7 => 'websiteTitle', 'websiteUrl');


Add after:
        // Search for birthday.
        if (in_array('birthdate', $_POST['fields']))
            $fields += array(10 => 'birthdate');


Open your Memberlist.template.php

Look for:
<label for="fields-name"><input type="checkbox" name="fields[]" id="fields-name" value="name" checked="checked" class="check" /> ', $txt['mlist_search_name'], '</label><br />

Add after:
<label for="fields-birthdate"><input type="checkbox" name="fields[]" id="fields-birthdate" value="birthdate" checked="checked" class="check" /> Search for birthday</label><br />

Now you can search for 1979, 79 or exact birthdate 1979-07-21  ;)
(it dosnt show the date/age in the list though)


Title: Re: Profile Search
Post by: Filipina on April 14, 2009, 08:18:27 PM
Wow fals thanks a million for that. The only thing I had a problem with was the number of tables on the memberlist but I was able to figure out the edit to make it work. This is a 100% improvement over no age search and thanks for your assistance. Now members can plug in a year of birth on search and get a list of members born in that year.  :)

I wonder if there is a way to get that age column on the member list (http://www.melindaspenpals.com/penpal-community/index.php?action=mlist;sort=registered;desc;start=100) to actually show the age of the member pulling from the date of birth? 
Title: Re: Profile Search
Post by: Filipina on April 15, 2009, 11:20:44 AM
Hey fals just wondering if your error log fills up now if you use this age search method. Mine is now filling up quickly with these errors.

http://www.melindaspenpals.com/penpal-community/index.php?action=mlist;sort=registered;desc;start=80 
8: Undefined index: birthdate
File: /xxxx/xxxxx/xxxxxx/penpal-community/Themes/default/languages/Profile.english.php (main sub template - eval?)
Line: 121
Title: Re: Profile Search
Post by: fals on April 15, 2009, 12:11:23 PM
Hey
Sorry, cant tell, im not using this search.... and my errorlog is disabled  :-\
Title: Re: Profile Search
Post by: greyknight17 on April 30, 2009, 02:24:47 PM
Filipina, is this issue resolved now? If not and you still get those errors, do the below:

Go into phpMyAdmin (http://www.simplemachines.org/community/index.php?topic=21919.0) and click on your database. Then click on the SQL tab and copy paste the following code and run it:

INSERT INTO smf_settings VALUES ('disableTemplateEval', 1);

Use the forum a little and try to regenerate new errors. If any are found, post the new ones here. Then run this query to undo the change we made earlier:

DELETE FROM smf_settings WHERE variable = 'disableTemplateEval';