WordPress.org

Ready to get started?Download WordPress

Forums

CubePoints
Brocken plugin (14 posts)

  1. mjunker
    Member
    Posted 1 year ago #

    The current version of your plugin in not working with wp 3.5. I get no returns

    http://wordpress.org/extend/plugins/cubepoints/

  2. Gabriel
    Member
    Posted 1 year ago #

    Can you be a bit more specific on what errors you get?

  3. mjunker
    Member
    Posted 1 year ago #

    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

  4. Gabriel
    Member
    Posted 1 year ago #

    You have WP_DEBUG set to true?

  5. mjunker
    Member
    Posted 1 year ago #

    No I do not

  6. Gabriel
    Member
    Posted 1 year ago #

    in your wp-config.php set it to true and let me know what errors pop up regarding CubePoints.

  7. foobarph
    Member
    Posted 1 year ago #

    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

  8. Gabriel
    Member
    Posted 1 year ago #

    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?

  9. foobarph
    Member
    Posted 1 year ago #

    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?

  10. foobarph
    Member
    Posted 1 year ago #

    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/

  11. Gabriel
    Member
    Posted 1 year ago #

    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;
    
    }
  12. Gabriel
    Member
    Posted 1 year ago #

    Found 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.

  13. clarklab
    Member
    Posted 1 year ago #

    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!

  14. Gabriel
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.