Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ajax validation unique for each plugin #23

Merged
merged 5 commits into from
Aug 8, 2023

Conversation

MlKilderkin
Copy link
Contributor

What

Address #22
Make ajax validation unique for each plugin

Copy link
Contributor

@jamesckemp jamesckemp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MlKilderkin Did you have to make any changes to Flux/Account Pages when testing this? We don't use the do_settings_field() method as we already have our own settings. We're directly redering the license field, which means the new plugin slug is not set:

/**
 * Output license field.
 */
public static function license_field() {
	$container = Config::get_container();
	$container->get( License_Field::class )->render( false, false );
}

@MlKilderkin
Copy link
Contributor Author

@MlKilderkin Did you have to make any changes to Flux/Account Pages when testing this? We don't use the do_settings_field() method as we already have our own settings. We're directly redering the license field, which means the new plugin slug is not set:

/**
 * Output license field.
 */
public static function license_field() {
	$container = Config::get_container();
	$container->get( License_Field::class )->render( false, false );
}

@jamesckemp even in that case render method with call Field.php class and do_settings_fields. It is a custom method not a WP default

@MlKilderkin
Copy link
Contributor Author

And I haven't touch anything in plugin. Only Uplink library has been updated

@jamesckemp
Copy link
Contributor

jamesckemp commented Aug 7, 2023

@MlKilderkin I get this error:

Uncaught TypeError: Cannot read properties of undefined (reading 'action')
    at obj.validateKey (key-admin.js?ver=1.0.0:42:46)
    at HTMLDivElement.<anonymous> (key-admin.js?ver=1.0.0:12:8)
    at Function.each (load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload,farbtastic&ver=6.2.2:2:3003)
    at e.<computed>.each (load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload,farbtastic&ver=6.2.2:2:1481)
    at obj.init (key-admin.js?ver=1.0.0:4:46)
    at HTMLDocument.<anonymous> (key-admin.js?ver=1.0.0:64:7)
    at e (load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload,farbtastic&ver=6.2.2:2:30158)
    at t (load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload,farbtastic&ver=6.2.2:2:30460)
    ```
    
    Did it work for you when testing with Flux or Account Pages?

@MlKilderkin
Copy link
Contributor Author

@jamesckemp Could you check that you have window variable with required items?
For example:

stellarwp_config_iconic_wap: {action: 'pue-validate-key-uplink-iconic_wap'}
stellarwp_config_sampletest: {action: 'pue-validate-key-uplink-sampletest'}

src/Uplink/Admin/License_Field.php Outdated Show resolved Hide resolved
src/Uplink/Admin/License_Field.php Outdated Show resolved Hide resolved
src/Uplink/Admin/Field.php Outdated Show resolved Hide resolved
Copy link
Contributor

@jamesckemp jamesckemp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working well 🙌

@jamesckemp jamesckemp merged commit 23e6d83 into main Aug 8, 2023
3 checks passed
@jamesckemp jamesckemp deleted the bugifix/22/multiple-check-exists branch August 8, 2023 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants