Community Builder Advanced Search: Search By Age Interval and Avatar Only Unofficial Hack

As I posted in joomla forum about my plan to release my hack for community builder advanced search, here I will give some notes about how to enable and implement the hack. This hack is made for Community Builder Advanced Search 2.0.4 (which might be later adapted to work with the upcoming 2.0.5).

Before you proceed

Currently this component only works in Joomla 1.0.x. It’s not recommended to install this component on Joomla 1.5 unless you want to provide assistance in reporting bugs and compatibility of this component. Please read the full article here.

What’s this hack for?

This hack will enable search for members with certain age ranges, defined by user. This hack will also add extra filter to show only member with avatar / thumbnail photo.

Who will benefit from this hack?

Community based site’s owners and webmasters who use Community Builder to power their community-based service.

Short notice before you decide to implement this hack:

This hack is intended to work with simple_menu_2 mode. If you use other modes for the search, the search won’t take any effect from this modification.

About simple_menu_2 mode:

This mode is the one where you can put several search criteria (ie. predetermined fields). and filter the search based on user input to each field. To check if this mode is enabled, go to Components > Community Builder Advanced Search > Configuration and make sure “Allow Simple Menu 2” is set to “Yes”.

Simple Menu 2 Enabled

To enable this hack, please follow the instruction given below:

1. Download the modified component from this link: http://dev.amikelive.com/joomla1/component/ option,com_remository/Itemid,5/func,fileinfo/id,2/

2. Install the component using Joomla installer from admin backend

3. From your admin panel, go to Components > Community Builder Advanced Search > Configuration

4 Scroll down. Two new config sections will appear.

New Config

The first one is config directive for search by age interval. Enable this hack and manage the interval. For the birthday field, you need to first create the field through Community Builder and make sure your new user is forced to fill his/her birtday or s/he won’t be appeared on the search result page.

For the avatar only directive, no more configuration is needed. Enabling this hack is enough.

If you follow the steps properly, your search form will now be added with two new fields: the search by age interval and search by avatar/photo only.

Search Form

Updates as of 08/14/2007:

  1. Extra sql string to check if avatar contains nophoto.jpg
  2. Tiny cosmetic change in the search template
  3. Sql error fix if “avatar only search” is enabled and user only checks that option and leaves other search criteria (if any) empty.

Updates as of 12/17/2007:

  • Comment is now closed. Please refer to new post “Community Builder Advanced Search (Modified Version) Bugtrack and Wishlist” if you want to submit bug or request new features
  • What to provide for a bug report:
    • Current Joomla version
    • Current Community Builder version
    • Steps to replicate bug in details (#R)
    • Online sample if I can not reproduce #R
  • What to provide for a feature request:
    • Reason for the request
    • Who will take benefit from this additional feature
    • Request details

Update as of 01/08/2008:

  • Comment section reopened after considering some requests and inputs.

Please help me by providing input if you want to make this hack better.

74 thoughts on “Community Builder Advanced Search: Search By Age Interval and Avatar Only Unofficial Hack

  1. rafa nog

    I have installed in Joomla 1.0.15 and cb 1.1 Everything is fine except the search always return “There are no published user list”

    Any ideas?

    Thanks

    Reply
  2. Tech Admin Post author

    @rafa nog
    I haven’t checked Joomla 1.0.15 yet. Currently, the existing file is a bit obsolete. I will notify if I have provided a newer version which is compatible to latest Joomla and CB versions.

    @andy
    Based on my observation, the modification is done to the template form, class file, and the frontend php file.

    Reply
  3. andy

    It would be good if something like that could be implemented in your version.

    Iv also read that the standard version has problems when used on large sites with thousands of users. Surly that makes the component pretty worthless as it needs to be much more scalable.

    Reply
  4. Tech Admin Post author

    @andy
    Yes, scalability issue is also another problem. As you might notice, I *might* decide a total rewrite of this component if my spare time permits.

    Thank you for your comment

    Reply
  5. andy

    Well I hope you do rewrite the whole component. The original authors site is dead and there does not look like there are any updates coming! If you do rewrite the component I and many others would be more than willing to pay reasonable amount for it!

    Reply
  6. Lisa

    Hi the component works for me but I get a message after every query saying handler could not be removed – any suggestions on resolving this

    Reply
  7. Moni

    If your search returns no results, go into your CB list manager. Create a new list that contains ALL the members of your site. Make it the ‘default’ list. Now, you’ll get results.

    Moni
    theGrindLab.com

    Reply
  8. admin

    Hi,
    i have installed this version (after many problems on cbas 2.0.5 beta and 2.04).
    Congratulations, it seems to integrate many useful bug fixes.
    My problem is that when i launch a search, it returns the following messages :

    “Warning: Division by zero in /home/mydomain/administrator/components/com_cb_search/cb_search.class.php on line 778”

    “Warning: Division by zero in /home/mydomain/administrator/components/com_cb_search/cb_search.class.php on line 779”

    It seems to be due to $limit variable (equals 0 ?) …
    Any solution about that ?
    Thank you in advance

    dgo

    By the way, here is my conf :
    joomla 1.5
    cb 1.1
    cbas verison from today download : 10-aug-08

    cheers

    Reply
  9. andy

    Any update on this? I’m waiting with bated breath LOL.

    The knew cb1.2rc has searchable userlists but its still crap. I don’t understand why they don’t just build a component like this into CB and be done with it!

    Reply
  10. Johny

    Hi.
    In my CB, it looks like a great solution to provide an advanced search of users.
    But the problem is I couldn’t run it at my site at all.
    Installation was successful, but when I click on Community Builder Advanced Search submenu of Components menu, it rather shows me error message below instead of any configuration window or something.

    Warning: cb_as::require_once(C:\AppServ\www\joomla/includes/patTemplate/patTemplate.php) [function.cb-as-require-once]: failed to open stream: No such file or directory in C:\AppServ\www\joomla\administrator\components\com_cb_search\cb_search.class.php on line 316

    Fatal error: cb_as::require_once() [function.require]: Failed opening required ‘C:\AppServ\www\joomla/includes/patTemplate/patTemplate.php’ (include_path=’.;C:\AppServ\php5;’) in C:\AppServ\www\joomla\administrator\components\com_cb_search\cb_search.class.php on line 316

    It’s an urgent problem, and I hope it will be solve ASAP.
    It happened on Joomla 1.5.5 with legacy mode turned on.
    The version information of this module I tried is 2.0.4

    Please Help.
    I want an answer in 12 hours.

    Best Regards.

    Reply
  11. Tech Admin Post author

    @andy
    sorry for waiting but at current state i can’t guarantee a release date. in fact i’m searching for another fellow developer to build the component from scratch with better conceptual dataflow instead of hackish way like current release. i also have other research stuff, so time is a constraint for me.

    @johny
    so sorry to mention that this release shouldn’t be used in pair with joomla 1.5.x

    Reply
  12. Tim

    @admin,

    Here’s what fixed the division by zero error for me:

    [timblack1@web8 com_cb_search]$ bzr diff -r108..109 cb_search.class.php
    === modified file ‘administrator/components/com_cb_search/cb_search.class.php’
    — administrator/components/com_cb_search/cb_search.class.php 2008-07-05 03:58:46 +0000
    +++ administrator/components/com_cb_search/cb_search.class.php 2009-02-09 19:40:26 +0000
    @@ -759,6 +759,7 @@
    global $mosConfig_sef;
    $ret=””;

    + if ($limit ==”) $limit = 10; // fix by Tim Black 2-9-2009
    $searchword = mosGetParam( $_REQUEST, ‘searchword’, ” );
    $phrase = mosGetParam( $_REQUEST, ‘searchphrase’, ” );
    $task = mosGetParam( $_REQUEST, ‘task’, ” );

    Reply
  13. Tim Black

    Hm…the pagination links look vulnerable to an SQL injection attack. Do you have any fixes for that vulnerability?

    The pagination links also do not work on my site. Perhaps that is because I’m running it on Joomla 1.5, but I sort of doubt that is the reason. Any news on getting the pagination bugs fixed?

    I’ve made some changes to the component to get it working, and to get it working with the gender/age range/photo search module. Tech Admin, please email me if you like a diff or a copy of the code.

    Reply
  14. Carmine

    I’m testing Community Builder Advanced Search 2.0.4 with the latest 1.0.15 joommla version. All seems working fine the only problem is a popup window with the msg “Handler could not be removed”. I’ve seen that someone has had a similar problem, but there is not the solution. Thanks in advance

    Reply
  15. Tech Admin Post author

    @Tim
    thanks for the fix. others may need your fix. if you’re kind enough to share your update here, i will be thankful.

    as for me, i prefer a total refactoring which means rewriting the component from scratch. this component is just too old and a bit obsolete compared to current joomla version. if there is another fellow developer eager to jump in, i can allocate some spare time for the development.

    @carmine.
    i haven’t checked this hack intensively with joomla 1.0.15. i (may or) will revisit this stuff again after i’m done with my other researches and some free time is there.
    thanks for your comment, anyway.

    Reply
  16. Tim Black

    Here is the second patch:

    === modified file ‘administrator/components/com_cb_search/cb_search.config.php’
    — administrator/components/com_cb_search/cb_search.config.php 2009-08-19 22:32:36 +0000
    +++ administrator/components/com_cb_search/cb_search.config.php 2009-08-29 03:18:37 +0000
    @@ -2,7 +2,7 @@
    $cbsa_allow_adv_search = ‘1’;
    $cbsa_allow_search_1 = ‘1’;
    $cbsa_allow_search_2 = ‘1’;
    -$cbsa_birthday_fieldname = ‘cb_birthday’;
    +$cbsa_birthday_fieldname = ‘cb_age’;
    $cbsa_comparision = ‘0’;
    $cbsa_deactivate_allowaccess = ‘0’;
    $cbsa_enable_age_search = ‘1’;
    @@ -19,4 +19,4 @@
    $cbsa_show_sql_error = ‘1’;
    $cbsa_show_title = ‘1’;
    $cbsa_upper_age_limit = ‘100’;
    -?>
    +?>
    \ No newline at end of file

    Reply
  17. Tim Black

    It seems the first patch may not have come through as a comment since it’s so big, so here it is: http://pastebin.com/f3bbf3a51. I had to divide my changes into two patches because I changed file permissions in between, and I think that would have made the diff program display every line of every file as having changed. So together these two patches are my changes that have fixed some problems in the code.

    Reply
  18. SeedCore Group

    Search all your Profile fields

    hxxp://www.seedcoregroup*snipped*/services/joomla-products/joomla-community-builder-search

    *** Now CB Core Search Extention with Module ***

    Community builder Advance search with Module

    Search all your Profile fields
    (You can search as specifically as you like on ANY of your Community Builder fields!)

    100% Money Back guarantee*.

    1. CB Core Search is an advanced Community Builder Profile search for Joomla 1.5.

    2. This component will allow your users to search CB profiles for any field that you have defined as Searchable in CB Field Manager such as Name, User Name, Age, Date of birth, Place, City, Country, Area, Email, Marital status, gender and anything from your Defined fields in CB Field Manager.

    3. This component will allow your user the option to search according to there requirements, and specified criteria result.
    Like, You can select one or more criteria to search, such as all member within a particular Age range in a Certain City, either Male or Female and so on… whatever you want.

    CB Core Search is a must required for any Community Builder Portal!

    *Money back will be allowed if Product does not function as per the demo provided.

    http://www.seedcoregroup*snipped*/services/joomla-products/joomla-community-builder-search

    Reply
  19. Serg

    The plugin search in Community Builder internet-sham.ru/index.php?option=com_content&view=article&id=168:-community-builder&catid=41:serg&Itemid=100

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *