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

Uncaught ReferenceError: $gp_translations_options is not defined #476

Closed
Stiofan opened this Issue Jun 28, 2016 · 15 comments

Comments

Projects
None yet
3 participants
@Stiofan

Stiofan commented Jun 28, 2016

$gp_translations_options is not being added to the page via wp_localize_script() from translations.php template. I am running multi-site so not sure if that is why its showing or if everyone else is seeing it also.

Basically it needs to be wrapped in a function and called via the wp_enqueue_scripts hook.

I will try submitting a patch if i can get my head around the process.

@toolstack toolstack added the bug label Jun 28, 2016

@toolstack

This comment has been minimized.

Show comment
Hide comment
@toolstack

toolstack Jun 28, 2016

Contributor

It seems to be working alright on my local install (single site).

It shouldn't need to be called via wp_enqueue_script as it's being written before the html headers are complete.

It may be related to how we add the scripts in gp-includes\assets-loader.php as we directly act on the WP_Scripts object though the wp_default_scripts hook.

Contributor

toolstack commented Jun 28, 2016

It seems to be working alright on my local install (single site).

It shouldn't need to be called via wp_enqueue_script as it's being written before the html headers are complete.

It may be related to how we add the scripts in gp-includes\assets-loader.php as we directly act on the WP_Scripts object though the wp_default_scripts hook.

@ocean90

This comment has been minimized.

Show comment
Hide comment
@ocean90

ocean90 Jun 28, 2016

Member

For some reasons I get this only when I'm logged out (single site).

Member

ocean90 commented Jun 28, 2016

For some reasons I get this only when I'm logged out (single site).

@toolstack

This comment has been minimized.

Show comment
Hide comment
@toolstack

toolstack Jun 28, 2016

Contributor

I can replicate @ocean90's behaviour.

Contributor

toolstack commented Jun 28, 2016

I can replicate @ocean90's behaviour.

@Stiofan

This comment has been minimized.

Show comment
Hide comment
@Stiofan

Stiofan Jun 28, 2016

My issue with it while logged in was due to a old version of this plugin being network activated https://wpgeodirectory.com/translate/glotpress/projects/geodirectory/sv/default/

I can see the issue with logged out users too.

Stiofan commented Jun 28, 2016

My issue with it while logged in was due to a old version of this plugin being network activated https://wpgeodirectory.com/translate/glotpress/projects/geodirectory/sv/default/

I can see the issue with logged out users too.

@Stiofan

This comment has been minimized.

Show comment
Hide comment
@Stiofan

Stiofan Jun 28, 2016

Updated pull request, seems to fix for all, feedback welcome.

Stiofan commented Jun 28, 2016

Updated pull request, seems to fix for all, feedback welcome.

@ocean90 ocean90 added this to the 2.1 milestone Jul 1, 2016

@toolstack

This comment has been minimized.

Show comment
Hide comment
@toolstack

toolstack Jul 5, 2016

Contributor

This problem goes deeper than just wrapped in a function, it's caused by GP adding the translations page js file on every page instead of just the translation page. There are a few other js files loaded on pages where they aren't required as well.

Contributor

toolstack commented Jul 5, 2016

This problem goes deeper than just wrapped in a function, it's caused by GP adding the translations page js file on every page instead of just the translation page. There are a few other js files loaded on pages where they aren't required as well.

@toolstack

This comment has been minimized.

Show comment
Hide comment
@toolstack

toolstack Jul 6, 2016

Contributor

@NomadDevs can you try this code and make sure it resolves the issue you are seeing?

Contributor

toolstack commented Jul 6, 2016

@NomadDevs can you try this code and make sure it resolves the issue you are seeing?

@toolstack toolstack modified the milestones: 2.2, 2.1 Jul 6, 2016

@Stiofan

This comment has been minimized.

Show comment
Hide comment
@Stiofan

Stiofan Jul 8, 2016

@toolstack That code did not work for me, it does not display any JS errors but it breaks all the JS functionality of opening translations etc, it removed the localize script for me.

Stiofan commented Jul 8, 2016

@toolstack That code did not work for me, it does not display any JS errors but it breaks all the JS functionality of opening translations etc, it removed the localize script for me.

@toolstack

This comment has been minimized.

Show comment
Hide comment
@toolstack

toolstack Jul 8, 2016

Contributor

@NomadDevs Give it a try now.

Contributor

toolstack commented Jul 8, 2016

@NomadDevs Give it a try now.

@Stiofan

This comment has been minimized.

Show comment
Hide comment
@Stiofan

Stiofan Jul 8, 2016

@toolstack With what version of GP?

Stiofan commented Jul 8, 2016

@toolstack With what version of GP?

@toolstack

This comment has been minimized.

Show comment
Hide comment
@toolstack

toolstack Jul 8, 2016

Contributor

I updated the PR, so just grab the code from the same spot.

Contributor

toolstack commented Jul 8, 2016

I updated the PR, so just grab the code from the same spot.

@toolstack

This comment has been minimized.

Show comment
Hide comment
@toolstack

toolstack Jul 9, 2016

Contributor

@NomadDevs try this code instead and see if it works for you.

Note: If your using my "GP Single Click Edit" plugin you'll need to disable it to test with.

Contributor

toolstack commented Jul 9, 2016

@NomadDevs try this code instead and see if it works for you.

Note: If your using my "GP Single Click Edit" plugin you'll need to disable it to test with.

@Stiofan

This comment has been minimized.

Show comment
Hide comment
@Stiofan

Stiofan Jul 13, 2016

@toolstack Yes your latest code seems to resolve all issues.

Stiofan commented Jul 13, 2016

@toolstack Yes your latest code seems to resolve all issues.

@toolstack

This comment has been minimized.

Show comment
Hide comment
@toolstack

toolstack Jul 13, 2016

Contributor

Good to hear.

Contributor

toolstack commented Jul 13, 2016

Good to hear.

@toolstack

This comment has been minimized.

Show comment
Hide comment
@toolstack

toolstack Sep 8, 2016

Contributor

Resolved with PR #500.

Contributor

toolstack commented Sep 8, 2016

Resolved with PR #500.

@toolstack toolstack closed this Sep 8, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment