Support Forum

Jquery issues When using a RocketTheme wordpress theme on guest View

LE Lee Erickson
Lee Erickson
Member

Hello support,

So we are using SP current version on this site : http://www.businessmentors101.com/forum/, the REALLY odd thing and this is wierd, you get a bunch of javascript errors when accessing the page as a guest BUT if you even login as a lowely subscriber user, the menu works and the errors go away. So it is some js file that is not getting loaded as a guest. We are using a default SP theme. Wondering if you have a solution that we can follow for this problem?

Your Help will be greatly appreciated.

Thanks

12 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

I see jQuery is being loaded but it is being loaded very late in the game – so something is forcing that. The forum is not the only set of scripts causing errors. There are some from your theme and from other plugins as well.

But try this. Go to the forum admin > Integration > Page and Permalink panel and set the option to load JavaScript in the footer. See if that helps with the forum at least.

LE Lee Erickson
Lee Erickson
Member

Hi,

I tried that with the setting you suggested but it still doesn’t work and further, I disabled ALL the plugins but for simple press and gantry+theme and it still does messes up the menu ONLY on the forum page, ONLY when your not logged in :/ Any thoughts?

MP Mr Papa
Mr Papa
Member

is this rocket theme based on gantry? which operates largely outside of the wp api…  like replacing all the wp head stuff..

we have worked with their guys before to work around theme stuff…  worth reading:

https://simple-press.com/support-forum/sp5-general-topics/5-0-and-gantry-framework-themes/

but try going forum – integration – page and permalink, and enabling the bypass wp head check option…

LE Lee Erickson
Lee Erickson
Member

Hi,

I read that and tried the solutions, with no avail, that is not really my problem anyway.

To show you I created a short video so that you may see exactly what is happening:

https://www.evermorevideos.com/bug/

MP Mr Papa
Mr Papa
Member

I am not sure what that video is showing – not much info…

and we dont have different js for guests vs users…

the error you allude to was in the fusion.js and I see similar when visiting the site…  oddly its the first js file loaded on your site (that I can see since guests cannot really get in)… its loaded before even jquery which could part of the issue…  or perhaps it really doesnt need jquery – cannot tell… 

when logged in as a user, is the order of loading different?  you can view the page source as guest and user to compare…

also the error is occurring in mootools which is also known to conflict on occasion with wp/jquery… which brings up another question, where is mootools??  why is it loaded in the middle of the page?  that is improper for js loading…  its getting loaded as part of the login form… why???  is the plugin/theme being too greedy and getting confused by a wp login form in the forum header??  is the theme or plugin (since gantry has both theme and plugin here) do anything special with a login form???  this definitely be a difference between logged in or not…  a source compare should answer this quite quickly…

if the theme or plugin is doing incorrect things because of a login form, you primary choices will be to fix the theme/plugin, or disable the of the inline login form within the forum…

LE Lee Erickson
Lee Erickson
Member

Well sorry the video didn’t come through, that’s what I explained in the video that, the moo tools is loading in the middle of the page ONLY on the forum page when your a guest. period.

All other pages load it in the header just fine.

I have ALL plugins disabled but gantry and simplepress so its not another plugin.

Yes as a guest on the forum page it moves 2 JUST 2 of the JS calls to the middle of the page which is really odd.

I don’t know if the theme that is a rockettheme is doing anything special, I have tried 3 different rocket themes and they ALL have the same problem.

And like I said once you log in it works fine…

Can I give you my login credentials to see?

LE Lee Erickson
Lee Erickson
Member

Oh and just to try it how does one disable the inline login form in the forum?

MP Mr Papa
Mr Papa
Member

in your spHead.php template file of the theme you are using, comment out this line:

sp_LoginForm($loginForm);

some plugins/themes are specific enough when targeting the wp login page and sometimes force undesired actions on login forms in content or sidebars…

as always, we recommend using your own sp theme and not editing one of ours directly… see:

http://codex.simple-press.com/codex/themes/theme-basics/creating-a-theme/

if that fixes the theme/plugin issue (not sure how you disabled all other plugins btw since gantry is part plugin), we can help change our link from opening the login form to be a link to the wp login form instead…

> Simple:Press Support > Friday, July 05, 2013 7:58 PM >postbox-contact-1.jpg

LE Lee Erickson
Lee Erickson
Member

I meant I disabled all plugins BUT Gantry and Simple Press and of course the theme. So I knew it wasn’t a plugin (other than Gantry) issue caused by one of the OTHER plugins.

However I figured it out:

On line 21 of 

/wp-content/plugins/simple-press/forum/content/forms/sp-form-login.php

If I change:

do_action(‘login_head’, ‘sploginform’);

To:

do_action(‘sploginform’);

removing the ‘login_head’, it now works like it should. In fact I can log in and log out and the menus are not broken and the java is being called in the right place.

Do you have any idea why ‘login_head’, would conflict like that? What is it for and will I be ok with out it?

MP Mr Papa
Mr Papa
Member

login_head is to used to let plugins or themes hook into the login form process… without it, anything that needs to hook into login form processing, may not be able too… might not be an issue for your site…

but your code change is pointless as made… you would be better off removing the line of code… as you changed it, you will just be wasting cpu cycles…

so, yeah, like I thought its the inline login form… oddly, not quite the way I thought though… think this is the first time we have run into a plugin that is loading js via that hook (which it probably should be able to) that is causing problems… loading js in the middle of the page is technically not correct, but can work…

in this situation, your theme or plugin is still not loading the js correctly… and our use of that action has exacerbated the problem… so what happens is gantry is trying to load the mootools js in the head tags via that action… when we call it later, it loads it later… this causes problems for other js that has a dependency on the mootools… so really, gantry should be specifying those dependencies since the wp enqueue stuff supports it… in other words it should load the js that depends on the js loaded in the login_head action after the needed js is loaded… they just made an assumption it would be loaded.. assumptions like that are bad ;) the fact that we fired the hook in the body instead of the head tags, made the issue come to light…

so it would be nice if gantry would use the wp js loading api and specify dependencies rather than blanket loading stuff and making assumptions.. Frankly, the api is there for a reason…

that said, on the other hand, we need to take a look at our use of that action too since its really supposed to be in the page head tags so plugins/themes can load js… we may want to clean up our end too…

LE Lee Erickson
Lee Erickson
Member

I will show them this thread, but there are quite a few screwy things about Gantry honestly. For now would it be possible to add a simple if php statement option to disable the login_head part of the feature so that it would be something that I would not have to update time after time? 

Because this is something that ALL rocket theme users will face as I tried MANY different rocket themes and they all had this problem. Again, I didn’t build the themplate rocket themes did using their Gantry framework.

I know it is alot to ask, but please give it some consideration. :)

Thanks for all your help! :)

YS Yellow Swordfish
Yellow Swordfish
Member

We will be removing that filter call and swapping it for one of our own so you can get rid of it with no problem. It wont come back on the next upgrade…