Support » Plugin: BP Code Snippets » Error after upgrading to WP 3.5

Viewing 15 replies - 1 through 15 (of 16 total)
  • Opps forgot to post the error:

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/ownwpcom/public_html/wp-content/plugins/bp-code-snippets/includes/bp-code-snippets-class.php on line 235 and defined in /home/ownwpcom/public_html/wp-includes/wp-db.php on line 990

    Plugin Author Mathieu Viet


    ok it’s a warning, thanks for notifying me, i’ll correct this really soon.

    That would be great. Until then I will deactivate the plugin as it is very confusing to users who are not expecting that.

    Can you give me a rough estimate of “really soon”? I won’t hold you to it (I understand how delays in development can go) but looking for when to check back for followup.

    Thanks in advance.

    Plugin Author Mathieu Viet


    Well kerry, i strongly advise you to avoid printing errors on screen on a live website but keep them in an error log file. it’s safest.

    Now, to correct it, it’s not a big deal. Just need to make some tests to check everything is ok on different config.. i’ll try to do quick.

    But you can test this and tell me if it solved the trouble : replace all lines (number of lines are diplayed just after //) by these lines :

    // line 168 of bp-code-snippets/includes/bp-code-snippets-class.php
    $d = $wpdb->prepare( "DELETE FROM {$bp->snippets->table_cs} WHERE secondary_id = %d AND object IN('group_comment','directory_comment')", $this->comment_id );
    // line 233 of bp-code-snippets/includes/bp-code-snippets-class.php
    $snippets = $wpdb->get_results( apply_filters( 'bp_code_snippets_get_user_join_filter', "{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_cs {$sort} {$pag_sql}", $select_sql, $from_sql, $where_sql, $sort, $pag_sql ) );
    // line 235 of bp-code-snippets/includes/bp-code-snippets-class.php
    $snippets = $wpdb->get_results( apply_filters( 'bp_code_snippets_get_user_join_filter', "{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_cs {$sort}", $select_sql, $from_sql, $where_sql, $sort ) );
    // line 238 of bp-code-snippets/includes/bp-code-snippets-class.php
    $total_snippets_sql = apply_filters( 'bp_code_snippets_total_snippets_sql', "SELECT count(a.id_cs) FROM {$bp->snippets->table_cs} a {$where_sql} ORDER BY a.date_cs {$sort}", $where_sql, $sort );
    // line 251 of bp-code-snippets/includes/bp-code-snippets-class.php
    if ( $names = $wpdb->get_results( "SELECT user_id, value AS user_fullname FROM {$bp->profile->table_name_data} WHERE field_id = 1 AND user_id IN ({$snippet_user_ids})" ) ) {
    // line 357 of bp-code-snippets/includes/bp-code-snippets-class.php
    $snippet_ids = $wpdb->get_col( "SELECT id_cs FROM {$bp->snippets->table_cs} {$where_sql}" );
    // line 359 of bp-code-snippets/includes/bp-code-snippets-class.php
    if ( !$wpdb->query( "DELETE FROM {$bp->snippets->table_cs} {$where_sql}" ) )
    // line 381 of bp-code-snippets/includes/bp-code-snippets-class.php
    $comment_ids = $wpdb->get_col( "SELECT id_cs_comment FROM {$bp->snippets->table_cs_comment} WHERE cs_id IN ({$snippet_ids})" );
    // line 386 of bp-code-snippets/includes/bp-code-snippets-class.php
    return $wpdb->query( "DELETE FROM {$bp->snippets->table_cs_comment} WHERE cs_id IN ({$snippet_ids})" );
    // line 397 of bp-code-snippets/includes/bp-code-snippets-class.php
    return $wpdb->query( "DELETE FROM {$bp->snippets->table_cs_meta} WHERE snippet_id IN ({$snippet_ids})" );
    //line 408 of bp-code-snippets/includes/bp-code-snippets-class.php
    return $wpdb->query( "DELETE FROM {$bp->snippets->table_cs} WHERE secondary_id IN ({$comment_ids}) AND object IN('group_comment','directory_comment')" );
    //line 539 of bp-code-snippets/includes/bp-code-snippets-class.php
    return $wpdb->get_var( "SELECT date_cs FROM {$bp->snippets->table_cs} ORDER BY date_cs DESC LIMIT 1" );
    //line 556 of bp-code-snippets/includes/bp-code-snippets-class.php
    $snippet_in_db = $wpdb->get_col( "SELECT id_cs FROM {$bp->snippets->table_cs} {$where}" );

    Plugin Author Mathieu Viet


    Good evening,

    I still need to run some tests, but i just published some fixes in the trunk of the plugin. So you can help me by testing it on your config to see if everything is going the right way.

    The easiest way for you is to download the trunk version of bp code snippets, then you will have to replace these files in your website /wp-content/plugins/bp-code-snippets/includes/ folder :

    • bp-code-snippets-class.php
    • bp-code-snippets-filters.php
    • bp-code-snippets-functions.php
    • bp-code-snippets-screens.php

    by the same files that are in the trunk version. Please give me some feedback, this way it will help me to make this upgrade available faster.


    Here is what I did.
    I downloaded the plugin and unzipped on my computer. Went to my WP installation and deleted the four files listed above and then FTP’d the files from the new download to the site.

    At this point I network activated the plugin and got the “needs repair message as expected. I had to recreate the default page for the Plugin via repair, add new, save, go repair, and save there as well. Once the “snippets” page was added…

    The error messages went away but now I am not able to add a new snippet.

    The “New Snippet” link button is there and appears to be “hoverable” (as in it’s style changes) the link appears to be “clickable” too (with the little hand) but nothing happens when I click it.

    Once clicked, the link stays in the active state which is the same as if I were hovering, appearance wise.

    I did not add all the stuff from the post before your last… do I still need to do all of that as well? I assumed those changes were included in the files I downloaded.

    Plugin Author Mathieu Viet


    yes those changes were included in the files.

    i guess you’re talking of the button next to the title ‘Snippets Directory’ when you display http://yoursite/snippets

    Just tested, it’s working for me.

    What says javascript console error ?

    in the <head> tag of your blog you should have :
    <script type="text/javascript" src="http://yoursite/wp-content/plugins/bp-code-snippets/js/bp-code-snippets.js?ver=3.5"></script>

    is it the case ?

    In the other areas where you can add snippets (groups, forum, blog post) is it working ?

    Sorry, I am not a coder and am not familiar where to find javascript console error. I am not seeing any errors, the link just does dot go any where.

    I added the script:
    <script type=”text/javascript” src=”″></script&gt;
    to my theme in the “List any JavaScript or other code to be manually inserted inside the site’s <head> tag” area. It was not there before, but adding it still did not fix the issue.

    Here are screenshots of where, when I have the Add New Button selected, nothing happens. with the button link going to with the button link going to

    I do not even see where the forum or blog option might even be at all.

    This is installed on a multi-site (in case you needed that) and this particular site is the primary site of the multi-site.

    Am I missing something in the settings? It almost seems like it should/could be a permissions thing?

    Plugin Author Mathieu Viet


    and if you try :

    The link goes nowhere, it just shows a form under the list of snippets and set the focus to the title field of this form. So it needs the javacript file and jquery.

    In group forums, if snippets is enable in the group, you should see a ‘Add Snippet’ button just before the “Post topic” button

    If you’re not sure, i invite you to check the demo of the plugin on its plugin home page.

    You should remove the script you added. I just need to know if it’s in the code source of the page and at the right place (after jQuery)

    too bad you’re using s2member, i cant check by myself what’s going wrong…

    OK, I have removed the script as requested.

    I also have it now in the groups (as I just added the snippet to be in one of the groups). And I do get the same result.

    What do you need from me to help you to help me? I really want to use this plugin…

    I do have a lot of BuddyPress plugins on this site, wondering at this point if it is perhaps a plugin conflict?

    Plugin Author Mathieu Viet


    well i registered on your website yesterday, i’m level 0.. and to access to the snippet page i need to be level 1. So if you could temporarly give me this level, i’ll be able to check by myself javascript errors if there’s some.

    As i registerd on your website, you now have my email, so if you could send me the list of the plugin you activated i think it could help.

    Yesterday, i’ve tested on 3.5/1.6.2 multisite and it’s working for me.. So before publishing an upgrade i’d like to know why this isn’t working for you…

    When, i will have finished, i’ll delete my account from your site.

    Consider it done. Let me know what you find. I will send the Plugin list separately – I will also attempt to locate any potential conflict before doing so.

    Plugin Author Mathieu Viet


    Ok, there’s something wrong with the template ‘snippets-create.php’. It looks like your theme is overriding the one i provide in my plugin, i imagine to adapt it to the look n feel of your website.

    I suggest that you go in the folder of your active theme, then look for a file called ‘snippets-create.php’ open it a text editor, and see what’s weird. It looks like it’s empty actually..

    When i click on the new snippet button, it actually shows the container of the form as the div#new-snippet has a display set to block. So the javascript is ok, there’s no conflict. I really think the template ‘snippets-create.php’ is empty.

    In your theme’s folder you can try to rename it to ‘snippets-create-wait.php’, then it should load the template that is bundled with my plugin. The style will certainly dont look great on your site but you should try to post a new snippet.

    There’s also something weird with the theme maybe i think, because by default the ‘my snippets tab’ is activated ??? or when on the main directory page ( the first tab should be displayed and the sixteen snippets should show…

    Plugin Author Mathieu Viet


    version 2.1 should fix the issue

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Error after upgrading to WP 3.5’ is closed to new replies.