Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Users are not showing in the admin_column #581

Open
OlaIola opened this issue Nov 27, 2023 · 0 comments
Open

Users are not showing in the admin_column #581

OlaIola opened this issue Nov 27, 2023 · 0 comments

Comments

@OlaIola
Copy link

OlaIola commented Nov 27, 2023

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant