Hello,
I am creating a dating site and I want my users to use Advanced Search by age. I know there is possibility to click "age" field to search by age, but actually this is not user friendly. (Even myself I could not distinguish this great feature when I was seraching for the first times).
As the site is for dating, there is no sense to search by birth date.
QUESTIONS
Is there any possibility to disable search by birth date?
If not, is there possibility to have search by age as default option? (at the moment, search by date is default and you need to click "age" to switch it, which is not friendly).
//I am also aware about dating search plugin, but that one has lack of functionality as for Advanced Search.
Thank you.
Hi Sergey,
1) Is there any possibility to disable search by birth date?
- yes you can do it from jomsocial backend > profiles > customize profile > and set Searchable to any fields you want
2) If not, is there possibility to have search by age as default option? (at the moment, search by date is default and you need to click "age" to switch it, which is not friendly).
- you can do it by using template override (
documentation.jomsocial.com/wiki/Customizing_Template
)
copy search.advancesearch.php from /components/com_community/templates/default/ to /templates/youractivetemplate/html/com_community/ and put this code
if (value == 'FIELD_BIRTHDATE') joms.jQuery('#valueinput'+id+' a').click();changeField: function ( id )
Hi Albertus,
Thanks for quick reply!
I have found the file search.advancesearch.php in the folder /components/com_community/templates/default/
The folder /templates/youractivetemplate/html/ did not contain folder /com_community/, so I created it and copied above file here.
The above file did not contain the mentioned string at line 306. But I could find this string at line #235.
So, I put your code at line 236:
if (value == 'FIELD_BIRTHDATE') joms.jQuery('#valueinput'+id+' a').click();
Hi Sergey,
you must put that code at the end of changeField function, before
},
Hi Albertus,
Thanks for your help. Now, the Advance Search works as desired: age is set by default.
However, I still have an issue with translation. If I follow your link regarding elements translation, I can change name from "Date of Birth" to "Age" successfully. However, in this case, at the time of new user registration he is also requested to input his AGE instead of BIRTH DATE.
I believe, these two fields shall be separately distinguished somehow.. Is there any simple possibility to print out some constant like LNG_JS_AGE at the time of birthdate field print in the Advanced Search?
Thank you.
Hi Sergey,
for using LNG_JS_AGE, please follow this steps:
1. copy search.advancesearch.php from /components/com_community/templates/default/ to /templates/rt_tachyon/html/com_community/
2. edit it, and find this code
criteria +='<option value="<?php echo addslashes($field->fieldcode); ?>" <?php echo $selected; ?>><?php echo JText::_(addslashes(JString::trim($field->name)));?></option>';<?php if ($field->fieldcode == 'FIELD_BIRTHDATE') { ?>
criteria +='<option value="<?php echo addslashes($field->fieldcode); ?>" <?php echo $selected; ?>><?php echo JText::_('LNG_JS_AGE');?></option>';
<?php } else { ?>
criteria +='<option value="<?php echo addslashes($field->fieldcode); ?>" <?php echo $selected; ?>><?php echo JText::_(addslashes(JString::trim($field->name)));?></option>';
<?php } ?>