Notifications
Clear all

wpForo 1.x.x [Closed] Ajax broken after upgrade - wpforo is not defined

15 Posts
5 Users
0 Reactions
1,602 Views
Posts: 8
Topic starter
(@symergo)
Active Member
Joined: 5 years ago

After upgrading to the latest version, ajax functionality is no longer working.

The error seems to come from an error with this:

var wpforo = {"ajax_url":"https:\/\/removed.be\/wp-admin\/admin-ajax.php","template_slugs":{"paged":"paged","recent":"recent","tags":"tags","members":"members","profile":"profile","account":"account","activity":"activity","subscriptions":"subscriptions","postid":"postid"},"editor_settings":{"media_buttons":false,"textarea_name":"post[body]","textarea_rows":5,"tabindex":"","editor_height":180,"editor_css":"","editor_class":"wpeditor","teeny":false,"dfw":false,"plugins":"hr,lists,textcolor,paste,wpautoresize,fullscreen,wpforo_pre_button,wpforo_link_button,wpforo_spoiler_button,wpforo_source_code_button,emoticons","tinymce":{"toolbar1":"fontsizeselect,bold,italic,underline,strikethrough,forecolor,bullist,numlist,hr,alignleft,aligncenter,alignright,alignjustify,link,unlink,blockquote,pre,wpf_spoil,undo,redo,pastetext,source_code,emoticons,fullscreen","toolbar2":"","toolbar3":"","toolbar4":"","content_style":"blockquote{border: #cccccc 1px dotted; background: #F7F7F7; padding:10px;font-size:12px; font-style:italic; margin: 20px 10px;}","object_resizing":false,"autoresize_on_init":true,"wp_autoresize_on":true,"wp_keep_scroll_position":true,"indent":true,"add_unload_trigger":false,"wpautop":false,"setup":"wpforo_tinymce_setup","content_css":"https:\/\/removed.be\/wp-content\/plugins\/wpforo\/wpf-assets\/css\/font-awesome\/css\/fontawesome-all.min.css","extended_valid_elements":"i[class|style],span[class|style]","custom_elements":""},"quicktags":false,"default_editor":"tinymce"},"revision_options":{"is_preview_on":0,"is_draft_on":0,"auto_draft_interval":60000,"max_drafts_per_page":3},"notice":{"login_or_register":"<a href="\&quot;https:\/\/removed.be\/fora\/?foro=signin\&quot;" data-wpel-link="internal">Inloggen<\/a> van <a href=\"https:\/\/removed.be\/fora\/?foro=signup\">Registreer<\/a> aub"}};

Any idea what goes wrong and how to fix?

14 Replies
Robert
Posts: 10591
Admin
(@robert)
Support Team
Joined: 9 years ago

Hi @symergo,

Try to delete all caches, then purge CDN if you have. Then delete otimizer/minifier plugins cache and go to forum front-end. On front-end press Ctrl+F5 twice to reset browser cache or use a private session to check.

And please explain, when does this error happen?

Posts: 8
Topic starter
(@symergo)
Active Member
Joined: 5 years ago

Robert, thanks for your quick reaction.

I deleted all caches and disabled optimizer/caching plugins.  The problem is still there.  

Ajax functionality is not working on all forum pages. 

Chrome gives the errors below.  The first one is the one that is caused by the code included in the original post (all forum pages contain this code). 

Uncaught SyntaxError: Invalid or unexpected token (index):1124

Uncaught ReferenceError: wpforo is not defined
at ajax.js?ver=1.7.2:2
jquery-3.4.1.min.js:2 Uncaught ReferenceError: wpforo is not defined
at HTMLDocument.<anonymous> (frontend.js?ver=1.7.2:427)
at e (jquery-3.4.1.min.js:2)
at t (jquery-3.4.1.min.js:2)
10 Replies
Robert
Admin
(@robert)
Joined: 9 years ago

Support Team
Posts: 10591

@symergo,

I need your forum URL to check the HTML. I think something doesn't allow wpForo to fully load all JS codes.

BTW, does your WordPress theme have <?php wp_footer() ?> function in footer.php? Did you make any change in theme template files?

(@symergo)
Joined: 5 years ago

Active Member
Posts: 8

@robert

the URL is bstore . be / fora

Check the error on the var wpforo statement - seems like there is a syntax error.

the theme is modified, but not recently.  The issue started after a recent update of wpforo.

Robert
Admin
(@robert)
Joined: 9 years ago

Support Team
Posts: 10591

@symergo,

You've damaged wpForo AJAX syntax by adding HTML code in Login/Register pop-up message.

Red marked &quot; are the problems:

"login_or_register":"<a href="\&quot;https:\/\/bstore.be\/fora\/?foro=signin\&quot;" data-wpel-link="internal">Inloggen<\/a> van <a href=\"https:\/\/bstore.be\/fora\/?foro=signup\">Registreer<\/a> aub"

It should be \":

"login_or_register":"Please <a href=\"https:\/\/wpforo.com\/community\/?foro=signin\">Login<\/a> or <a href=\"https:\/\/wpforo.com\/community\/?foro=signup\">Register<\/a>"

 

(@symergo)
Joined: 5 years ago

Active Member
Posts: 8

@robert

That will indeed be it.

But... do you know how the AJAX script gets added to the html source?  I didn't change anything when updating the plugin so I wonder where this wrong syntax comes from.  

Robert
Admin
(@robert)
Joined: 9 years ago

Support Team
Posts: 10591

@symergo,

Do you have custom code in functions.php related to wpForo?

(@symergo)
Joined: 5 years ago

Active Member
Posts: 8

@robert

No, nothing in functions.php

To test that it is not hard-coded: when I change the url for the registration and login page in the wpforo settings, the code is also changed and the \&quot; remains:

"login_or_register":"<a href="\&quot;https:\/\/bstore.be\/register\/\&quot;" data-wpel-link="internal">Inloggen<\/a> van <a href=\"https:\/\/bstore.be\/login\/\">Registreer<\/a> aub"}};

 

I thought that it might go wrong at translation to Dutch, but when setting up a forum in EN, same error: 

"login_or_register":"Please <a href="\&quot;https:\/\/webprice.eu\/register\/\&quot;" data-wpel-link="internal">Login<\/a> or <a href=\"https:\/\/webprice.eu\/login\/\">Register<\/a>"
Alvina
Moderator
(@alvina)
Joined: 5 years ago

Member
Posts: 1862

@symergo,

Please send the admin login details to info[at]gvectors.com email address to allow us to check it.

(@symergo)
Joined: 5 years ago

Active Member
Posts: 8

@alvina

you should have received an mail with the login details.

Sofy
 Sofy
Admin
(@sofy)
Joined: 7 years ago

Support Team
Posts: 5002

@symergo,

We haven't received any email regarding this issue.  

(@symergo)
Joined: 5 years ago

Active Member
Posts: 8

@sofy

I sent a new mail with the details.  Thanks.

Posts: 992
Moderator
(@martin)
Support Team
Joined: 9 years ago

Hi @symergo,

The problem maker was "External Links" plugin. We've deactivated it. If you want to use it, you should contact to plugin developer and ask for a way to exclude it for some page, then exclude your forum page from this plugin. It doesn't use regular hooks for content, it makes changes in whole HTML document, this brings lots of conflicts with other plugins.

1 Reply
(@symergo)
Joined: 5 years ago

Active Member
Posts: 8

@martin

great! Thanks a million!  I am impressed by your support.