Git Product home page Git Product logo

acf-phone-number's People

Contributors

androlax2 avatar dathix avatar davidwebca avatar dependabot[bot] avatar emanueljacob avatar huubl avatar joostdekeijzer avatar joshuafredrickson avatar log1x avatar thedavidthomas avatar thuijssoon avatar timoteh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

acf-phone-number's Issues

Critical error after installing repo

After downloading and installing the plugin I get following message:

There has been a critical error on this website. Please check your site admin email inbox for instructions.

Learn more about troubleshooting WordPress.

In case a simple zip download and upload of this repository is not the correct installation, then please update readme file.

ACF Shortcode Compatibility for Formats in Array

The basic use of the ACF shortcode works to display the number, but only seems to display the e164 format.

An example of Phone Number field called "phoneNum" with a United States number of 555-123-4567:

[acf field="phoneNum"]

Displays as

+15551234567

With some objects in ACF — e.g., repeater fields — we can use underscores drill down a bit into the field. Example:

[acf field="{$repeater_name}_{$row}_{$sub_field_name}"]

Support for uses such as the following would be great for the potential of this field:

[acf field="phoneNum_national"]

[acf field="phoneNum_uri"]

[acf field="phoneNum_location"]

And so on. Presumably, each value in the array would be a type of "sub field" that can then be called using a similar shortcode.

Conflict with Webpack chunk name?

Hi,

I currently have a conflict with your library very specifically. When I compile my code, there's a webpack chunk with the same name? I wonder if you've already had that issue and if you know how it could be fixed. I'm using Sage, have the same laravel-mix setup as your plugin and I'm wondering if there's anything there that could clash... but that would be surprising and weird. Maybe the jQuery extract?

Because of the way Webpack loads things, it's hard to show anything relevant, but basically my app.js from Sage ends up calling a function in your file for some weird reason.

My code

 function(e) {
    "use strict";
    var t = function(t) {
        return e(e.s = t)
    };
    e.O(0, [126, 692, 941], (function() { // <--- e.O is not a function
        return t(671),
        t(312),
        t(461)
    }
    ));
    e.O()
}

Stack traces to yours

, e = [[847], [871]]
          , n = t=>{}
          , a = (a,o)=>{
            for (var s, r, [l,u,d,h] = o, c = 0, p = []; c < l.length; c++)
                r = l[c],
                i.o(t, r) && t[r] && p.push(t[r][0]),
                t[r] = 0;
            for (s in u)
                i.o(u, s) && (i.m[s] = u[s]);
            for (d && d(i), // <-- on this line
            a && a(o); p.length; )
                p.shift()();
            return h && e.push.apply(e, h),
            n()
        }

Sorry to bother you with this. It's just preventing me to use the plugin altogether and I'd love to find out why this is happening.

JavaScript error in ACF 6

With this plugin enabled with ACF v6, I get the following console error, and much functionality is broken on the "Edit Group" screens.

Uncaught TypeError: can't access property "getAttribute", t is undefined
    i http://www.menopauseinfo.localhost/wp-content/plugins/acf-phone-number/public/js/field.js:1
    e http://www.menopauseinfo.localhost/wp-content/plugins/acf-phone-number/public/js/field.js:1
    847 http://www.menopauseinfo.localhost/wp-content/plugins/acf-phone-number/public/js/field.js:1
    jQuery 2
    847 http://www.menopauseinfo.localhost/wp-content/plugins/acf-phone-number/public/js/field.js:1
    s http://www.menopauseinfo.localhost/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf-input.min.js:1
    o http://www.menopauseinfo.localhost/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js:1
    doAction http://www.menopauseinfo.localhost/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js:1
    doAction http://www.menopauseinfo.localhost/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js:1
    7806 http://www.menopauseinfo.localhost/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js:1
    jQuery 13

I'm trying to track down the issue, will report back if I find a solution.

Add support for extensions

I've got a client that needs to list their extension with their phone numbers; it'd be awesome if this plugin could account for that, but for now I'll just use a workaround by adding a separate "extension" text field.

Export

Hello,
While exporting posts to another website, with same group fiels, and acf-phone-number plugin, the phone field doesn't works and got a value anymore.
Did you think of something in the way the plugin works which could explain that ? And a workaround ?
best regards

Class not found error

I get this error on activation in a clean installation with only ACF and ac-phone-number (ziped donwload) plugins installed:

WP 5.8.1, PHP 7.4.1, Apache 2.4.43, MySQL 8.0.16

PHP Fatal error: Uncaught Error: Class 'Log1x\AcfPhoneNumber\PhoneNumberField' not found in /Users/user/Local/wp/app/public/wp-content/plugins/acf-phone-number-master/plugin.php:50
Stack trace:
#0 /Users/user/Local/wp/app/public/wp-includes/class-wp-hook.php(303): class@anonymous->Log1x\AcfPhoneNumber{closure}(5)
#1 /Users/user/Local/wp/app/public/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters(NULL, Array)
#2 /Users/user/Local/wp/app/public/wp-includes/plugin.php(470): WP_Hook->do_action(Array)
#3 /Users/user/Local/wp/app/public/wp-content/plugins/advanced-custom-fields-pro/acf.php(273): do_action('acf/include_fie...', 5)
#4 /Users/user/Local/wp/app/public/wp-includes/class-wp-hook.php(303): ACF->init('')
#5 /Users/user/Local/wp/app/public/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters(NULL, Array)
#6 /Users/user/Local/wp/app/public/wp-includes/plugin.php(470): WP_Hook->do_action(Array)
#7 /Users/user/Local/wp/app/public/wp-settings.php(578): do_action('init')
#8 /Users/user/Local/wp/app/public/wp-content/plugins/acf-phone-number-master/plugin.php on line 50

[bug] TypeError when editing fields in ACF 6.0.2

It looks like there's a conflict with ACF 6.0. With the plugin activated, I get the following error when editing fields, which results in general bugginess.

TypeError: Cannot read properties of undefined (reading 'getAttribute')
    at new i (https://example.test/wp-content/plugins/acf-phone-number/public/js/field.js:1:10819)
    at https://example.test/wp-content/plugins/acf-phone-number/public/js/field.js:1:34487
    at HTMLDivElement.<anonymous> (https://example.test/wp-content/plugins/acf-phone-number/public/js/field.js:1:285)
    at Function.each (https://example.test/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,regenerator-runtime,wp-polyfill,wp-hooks&ver=6.0.2:2:3003)
    at s.fn.init.each (https://example.test/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,regenerator-runtime,wp-polyfill,wp-hooks&ver=6.0.2:2:1481)
    at https://example.test/wp-content/plugins/acf-phone-number/public/js/field.js:1:184
    at https://example.test/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf-input.min.js?ver=6.0.2:1:2262
    at o (https://example.test/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js?ver=6.0.2:1:1417)
    at Object.doAction (https://example.test/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js?ver=6.0.2:1:587)
    at n.doAction (https://example.test/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js?ver=6.0.2:1:18166) 

This appears to be isolated to the edit screen... Things seem to work fine when actually filling the field.

WP 6.0.2
ACF 6.0.2
ACF Phone Number 1.1.9

Plugin no longer working

Hello,

I am currently working on a Wordpress 5.7 site with PHP 8.0. The plugin returns a 500 error when activated. The same on PHP 7.4. Everything is ok when deactivated.
Capture d’écran 2021-04-13 à 14 28 03

Thank you for maintaining this very useful plugin !

Multiple phone numbers on one page results in only the last number being output

With multiple phone numbers set, it seems that only the last phone number can be output. In the example below, assuming "+13128675309" is set to $phone_number and "+13128675310" is set to $fax_number, both echos will output "+13128675310".

$phone_number = get_field("phone_number", "theme");
$fax_number   = get_field("fax_number", "theme");

echo $phone_number->national;
echo $fax_number->national;

This has only been tested when installed without composer, per #8.

Am I doing this incorrectly, or is this a bug?

Missing metadata

Hello,

There is a problem with the new version of : https://github.com/giggsey/libphonenumber-for-php

Related to this one : giggsey/libphonenumber-for-php#538

We need to change language code in uppercase, otherwise it will throw an exception.

I think you can enforce it in this package to ensure it doesn't throw any exception.

In the README, ->setConfig('default_country', 'us') should be ->setConfig('default_country', 'US')

Maybe I'm wrong, but I have some problems on my website due to that (and Wordpress have in the database us for example, so it will throw an exception.

Fatal error: Uncaught Error: Class "Log1x\AcfPhoneNumber\PhoneNumberField"

Hello,

I get this error when I try to activate the plugin.
Fatal error: Uncaught Error: Class "Log1x\AcfPhoneNumber\PhoneNumberField" not found in /home/xx/www/pfdev/wordpress/wp-content/plugins/acf-phone-number/plugin.php:52 Stack trace: #0 /home/xx/www/pfdev/wordpress/wp-content/plugins/acf-phone-number/plugin.php(38): class@anonymous->register() #1 /home/xx/www/pfdev/wordpress/wp-includes/class-wp-hook.php(310): class@anonymous->__invoke('') #2 /home/xx/www/pfdev/wordpress/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(NULL, Array) #3 /home/xx/www/pfdev/wordpress/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #4 /home/xx/www/pfdev/wordpress/wp-settings.php(610): do_action('after_setup_the...') #5 /home/xx/www/pfdev/wordpress/wp-config.php(102): require_once('/home/xx...') #6 /home/xx/www/pfdev/wordpress/wp-load.php(50): require_once('/home/xx...') #7 /home/xx/www/pfdev/wordpress/wp-blog-header.php(13): require_once('/home/xx...') #8 /home/xx/www/pfdev/wordpress/index.php(17): require('/home/xx...') #9 {main} thrown in /home/xx/www/pfdev/wordpress/wp-content/plugins/acf-phone-number/plugin.php on line 52

Are you aware of it ? How can I get my website back ?

Thanks

Manual install with Sage 9 error

I'm trying to install this manually, but get this error:

Fatal error: Uncaught Error: Class 'Log1x\AcfPhoneNumber\PhoneNumberField' not found in /Volumes/Evo/Local/gateway/app/public/wp-content/plugins/acf-phone-number/plugin.php on line 50

Always returns the last instance

When retrieving multiple phone fields as part of a loop and referencing them later, the last instance will always be used.

For example:

$locations = [
    ['ID' => 1], // 'phone' is set to 205-555-1212
    ['ID' => 2], // 'phone' is set to 205-555-2424
];

foreach ($locations as $location) {
    $phone = get_field('phone', $location['ID']);
    var_dump($phone->national); // outputs the correct value
    $phones[] = $phone; // store for later
}

var_dump($phones[0]->national, $phones[1]->national); // outputs '(205) 555-2424' twice

Just noticed this in 1.0.7. Can confirm this issue doesn't occur in 1.0.5.

Exception and inconsistent return values when calling methods on PhoneNumber instances with no number property value

when calling methods like $field->international() while $field is an instance of PhoneNumber (but the number property is empty) an exception will be thrown whenever the value has not been set yet.

This behavior is kind of inconsistent and unexpected (see examples below).
Almost every method like international will not check for a valid (not simply empty) number property but the toArray method does that.

consider following use cases:
CASe A) $field is not set:

  • $field is instance of PhoneNumber
  • $field->international() - will throw an exception // because there is no check for an empty number
  • $field->toArray() - will return an empty array // because there is check of an empty value (in isValid())

example (value not set, exception when calling $field->international():

Argument 1 passed to libphonenumber\PhoneNumberUtil::format() must be an instance of libphonenumber\PhoneNumber, null given, called in /app/web/web/app/mu-plugins/acf-phone-number/src/PhoneNumber.php on line 130 (View:

CASE B) $field has been set with an:

  • $field is instance of PhoneNumber
  • $field->international() - will return the number // this time the number is set (but not valid), so we can access it
  • $field->toArray() - will return an empty array // because there is not just the check of an empty value __ but also a check for valid number in isValid())

example (first with toArray(), second with international())
screenshot

So i would suggest to check the number in all corresponding phone number methods (i.e. international) or similar or at least add a method to check whether the property is empty or not.

What do you think?

REST API - is not accepting phone number

 #REST API - is not accepting phone number

Issue Description

  1. We tried passing e.164 formatted number.
{
"acf": {
"user_mobile": "+910000000000"
}
}
  1. Also tried the formatted array.
{
"acf": {
"user_mobile": {
"carrier": "XYZ",
"country": "India",
"e164": "+91000000000",
"international": "+91 00000 00000",
"location": "India",
"national": "000000 00000",
"number": "000000 00000",
"rfc3966": "tel:+91-00000-00000",
"timezone": [
"Asia/Calcutta"
],
"uri": "tel:+910000000000"
}
}
}
  1. Event tried db entry format:
{
"acf": {
"user_mobile": {
"number": "+91 00 0000 0000",
"country": "in"
}
}
}

===
ERROR for 1:::
It simply overrides to an empty value.

{
acf": {
"user_mobile": []
}
}


ERROR for 2 & 3:::

{
"code": "rest_invalid_param",
"message": "Invalid parameter(s): acf",
"data": {
"status": 400,
"params": {
"acf": "acf[user_mobile] is not of type string,null."
},
"details": {
"acf": {
"code": "rest_invalid_type",
"message": "acf[user_mobile] is not of type string,null.",
"data": {
"param": "acf[user_mobile]"
}
}
}
}
}


**THIS IS A REST API ISSUE.**
---
When we pass the REST API value as such...

curl --location 'https://wp.host/wp-json/wp/v2/users/4'
--header 'Content-Type: application/json'
--header 'Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=='
--data '{
"acf": {
"user_mobile": {"number":"+91 00 0000 0000","country":"in"}
}
}'


That is the URL from Postman where is --data is the 3) version of the input. But inputs are giving issues. 

https://capture.dropbox.com/eDrI1M3KE8BYCOXv


All other ACF fields are saving and working without error.
Only when the field type is "ACF Phone Number" those are the ones that are giving and error or saving empty.



Data does not register/save after being submitted.

Data does not register after being submitted.
So when a user inputs a phone number it does not save into my database.

Furthermore, once exported this field has the error code "O:32:"Log1x\AcfPhoneNumber\PhoneNumber":2:{s:11:""

Uncaught Error: Class "Log1x\AcfPhoneNumber\PhoneNumberField" not found

Receiving the following error message upon installation:

An error of type E_ERROR was caused in line 52 of the file /home/apppath/public_html/wp-content/plugins/acf-phone-number-master/plugin.php](https://github.com/Log1x/acf-phone-number/issues/apppath/public_html/wp-content/plugins/acf-phone-number-master/plugin.php).

Error message: Uncaught Error: Class "Log1x\AcfPhoneNumber\PhoneNumberField" not found in /home/apppath/public_html/wp-content/plugins/acf-phone-number-master/plugin.php:52

Fatal Error upon activation

[01-Nov-2022 15:11:37 UTC] PHP Fatal error: Uncaught Error: Class "Log1x\AcfPhoneNumber\PhoneNumberField" not found in .../app/public/wp-content/plugins/acf-phone-number-master/plugin.php:50
Stack trace:
#0 .../app/public/wp-includes/class-wp-hook.php(307): class@anonymous->Log1x\AcfPhoneNumber{closure}(5)
#1 .../app/public/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
#2 .../app/public/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
#3 .../app/public/wp-content/plugins/advanced-custom-fields-pro/acf.php(297): do_action('acf/include_fie...', 5)
#4 .../app/public/wp-includes/class-wp-hook.php(307): ACF->init('')
#5 .../app/public/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
#6 .../app/public/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
#7 .../app/public/wp-settings.php(598): do_action('init')
#8 .../app/public/wp-config.php(92): require_once('/Users/davidbra...')
#9 .../app/public/wp-load.php(50): require_once('/Users/davidbra...')
#10 .../app/public/wp-admin/admin-ajax.php(22): require_once('/Users/davidbra...')
#11 {main}
thrown in .../app/public/wp-content/plugins/acf-phone-number-master/plugin.php on line 50

Installed manually

Can't get correct phone field data when using with repeater fields

Hi,

The phone object doesn't seem to work when using the ACF Phone Field within repeater fields. I looked at issue: https://github.com/Log1x/acf-phone-number/issues/3, but can't get it working. It shows the first number of the repeater field on all the rows. This is what I tried:

if( have_rows('locations', $post->ID) ):
    while( have_rows('locations', $post->ID) ) : the_row();
        if( have_rows('casemanagers', $post->ID) ):
            while( have_rows('casemanagers', $post->ID) ) : $row = the_row(); // the_row(true)
                $phone = get_sub_field('phone'); // get_sub_field('phone', $row); // get_sub_field('phone', $post->ID);
                var_dump( $phone->toArray());
                var_dump( $phone->national);
            endwhile;
        endif;
    endwhile;
endif;

I hope you can help my solve this :)

Error: acf.data.fieldTypes is undefined

With this plugin enabled, I'm getting a bunch of these errors logged. It's preventing me from placing this field in a specific order within the group. I also can't edit this field or any other fields when this plugin is enabled.

Uncaught TypeError: acf.data.fieldTypes is undefined
    addProFields https://gateway.local/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf-field-group.min.js?ver=5.9.9:1
    initialize https://gateway.local/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf-field-group.min.js?ver=5.9.9:1
    t https://gateway.local/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js?ver=5.9.9:1
    Model https://gateway.local/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js?ver=5.9.9:1
    n https://gateway.local/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js?ver=5.9.9:1
    newFieldObject https://gateway.local/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf-field-group.min.js?ver=5.9.9:1
    getFieldObject https://gateway.local/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf-field-group.min.js?ver=5.9.9:1
    getFieldObjects https://gateway.local/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf-field-group.min.js?ver=5.9.9:1
    jQuery 2
    getFieldObjects https://gateway.local/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf-field-group.min.js?ver=5.9.9:1
    addFieldActions https://gateway.local/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf-field-group.min.js?ver=5.9.9:1
    i https://gateway.local/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js?ver=5.9.9:1
    doAction https://gateway.local/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js?ver=5.9.9:1
    doAction https://gateway.local/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js?ver=5.9.9:1
    <anonymous> https://gateway.local/wp-content/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js?ver=5.9.9:1
    jQuery 2

Location, settings and field group meta boxes hidden

Hi there,

Great plugin!

When I add a phone number field and update the field group the location, settings and field group meta boxes are gone... The is most likely due to a javascript error as other javascript features are not working either. I have checked the console but nothing suspicious is showing.

I am using:
WP version 5.7.2
ACF Pro version 5.9.6
acf-phone-number version 1.1.4 (manual install)

I hope this is enough info to help resolve this issue. Please let me know if you require additional information.

Phone number field within repeater always returns the same PhoneNumber object

Hi,

first: thanks for this and all the other great packages!

I have a problem with this one. When creating more than one tel field (i.e. 'tel', 'mobile') within a repeater field, it looks like everything works fine, meaning:

  • wp admin fields are saving correctly
  • wp admin fields are visually correct
  • database post_content data (acf block) seems fine (i.e.
       "rows_0_person_tel": {
            "number": "+49 1212312",
            "country": "de"
        },
        "_rows_0_person_tel": "field_introduction_rows_person_tel",
        "rows_0_person_mobile": {
            "number": "+49 12121",
            "country": "de"
        },
        "_rows_0_person_mobile": "field_introduction_rows_person_mobile",
        "rows_0_person_fax": {
            "number": "+49 121231231",
            "country": "de"
        },

...


-->see following example, for more information)

  • however, when getting the fields values in the frontend, it always gets the same PhoneNumber object, meaning that the phone number is always the first I got...

My setup:

  • roots/bedrock
  • roots/sage (version 10)
  • samrap/acf-fluent
  • log1x/acf-composer
  • log1x/acf-phone-number (as mu-plugin)
  • acf-pro (4.9.4)

Full example

I created a custom block (actually a lot of blocks), using acf-composer, this one (simplified) in the following example:

Block class (relevant part only)

class Introduction extends Block {
//...
    public function with(){
        return ['rows' => $this->rows(),];
    }
//...
	public function fields() {
		$block = new FieldsBuilder('introduction');

	    $block
	        ->addAccordion($this->slug . 'accordion', ['label' => $this->name,])
	            ->addMessage($this->name, $this->description, ['label' => ''])
	            ->addTab('content', ['label' => __('Content', 'sage')])
	                //...
	                ->addRepeater('rows', ['label' => __('Rows', 'sage'), 'button_label' => __('Add row')])
	                   //... 
	                    ->addGroup('person', ['label' => __('Person', 'sage'), 'wrapper' => ['width' => self::$width['3-4']]]
	                        ->addField('tel', 'phone_number', ['default_country' =>'de', 'label' => __('Tel', 'sage')])
	                        ->addField('mobile', 'phone_number', ['default_country' =>'de', 'label' => __('Mobil', 'sage')])
						//...
						->endGroup()
					->endRepeater();
		//...
		return $block->build();
	}
// ...

    public function rows(){
        // also tested: get_field('rows);
        return field('rows')->expect('array')->default([])->get(); // acf-fluent
    }

I loop over the rows array in my block view afterwards. Something like this:

introduction.blade.php

@php
    // for illustration only. Simple closure to get the international value of the phonenumber (is there an easier way?)
    $telNum = function($field) {
        return $field instanceof \Log1x\AcfPhoneNumber\PhoneNumber ? $field->international() : '';
     };
@endphp
@if($rows)
        <div>
              @foreach($rows as $row)
                  @if($person = $row['person'])
                      <div>{!! $telNum($person['tel'] ?? null) !!}</div>
                      <div>{!! $telNum($person['mobile'] ?? null) !!}</div>
                  @endif
               @endforeach
        </div>
@endif

expected result (fictive numbers):
+491 12345
+491 65646

actual result:
+491 12345
+491 12345

when dumping $rows i see that for each $row item in $rows, the object stored in $row['person_tel] equals the object stored in $row['person_mobile].

Additional notes

As I have already written in a short comment, I also tested the acf default function get_field but this didn't seem to change anything.

Any idea about the how and why? Actually im not quite sure, whether I am doing it wrong, acf pro gets the values wrong or its the responsibility of your plugin.

ACF "required" validation is not working

When marking a field based on acf-phone as required, its not actually catch if no value entered and the form is passing successfully (although no value saved in the user meta table).
I am suspecting that its due to the fact that the default country code is always filled.

Install without Composer

I'm not used to installing WordPress plugins via Composer, so I'm sure this is obvious, but how do I get the field type to show up when building out an ACF form via the back-end? The plugin is activated, but I don't see anything like "Phone Number" when selecting a field type. I see in your README a section titled "ACF Composer" that shows how to add an individual field programmatically (in a way that I'm also unfamiliar with, it doesn't look like ACF's normal way of registering fields), but that doesn't seem to have anything to do with getting the field type to show up in the selector.

Class not found - need any help?

Hi there,

I think this is a plugin everybody wants and needs (maybe Elliot Condon just wants to integrate it, also it seems to be part of ACF Extended), but unfortunately the current version has some errors:

On activating the plugin, it dies with:
Error: Class 'Log1x\AcfPhoneNumber\PhoneNumberField' not found in /var/[...]/wp-content/plugins/acf-phone-number-master/plugin.php:53

I am on WordPress 6.0.3 (Multisite), ACF Pro 6.0.3.

If I can be of any need help, drop me a line.

Cheers,
Marten

Couple of deprecations

Query Monitor is reporting the following:

Level Message Count Location Component
Deprecated Creation of dynamic property Log1x\AcfPhoneNumber\PhoneNumberField::$uri is deprecated 1 wp-content/plugins/acf-phone-number/src/PhoneNumberField.php:46 Plugin: acf-phone-number
Deprecated Creation of dynamic property Log1x\AcfPhoneNumber\PhoneNumberField::$path is deprecated 1 wp-content/plugins/acf-phone-number/src/PhoneNumberField.php:47 Plugin: acf-phone-number

Preset placeholder text

Hi, thanks for this great plugin. It would be awesome to be able to preset the placeholder text since I'm also using landline telephone numbers apart from mobile phone numbers. Thanks in advance!

There has been a critical error in the plugin when installing

The message show in the website when installing the plugin "There has been a critical error on this website."

Screenshot_4

Here is the debug log. For security purpose I change my domain name

[23-Dec-2023 17:47:20 UTC] PHP Fatal error: Uncaught Error: Class "Log1x\AcfPhoneNumber\PhoneNumberField" not found in /home/u496007041/domains/domain.com/public_html/cb/wp-content/plugins/acf-phone-number-master/plugin.php:52 Stack trace: #0 /home/u496007041/domains/domain.com/public_html/cb/wp-content/plugins/acf-phone-number-master/plugin.php(38): class@anonymous->register() #1 /home/u496007041/domains/domain.com/public_html/cb/wp-includes/class-wp-hook.php(324): class@anonymous->__invoke() #2 /home/u496007041/domains/domaincom/public_html/cb/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #3 /home/u496007041/domains/domain.com/public_html/cb/wp-includes/plugin.php(517): WP_Hook->do_action() #4 /home/u496007041/domains/domain.com/public_html/cb/wp-settings.php(621): do_action() #5 /home/u496007041/domains/domain.com/public_html/cb/wp-config.php(105): require_once('/home/u49600704...') #6 /home/u496007041/domains/domain.com/public_html/cb/wp-load.php(50): require_once('/home/u49600704...') #7 /home/u496007041/domains/domain.com/public_html/cb/wp-blog-header.php(13): require_once('/home/u49600704...') #8 /home/u496007041/domains/domain.com/public_html/cb/index.php(17): require('/home/u49600704...') #9 {main} thrown in /home/u496007041/domains/domain.com/public_html/cb/wp-content/plugins/acf-phone-number-master/plugin.php on line 52 [23-Dec-2023 17:47:24 UTC] PHP Fatal error: Uncaught Error: Class "Log1x\AcfPhoneNumber\PhoneNumberField" not found in /home/u496007041/domains/domain.com/public_html/cb/wp-content/plugins/acf-phone-number-master/plugin.php:52 Stack trace: #0 /home/u496007041/domains/domain.com/public_html/cb/wp-content/plugins/acf-phone-number-master/plugin.php(38): class@anonymous->register() #1 /home/u496007041/domains/domain.com/public_html/cb/wp-includes/class-wp-hook.php(324): class@anonymous->__invoke() #2 /home/u496007041/domains/domain.com/public_html/cb/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #3 /home/u496007041/domains/domain.com/public_html/cb/wp-includes/plugin.php(517): WP_Hook->do_action() #4 /home/u496007041/domains/domain.com/public_html/cb/wp-settings.php(621): do_action() #5 /home/u496007041/domains/domain.com/public_html/cb/wp-config.php(105): require_once('/home/u49600704...') #6 /home/u496007041/domains/domain.com/public_html/cb/wp-load.php(50): require_once('/home/u49600704...') #7 /home/u496007041/domains/domain.com/public_html/cb/wp-blog-header.php(13): require_once('/home/u49600704...') #8 /home/u496007041/domains/domain.com/public_html/cb/index.php(17): require('/home/u49600704...') #9 {main} thrown in /home/u496007041/domains/domain.com/public_html/cb/wp-content/plugins/acf-phone-number-master/plugin.php on line 52

feat request: add field setting return_format as array

i like the fact that you always get an object/class. however there have been instances where i "just" want the field to to be the array per default.

so adding the setting

    'return_format' => 'array',

would solve this.
The default return_format should still be the object.

Error on install

Parse error: syntax error, unexpected 'class' (T_CLASS) in /home4/cresceu1/public_html/staging/wp-content/plugins/acf-phone-number-master/plugin.php on line 14

Field is missing from REST API

Hey Brandon, first of all, huge thanks for all your fantastic work!

Recently I discovered that the field is missing from the REST API.

I fixed it by using acf_register_field_type instead of the two filters.
Maybe I am missing something but everything seems to work fine.

All the best,
Daniel

Does not work with Elementor

Using Elementor, trying to put a dynamic field (text, heading), and selecting ACF Field, the "phone number" field is not an option.

Phone Number cannot be left empty

Hi, we're using your plugin to structure and display information about company locations. The phone number field is not required to be filled in, but when I try to save the page without filling in a phone number, I get an error saying "The phone number cannot be empty.".

I believe the issue stems from here: https://github.com/Log1x/acf-phone-number/blob/master/src/PhoneNumberField.php#L156

Is there any way you can check for the ACF option for setting a field as required?
Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.