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

    (@atallos)

    You can use the filter “bxcft_show_field_value” and change the way your field value is displayed.

    Thread Starter Randall Camacho

    (@randallcamacho)

    hi,
    thanks for such a speedy reply.

    can you possibly guide me accordingly ?

    where and how do i apply this filter ?

    kind regards,

    RC.

    Plugin Author donmik

    (@atallos)

    Try this:

    add_filter( 'bxcft_show_field_value', 'my_show_field', 15, 4);
    function my_show_field($value_to_return, $type, $id, $value) {
        if ($type == 'birthdate') {
            $value_to_return = strip_tags($value);
            $show_age = false;
            $field = new BP_XProfile_Field($id);
            if ($field) {
                $childs = $field->get_children();
                if (isset($childs) && $childs && count($childs) > 0
                        && is_object($childs[0]) && $childs[0]->name == 'show_age') {
                    $show_age = true;
                }
            }
            if ($show_age) {
                $interval = date_diff(date_create(), date_create($value_to_return));
                $value_to_return = $interval->format('%y Year, %M Months, %d Days, %h Hours, %i Minutes, %s Seconds Old');
            } else {
                $value_to_return = date_i18n(get_option('date_format') ,strtotime($value_to_return) );
            }
        }
        return $value_to_return;
    }
    Thread Starter Randall Camacho

    (@randallcamacho)

    i added the above code at the bottom of “bp-xprofile-custom-fields-type.php” file.

    showed everything right down to the second.
    Thanks a lot !!!

    Plugin Author donmik

    (@atallos)

    Great! But the better place to put this code is at the end of the functions.php of your theme.

    Thread Starter Randall Camacho

    (@randallcamacho)

    great, will do.
    Thanks again your very quick, kind assistance and support.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘display months, days 7 hours for "birthdate selector"’ is closed to new replies.