WordPress.org

Ready to get started?Download WordPress

Forums

Posts 2 Posts
[resolved] "LIMIT -1" Database Error (3 posts)

  1. Ze Fontainhas
    Moderator
    Posted 1 year ago #

    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?

    http://wordpress.org/extend/plugins/posts-to-posts/

  2. Ze Fontainhas
    Moderator
    Posted 1 year ago #

    Found the issue on GitHub:

    https://github.com/scribu/wp-posts-to-posts/issues/284

    and patched my 1.4.3 for the time being.

  3. TCBarrett
    Member
    Posted 1 year ago #

    Thanks Ze Fontainhas.

    Just stumbled across this myself (P2P 1.4.3 + WP 3.5.1). Thanks for the github link.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic