Support » Plugin: Posts 2 Posts » "LIMIT -1" Database Error

  • Resolved Ze Fontainhas


    Here’s what I’m trying to do:

    p2p_register_connection_type( array(
    				'name' => 'courses_to_instructors',
    				'from' => 'fblms_course',
    				'to' => 'user',
    				'to_query_vars' => array( 'role' => 'instructor' )
    			) );

    fblms_course is a Custom Post Type (other connections were created without any problems). instructor is a custom role (via add_role), which also works fine.

    The meta box shows up fine, and actually works without any problems, except for the error message below. I’ve tried running the query in phpmyadmin and it seems that the problem is with the negative LIMIT value:

    SELECT SQL_CALC_FOUND_ROWS wp_users.ID, wp_p2p.* FROM wp_users INNER JOIN wp_usermeta ON (wp_users.ID = wp_usermeta.user_id) INNER JOIN wp_p2p WHERE 1=1 AND ( (wp_usermeta.meta_key = 'wp_capabilities' AND CAST(wp_usermeta.meta_value AS CHAR) LIKE '%\"instructor\"%') ) AND (wp_p2p.p2p_type = 'courses_to_instructors' AND wp_users.ID = wp_p2p.p2p_to AND wp_p2p.p2p_from IN (SELECT wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.ID IN (8) AND wp_posts.post_type IN ('fblms_course') AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'future' OR wp_posts.post_status = 'draft' OR wp_posts.post_status = 'pending' OR wp_posts.post_author = 1 AND wp_posts.post_status = 'private') ORDER BY wp_posts.post_date DESC )) ORDER BY user_login ASC LIMIT -1

    Bug or am I doing_it_wrong?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘"LIMIT -1" Database Error’ is closed to new replies.