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

    (@atallos)

    Have you tried to use “bxcft_show_field_value” filter?

    Create a textbox field for your phone number. Try to put the following code inside your functions.php:

    /** Phone field clickable */
    add_filter( 'bxcft_show_field_value', 'my_show_field_value', 10, 4);
    function my_show_field_value($value_to_return, $type, $field_id, $value) {
        if ($field_id == XXX) {
            $value_to_return = sprintf('<a href="tel:%1$s">%1$s</a>', strip_tags($value_to_return));
        }
        return $value_to_return;
    }

    Replace “XXX” with the id of your phone field.

    This should work.

    Thread Starter VentureCore

    (@manakio2k)

    Thank you, I’m going to give this a try. What would you do differently if there are two or three field_id’s? xxx,xxx ?

    Thread Starter VentureCore

    (@manakio2k)

    Thank you so much, this worked perfectly!!

    When you have more than two fields I did this and it worked. If there is a better way, please let me know!!

    /** Phone field clickable */
    add_filter( 'bxcft_show_field_value', 'my_show_field_value', 10, 4);
    function my_show_field_value($value_to_return, $type, $field_id, $value) {
        if ($field_id == 10) {
            $value_to_return = sprintf('<a href="tel:%1$s">%1$s</a>', strip_tags($value_to_return));
        }
        if ($field_id == 18) {
            $value_to_return = sprintf('<a href="tel:%1$s">%1$s</a>', strip_tags($value_to_return));
        }
        return $value_to_return;
    }
    Plugin Author donmik

    (@atallos)

    A better way would be:

    /** Phone field clickable */
    add_filter( 'bxcft_show_field_value', 'my_show_field_value', 10, 4);
    function my_show_field_value($value_to_return, $type, $field_id, $value) {
        if ($field_id == 10 || $field_id == 18) {
            $value_to_return = sprintf('<a href="tel:%1$s">%1$s</a>', strip_tags($value_to_return));
        }
        return $value_to_return;
    }

    || means OR.

    You’re welcome!

    I have tried playing with the above code for days now and cannot omeup with a solution. Wen I use it my output look like this:

    <a href="5555555555">5555555555</a> This code is what appears

    Any ideas?

    Plugin Author donmik

    (@atallos)

    You probably miss the “tel:” before “5555555555”.

    Thread Starter VentureCore

    (@manakio2k)

    Hello donmik,

    I just updated to your latest version from two weeks ago and (ktfmc) is correct, it’s not working now with your last update. I had to downgrade to 2.1.5 since that is the last version you have available from the developers tab.

    Downgrading the plugin allows it to work again ??

    Thread Starter VentureCore

    (@manakio2k)

    Hello donmik,

    I couldn’t tell if this problem has been solved in 2.4.6

    Thanks!!

    No it wasn’t fixed in 2.4.6

    Plugin Author donmik

    (@atallos)

    What error are you talking about?

    Thread Starter VentureCore

    (@manakio2k)

    The /** Phone field clickable */ script as identified in this thread no longer works with your two recent updates.

    In order to keep it working I had to downgrade to version 2.1.5 since that is the last version you have available from the developers tab.

    Any attempts to upgrade the plugin results in
    <a href="tel:xxx-xxx-xxxx">xxx-xxx-xxxx</a>
    showing up as the results instead of a clickable phone number.

    Plugin Author donmik

    (@atallos)

    Since last version, this filter “bxcft_show_field_value” is deprecated. You need to stop using it because I will remove it on version 3.0.

    Use this code instead:

    add_filter('bp_get_the_profile_field_value', 'my_custom_field_value', 12, 3);
    function my_custom_field_value($value, $type, $field_id) {
        if ($field_id == 241) {
            $value = sprintf('<a href="tel:%1$s">%1$s</a>',
                strip_tags($value));
        }
    
        return $value;
    }

    This should work if you have autolink enabled for your field or disabled but I recommend disabling it.

    I’ve updated my plugin to version 2.4.7 because while I was looking for a solution about this, I have seen that my plugin was disabling autolink features for the default buddypress field types. This is solved with the latest update.

    Thread Starter VentureCore

    (@manakio2k)

    I finally updated plugin and used new code and everything is functioning perfectly, thank you Donmik!

    Have an awesome day and thank you for continuing to support this plugin.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Any Plans or Phone Field?’ is closed to new replies.