• Resolved baddon250

    (@baddon250)


    I’ve been a customer with you guys for about 7 years now and use several UM plugins, and you recently made an update which has broken functionality on my website related to frontend adjustment of forms. You helped me previously with this issue as you had a filter to allow us developers to do custom things with the phone number and other frontend form outputs. I would like to request that you fix this because as a developer that is paying for your software, I now have no way to setup conversion metrics with the phone number. One of your developers must have made a mistake on this because you have a developer how-to page specifically related to this.

    Previous Topic: https://wordpress.org/support/topic/urgent-glitch/

    Related UM Article: https://docs.ultimatemember.com/article/93-control-the-output-of-a-textfield-using-um-filter-hooks

    TO EMPHASIZE: Any company that is willing to pay for Ultimate Member is going to , or eventually going to require tracking conversion metrics as well as custom alterations to the frontend, and it is no longer possible due to your adding of esc_html to the filter option. If this is your intention, us developers need the option to be able to disable the esc_html.

    Here is my current script.

    function custom_profile_field_filter_hook__mobile_number($value, $data) {
    $raw = deformat_phone($value);
    $value = format_phone($value);

    $user_id = um_profile_id();
    $output = '<a href="tel:' . $raw . '" onclick="handle_email_call_notification(' . $user_id . ',\'call\');">' . $value . '</a>';
    return $output;
    }

    remove_filter( 'um_profile_field_filter_hook__mobile_number', 'um_profile_field_filter_hook__phone', 99, 2 );
    add_filter('um_profile_field_filter_hook__mobile_number', 'custom_profile_field_filter_hook__mobile_number', 99, 2);
    add_filter('um_profile_field_filter_hook__phone_number', 'custom_profile_field_filter_hook__mobile_number', 99, 2);

    Here is your filter that you changed that has affected my work. Specifically the esc_html tag.

    Location: ultimatemember/includes/core/um-filters-fields.php

      function um_profile_field_filter_hook__phone( $value, $data ) {
      $value = '<a href="' . esc_url( 'tel:' . $value ) . '" rel="nofollow" title="' . esc_attr( $data['title'] ) . '">' . esc_html( $value ) . '</a>';
      return $value;
      }
      add_filter( 'um_profile_field_filter_hook__tel', 'um_profile_field_filter_hook__phone', 99, 2 );

      Here is my intended output of html followed by the current html output, please let me know how we can get this functioning in proper order.

      <div class="um-field-value" id="mobile_number-488">
      <a href="tel:1234567890" onclick="handle_email_call_notification(40,'call');" rel="nofollow" title="Mobile Phone">(123) 456-7890</a>
      </div>

      Current HTML Output (Incorrect)

      <div class="um-field-value" id="mobile_number-488"><a href="tel:a%20href=tel:9515887991%20onclick=handle_email_call_notification(40,'call');(951)%20588-7991/a" rel="nofollow" title="Mobile Phone">&lt;a href="tel:9515887991" onclick="handle_email_call_notification(40,'call');"&gt;(951) 588-7991&lt;/a&gt;</a></div>
    Viewing 2 replies - 1 through 2 (of 2 total)
    • Plugin Support Yurii

      (@yuriinalivaiko)

      Hello @baddon250

      The um_profile_field_filter_hook__{$type} hook fires after the um_profile_field_filter_hook__{$key}. That’s why your code is modified by the default function um_profile_field_filter_hook__phone.

      You should change your code to use the um_profile_field_filter_hook__{$type} hook or disable default function attached to this hook.

      Solution 1 – Change your code:

      function custom_profile_field_filter_hook__tel( $value, $data ) {

      $key = $data['metakey'];
      $keys = array(
      'mobile_number',
      'phone_number',
      );

      if ( in_array( $key, $keys, true ) ) {
      $user_id = um_profile_id();
      $value = um_user( $key );
      $raw = deformat_phone( $value );
      $value = format_phone( $value );

      $output = '<a href="tel:' . esc_attr( $raw ) . '" onclick="handle_email_call_notification(' . intval( $user_id ) . ',\'call\');">' . esc_html( $value ) . '</a>';
      }
      return $output;
      }
      add_filter( 'um_profile_field_filter_hook__tel', 'custom_profile_field_filter_hook__tel', 100, 2 );

      Solution 2 – Disable default function:

      remove_filter( 'um_profile_field_filter_hook__tel', 'um_profile_field_filter_hook__phone', 99, 2 );

      Note: You should always use escaping functions in output.

      Regards

      Plugin Support andrewshu

      (@andrewshu)

      Hi @baddon250

      This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

      Please feel free to re-open this thread if any other questions come up and we’d be happy to help. 🙂

      Regards

    Viewing 2 replies - 1 through 2 (of 2 total)

    The topic ‘Filter Glitch URGENT’ is closed to new replies.