Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author donmik

    (@atallos)

    It’s because I removed the filter that is adding the links in my plugin. It was causing errors with my plugin. If you want it back you can filter the values returned by my plugin. This is a sample code:

    function my_show_field_value($value_to_return, $type, $id, $value) {
        $field = new BP_XProfile_Field($id);
        if ($type == 'birthdate') {
            // Get children.
            $childs = $field->get_children();
            $show_age = false;
            if (isset($childs) && $childs && count($childs) > 0 && is_object($childs[0])) {
                if ($childs[0]->name == 'show_age')
                    $show_age = true;
            }
            if ($value != '') {
                if ($show_age) {
                    $new_value = floor((time() - strtotime($value))/31556926);
                } else {
                    $new_value = date_i18n(get_option('date_format') ,strtotime($value) );
                }
                $new_value = xprofile_filter_link_profile_data($new_value, $type);
                $value_to_return = '<p>'.$new_value.'</p>';
            }
        }
    
        return $value_to_return;
    }
    add_filter('bxcft_show_field_value', 'my_show_field_value', 10, 4);

    If you add this filter in your functions.php of your theme. The age will be a clickable field too.

    Thread Starter madcap66

    (@madcap66)

    Added your code and Age is now clickable but when clicked it always returns no members found even though there are members of the same age. Any idea why this might be happening? Or was that the reason it was removed?

    Thanks.

    Plugin Author donmik

    (@atallos)

    Ok, it’s because buddypress is looking for the age inside the database, but in database my plugin have recorded the birthdate in mysql format and not the age.

    So, I think there is no easy solution to solve this, if you need to search inside your members I recommend you use BP Profile Search plugin.

    Thread Starter madcap66

    (@madcap66)

    @donmik – I’m already using the BP Profile Search plugin, and the age search works perfectly. Just a bummer that the one profile field of Age isn’t directly searchable…

    Would love to have this feature…Thx

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Age not clickable??’ is closed to new replies.