Skip to content

Users are not showing in the admin_column #581

Open
@OlaIola

Description

@OlaIola

Plugin version is 1.7.2

       p2p_register_connection_type(
         array(
            'name'           => 'event_to_user',
            'from'           => 'event',
            'to'             => 'user',
            'admin_column'   => 'from',
            'to_query_vars' => array( 'role' => 'editor' )
         )
      );

Trying to show connected users in an admin column for a post type is not succeeded because the object don't have what is required by function:

/wp-content/plugins/posts-to-posts/vendor/scribu/lib-posts-to-posts/util.php:123

/** @internal */
function _p2p_get_other_id( $item ) {
   if ( $item->ID == $item->p2p_from )
      return $item->p2p_to;

   if ( $item->ID == $item->p2p_to )
      return $item->p2p_from;

   trigger_error( "Corrupted data for item $inner_item->ID", E_USER_WARNING );
}

And resulting in:

PHP Notice:  Undefined variable: inner_item in /var/www/html/wp-content/plugins/posts-to-posts/vendor/scribu/lib-posts-to-posts/util.php on line 123
PHP Notice:  Trying to get property 'ID' of non-object in /var/www/html/wp-content/plugins/posts-to-posts/vendor/scribu/lib-posts-to-posts/util.php on line 123
PHP Warning:  Corrupted data for item  in /var/www/html/wp-content/plugins/posts-to-posts/vendor/scribu/lib-posts-to-posts/util.php on line 123

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions