Support Forum

Won't let me post new topic

DL David Long
David Long
Member

Downloaded the plugin, installation was easy, set up a category, created groups, created forums……only problem is that when I click on the New Topic button…..nothing happens. Won’t let me create a new topic…..any ideas?

10 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

You most probably have a JavaScript conflict – your wp theme or another plugin – which needs to be fixed. This codex article explains what this means and what to look for:

http://codex.simple-press.com/codex/faq/troubleshooting/what-is-this-jquery-conflict/

A link to your forum page might help us identify if this is the case although you can also check using a script console tool like Firebug.

DL David Long
David Long
Member

Firebug shows two errors:

$ is not a function
http://alti2udeoutdoors.com/wp-content/themes/Winterland/custom-search/js/search.js?ver=3.5.1
Line 103

$ is not a function
http://alti2udeoutdoors.com/forum/
Line 124

Any ideas?

Here is a link:

http://alti2udeoutdoors.com/forum/

MP Mr Papa
Mr Papa
Member

Andy gave you a link with the issue…

<script type=’text/javascript’ src=’http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver=3.5.1′></script>

you have a theme or plugin incorrectly loading jquery from external source… and a quite old version at that…  it wont work well with other wp plugins or themes that use jquery and expect the version that comes with wp…

first step is identify the culprit… try a quick switch to wp default theme and see if it works… I doubt it, but easiest to try first…

then disable all other plugins and see if it works… when it does, enable one by one until it breaks…

then we can see about helping you fix the bad plugin or theme…

 

DL David Long
David Long
Member

It works in the WP default theme…..so it’s not a plugin. Any ideas what my next step would be? Thanks for your help.

MP Mr Papa
Mr Papa
Member

that means it would be your wp theme doing it wrong…  so lets find where in the theme it loads that line of code.. and we can help fix it… so search your theme… often in header.php or functions.php.. but could be anywhere based on theme structure…

DL David Long
David Long
Member

I found this line in functions.php

wp_register_script( ‘jquery’, ‘http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js’);

MP Mr Papa
Mr Papa
Member

yup. thats the culprit – at least the first one we see…  Now unfortunately, I dont have a context for how that is used… which hook will get to it… so will give some code to try, but might need more of the code around that one line..  There is likely an wp_deregister_script(…) and wp_enqueue_script(…) around it too…  so guessing it looks something like this:

wp_deregister_script('jquery');
wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
wp_register_script('jquery');

if so, we want to replace that section or those lines with this:

if (!sp_is_forumpage()) {
    wp_deregister_script('jquery');
    wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
}
wp_register_script('jquery');

Now that new code will continue to load the old, external library on non forum pages so something else doesnt break… but on forum pages, it will follow wp standards and load the wp version of jquery…

assuming, I have done that right and I am guessing at the other lines…

 

DL David Long
David Long
Member

Here is the script I currently have surrounding the call to js:

if (!function_exists(‘load_theme_scripts’)) {
    function load_theme_scripts() {

    $jscriptURL = get_template_directory_uri().’/js/’;
    wp_deregister_script( ‘jquery’ );
    wp_register_script( ‘jquery’, ‘http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js’);
    wp_enqueue_script( ‘jquery’ );
    wp_register_script(‘jsEasing’, ($jscriptURL.’jquery.easing.1.3.js’), array(‘jquery’), NULL, true );
    wp_enqueue_script(‘jsEasing’);                
    wp_register_script(‘myScript’, ($jscriptURL.’script.js’), array(‘jquery’), NULL, true );
    wp_enqueue_script(‘myScript’);
    wp_register_script(‘mySlides’, ($jscriptURL.’slides.min.jquery.js’), array(‘jquery’), NULL, true );
    wp_enqueue_script(‘mySlides’);
    wp_register_script(‘myCycle’, ($jscriptURL.’jquery.cycle.min.js’), array(‘jquery’), NULL, true );
    wp_enqueue_script(‘myCycle’);
    wp_register_script(‘jselectBox’, ($jscriptURL.’jquery.selectBox.js’), array(‘jquery’), NULL, true );
    wp_enqueue_script(‘jselectBox’);

    }
}

The name of the page where my forum is located is forum, so, with that being said, here is how the new code looks:

if (!function_exists(‘load_theme_scripts’)) {
    function load_theme_scripts() {

if (!sp_is_forum()) {

    $jscriptURL = get_template_directory_uri().’/js/’;
    wp_deregister_script( ‘jquery’ );
    wp_register_script( ‘jquery’, ‘http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js’);
    wp_enqueue_script( ‘jquery’ );
    wp_register_script(‘jsEasing’, ($jscriptURL.’jquery.easing.1.3.js’), array(‘jquery’), NULL, true );
    wp_enqueue_script(‘jsEasing’);                
    wp_register_script(‘myScript’, ($jscriptURL.’script.js’), array(‘jquery’), NULL, true );
    wp_enqueue_script(‘myScript’);
    wp_register_script(‘mySlides’, ($jscriptURL.’slides.min.jquery.js’), array(‘jquery’), NULL, true );
    wp_enqueue_script(‘mySlides’);
    wp_register_script(‘myCycle’, ($jscriptURL.’jquery.cycle.min.js’), array(‘jquery’), NULL, true );
    wp_enqueue_script(‘myCycle’);
    wp_register_script(‘jselectBox’, ($jscriptURL.’jquery.selectBox.js’), array(‘jquery’), NULL, true );
    wp_enqueue_script(‘jselectBox’);

    }
}

}

Unfortunately, when I alter the functions.php to look like this, the entire screen goes solid white and I can’t access any pages. I am forced to re-upload the original functions.php over it to be able to access the site again. Am I doing something wrong with how I am inserting it?

 

Thanks for your patience.

DL David Long
David Long
Member

Ok, realizing my error in the above code, here is my new code and IT WORKS!

if (!function_exists(‘load_theme_scripts’)) {
    function load_theme_scripts() {

if (!sp_is_forumpage('forum')) {

    $jscriptURL = get_template_directory_uri().’/js/’;
    wp_deregister_script( ‘jquery’ );
    wp_register_script( ‘jquery’, ‘http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js’);
    wp_enqueue_script( ‘jquery’ );
    wp_register_script(‘jsEasing’, ($jscriptURL.’jquery.easing.1.3.js’), array(‘jquery’), NULL, true );
    wp_enqueue_script(‘jsEasing’);                
    wp_register_script(‘myScript’, ($jscriptURL.’script.js’), array(‘jquery’), NULL, true );
    wp_enqueue_script(‘myScript’);
    wp_register_script(‘mySlides’, ($jscriptURL.’slides.min.jquery.js’), array(‘jquery’), NULL, true );
    wp_enqueue_script(‘mySlides’);
    wp_register_script(‘myCycle’, ($jscriptURL.’jquery.cycle.min.js’), array(‘jquery’), NULL, true );
    wp_enqueue_script(‘myCycle’);
    wp_register_script(‘jselectBox’, ($jscriptURL.’jquery.selectBox.js’), array(‘jquery’), NULL, true );
    wp_enqueue_script(‘jselectBox’);

    }
}

}

Thanks for all your help! Works great!

YS Yellow Swordfish
Yellow Swordfish
Member

Yes indeed that is better!
This removes ALL of those libraries from loading on the forum page but that is probably going to be OK. So – good news it works…