Title: Brocken plugin
Last modified: August 20, 2016

---

# Brocken plugin

 *  [Michael Junker](https://wordpress.org/support/users/mjunker/)
 * (@mjunker)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/brocken-plugin/)
 * The current version of your plugin in not working with wp 3.5. I get no returns
 * [http://wordpress.org/extend/plugins/cubepoints/](http://wordpress.org/extend/plugins/cubepoints/)

Viewing 13 replies - 1 through 13 (of 13 total)

 *  [myCred](https://wordpress.org/support/users/designbymerovingi/)
 * (@designbymerovingi)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/brocken-plugin/#post-3318543)
 * Can you be a bit more specific on what errors you get?
 *  Thread Starter [Michael Junker](https://wordpress.org/support/users/mjunker/)
 * (@mjunker)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/brocken-plugin/#post-3318550)
 * What I have is 2 sites set up identical, one is my active site the other is a
   test site, the active site is
    wp 3.4.2 wps 13.2 (with andin for symposium) cubepoints
   3.2.1 everything works correct
 * the test site:
    wp 3.5 wps 13.2 (with andin for symposium) cubepoints 3.2.1 I
   get no output and no error messages
 * FYI
    same issue I’m having is on Mingle Community and wp-Symposium sites
 * everything worked on my test site fine until I updated to wp 3.5
 *  [myCred](https://wordpress.org/support/users/designbymerovingi/)
 * (@designbymerovingi)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/brocken-plugin/#post-3318552)
 * You have WP_DEBUG set to true?
 *  Thread Starter [Michael Junker](https://wordpress.org/support/users/mjunker/)
 * (@mjunker)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/brocken-plugin/#post-3318555)
 * No I do not
 *  [myCred](https://wordpress.org/support/users/designbymerovingi/)
 * (@designbymerovingi)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/brocken-plugin/#post-3318557)
 * in your wp-config.php set it to true and let me know what errors pop up regarding
   CubePoints.
 *  [foobarph](https://wordpress.org/support/users/foobarph/)
 * (@foobarph)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/brocken-plugin/#post-3318654)
 * In Add Points module
    > We can see list of members in Ajax form BUT when we select
   it, it only shows Loading part but does not show the forms for us to add points.
 * In WP 3.4, it still works. But when we upgrade it to WP 3.5, it did not work.
   Here’s the log I generated when I enabled WP_DEBUG to true.
 * —
 * Notice: Use of undefined constant DC_MAX_ATTEMPTS – assumed ‘DC_MAX_ATTEMPTS’
   in /home/topbook/public_html/read/wp-content/plugins/wp-download-codes/wp-download-
   codes.php on line 33
 * Notice: Use of undefined constant DC_ALLOWED_DOWNLOADS – assumed ‘DC_ALLOWED_DOWNLOADS’
   in /home/topbook/public_html/read/wp-content/plugins/wp-download-codes/wp-download-
   codes.php on line 34
 * Notice: Use of undefined constant DC_FILE_TYPES – assumed ‘DC_FILE_TYPES’ in /
   home/topbook/public_html/read/wp-content/plugins/wp-download-codes/wp-download-
   codes.php on line 35
 * Notice: Use of undefined constant DC_CODE_CHARS – assumed ‘DC_CODE_CHARS’ in /
   home/topbook/public_html/read/wp-content/plugins/wp-download-codes/wp-download-
   codes.php on line 36
 * Notice: wp_register_script was called incorrectly. Scripts and styles should 
   not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts,
   or init hooks. Please see Debugging in WordPress for more information. (This 
   message was added in version 3.3.) in /home/topbook/public_html/read/wp-includes/
   functions.php on line 2944
 * Notice: wp_register_style was called incorrectly. Scripts and styles should not
   be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts,
   or init hooks. Please see Debugging in WordPress for more information. (This 
   message was added in version 3.3.) in /home/topbook/public_html/read/wp-includes/
   functions.php on line 2944
 * Notice: Undefined index: cpm_action in /home/topbook/public_html/read/wp-content/
   plugins/cubepm/cpm_page_read.php on line 54
 * Notice: has_cap was called with an argument that is deprecated since version 
   2.0! Usage of user levels by plugins and themes is deprecated. Use roles and 
   capabilities instead. in /home/topbook/public_html/read/wp-includes/functions.
   php on line 2908
 *  [myCred](https://wordpress.org/support/users/designbymerovingi/)
 * (@designbymerovingi)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/brocken-plugin/#post-3318655)
 * hi foobarph.
 * The error messages you have pasted here does not contain any CubePoints errors
   but for the “wp-download-codes” plugin. If you disable this plugin, does CubePoints
   work?
 *  [foobarph](https://wordpress.org/support/users/foobarph/)
 * (@foobarph)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/brocken-plugin/#post-3318656)
 * Hi Gabriel, I disabled wp-download-codes plugin but still, i can’t see the form
   for adding points.
 * I wonder if there was incompatibility with has_cap function or the ‘css style’
   itself.
 * Are you using Cubepoints as well Gabriel?
 *  [foobarph](https://wordpress.org/support/users/foobarph/)
 * (@foobarph)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/brocken-plugin/#post-3318657)
 * Hi again Gabriel and everyone.
 * I’ll share my own personal fix to add points module.
 * [http://foobarph.wordpress.com/2013/01/02/cubepoints-3-2-1-temporary-bugfix-in-add-points-module-using-wordpress-3-5/](http://foobarph.wordpress.com/2013/01/02/cubepoints-3-2-1-temporary-bugfix-in-add-points-module-using-wordpress-3-5/)
 *  [myCred](https://wordpress.org/support/users/designbymerovingi/)
 * (@designbymerovingi)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/brocken-plugin/#post-3318659)
 * Ok, so I think I fixed it.
    I adjusted the ajax calls in the cp_hooks.php file
   by adding $wpdb->prepare() and I also removed a trim() of the query string and
   now it works for me on CubePoints 3.2.1 running on WP 3.5
 * Replace ‘wp_ajax_cp_add_points_user_suggest’ on line 293 with this one:
 *     ```
       /** Hook for add-points autocomplete user suggestion */
       add_action( 'wp_ajax_cp_add_points_user_suggest', 'cp_add_points_user_suggest' );
       function cp_add_points_user_suggest() {
   
       	header( "Content-Type: application/json" );
   
       	if( !current_user_can( 'manage_options' ) || $_REQUEST['q'] == '' ) {
       		$response = json_encode( array() );
       		echo $response;
       		exit;
       	}
   
       	global $wpdb;
       	// Removed trim() and inserted $wpdb->prepare()
       	$users = $wpdb->get_results( $wpdb->prepare( "
       		SELECT *
       		FROM " . $wpdb->prefix . 'users' . "
       		WHERE user_login LIKE %s
       		LIMIT 10",
       		$_REQUEST['q']
       		), ARRAY_A );
   
       	$response = array();
   
       	foreach( $users as $user ) {
       		$response[] = implode( "|", array(
       			$user['user_login'],
       			$user['ID'],
       			$user['display_name'],
       			$user['user_email'],
       			md5( trim( strtolower( $user['user_email'] ) ) )
       		) );
       	}
   
       	$response = json_encode( implode( "\n", $response ) );
       	echo $response;
       	exit;
       }
       ```
   
 * and directly after that function replace ‘wp_ajax_cp_add_points_user_query’ with:
 *     ```
       /** Hook for add-points user query */
       add_action( 'wp_ajax_cp_add_points_user_query', 'cp_add_points_user_query' );
       function cp_add_points_user_query() {
   
       	header( "Content-Type: application/json" );
   
       	if( !current_user_can('manage_options') || $_REQUEST['q'] == '' ){
       		$response = json_encode( array() );
       		echo $response;
       		exit;
       	}
   
       	global $wpdb;
       	// Removed inserted $wpdb->prepare()
       	$user = $wpdb->get_row( $wpdb->prepare( "
       		SELECT *
       		FROM " . $wpdb->prefix . 'users' . "
       		WHERE user_login LIKE %s
       		LIMIT 1",
       		$_REQUEST['q']
       		), ARRAY_A );
   
       	if ( $user['ID'] == null ) {
       		$response = json_encode( array() );
       		echo $response;
       		exit;
       	}
       	$response = json_encode( array(
       		'id' => $user['ID'],
       		'user_login' => $user['user_login'],
       		'display_name' => $user['display_name'],
       		'email' => $user['user_email'],
       		'points' => cp_getPoints($user['ID']),
       		'hash' => md5(trim(strtolower($user['user_email'])))
       		));
       	echo $response;
       	exit;
   
       }
       ```
   
 *  [myCred](https://wordpress.org/support/users/designbymerovingi/)
 * (@designbymerovingi)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/brocken-plugin/#post-3318660)
 * [Found](http://codex.wordpress.org/Class_Reference/wpdb#Protect_Queries_Against_SQL_Injection_Attacks)
   this:
 * > Please note: As of 3.5, wpdb::prepare() enforces a minimum of 2 arguments.
 * So you cant use $wpdb->prepare() with just one argument as done on line 305.
 *  [clarklab](https://wordpress.org/support/users/clarklab/)
 * (@clarklab)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/brocken-plugin/#post-3318702)
 * So to use this with 3.5, I need to copy/paste what I see above? Or is there a
   new fix coming out?
 * Thanks in advance!
 *  [myCred](https://wordpress.org/support/users/designbymerovingi/)
 * (@designbymerovingi)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/brocken-plugin/#post-3318703)
 * Yes you will need to replace the cp_add_points_user_suggest() and cp_add_points_user_query()
   functions with the one given up here.
    We can always hope the creators of the
   plugin can update these things.

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Brocken plugin’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/cubepoints_8ba995.svg)
 * [CubePoints](https://wordpress.org/plugins/cubepoints/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cubepoints/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cubepoints/)
 * [Active Topics](https://wordpress.org/support/plugin/cubepoints/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cubepoints/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cubepoints/reviews/)

 * 13 replies
 * 4 participants
 * Last reply from: [myCred](https://wordpress.org/support/users/designbymerovingi/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/brocken-plugin/#post-3318703)
 * Status: not resolved