diff --git a/classes/class-author.php b/classes/class-author.php
index ae6d29f6a..6b9608ca1 100644
--- a/classes/class-author.php
+++ b/classes/class-author.php
@@ -2,12 +2,6 @@
namespace WP_Stream;
class Author {
- /**
- * Hold Plugin class
- * @var Plugin
- */
- public $plugin;
-
/**
* @var int
*/
@@ -36,8 +30,6 @@ function __construct( $user_id, $user_meta = array() ) {
if ( $this->id ) {
$this->user = new \WP_User( $this->id );
}
-
- $this->plugin = wp_stream_get_instance();
}
/**
@@ -129,7 +121,8 @@ function get_avatar_img( $size = 80 ) {
}
if ( 0 === $this->id ) {
- $url = $this->plugin->locations['url'] . 'ui/stream-icons/wp-cli.png';
+ $stream = wp_stream_get_instance();
+ $url = $stream->locations['url'] . 'ui/stream-icons/wp-cli.png';
$avatar = sprintf( '
', esc_attr( $this->get_display_name() ), esc_url( $url ), esc_attr( $size ) );
} else {
if ( $this->is_deleted() && isset( $this->meta['user_email'] ) ) {
@@ -193,23 +186,6 @@ function get_role() {
return $user_role;
}
- /**
- * Construct a URL for viewing user-specific records
- *
- * @return string
- */
- function get_records_page_url() {
- $url = add_query_arg(
- array(
- 'page' => $this->plugin->admin->records_page_slug,
- 'user_id' => absint( $this->id ),
- ),
- self_admin_url( $this->plugin->admin->admin_parent_page )
- );
-
- return $url;
- }
-
/**
* True if user no longer exists, otherwise false
*
diff --git a/classes/class-db.php b/classes/class-db.php
index 8305536ef..2d493cb71 100644
--- a/classes/class-db.php
+++ b/classes/class-db.php
@@ -187,7 +187,7 @@ function existing_records( $column ) {
}
$rows = $wpdb->get_results(
- $wpdb->prepare( "SELECT $column FROM $wpdb->stream GROUP BY %s", $column ), // @codingStandardsIgnoreLine can't prepare column name
+ "SELECT DISTINCT $column FROM $wpdb->stream", // @codingStandardsIgnoreLine can't prepare column name
'ARRAY_A'
);
diff --git a/classes/class-list-table.php b/classes/class-list-table.php
index e57680820..430604312 100644
--- a/classes/class-list-table.php
+++ b/classes/class-list-table.php
@@ -257,9 +257,17 @@ function column_default( $item, $column_name ) {
case 'user_id' :
$user = new Author( (int) $record->user_id, (array) maybe_unserialize( $record->user_meta ) );
+ $filtered_records_url = add_query_arg(
+ array(
+ 'page' => $this->plugin->admin->records_page_slug,
+ 'user_id' => absint( $user->id ),
+ ),
+ self_admin_url( $this->plugin->admin->admin_parent_page )
+ );
+
$out = sprintf(
'%s %s%s%s%s',
- $user->get_records_page_url(),
+ $filtered_records_url,
$user->get_avatar_img( 80 ),
$user->get_display_name(),
$user->is_deleted() ? sprintf( '
%s', esc_html__( 'Deleted User', 'stream' ) ) : '',
diff --git a/tests/tests/test-class-author.php b/tests/tests/test-class-author.php
index 9190598c2..5918f0dae 100644
--- a/tests/tests/test-class-author.php
+++ b/tests/tests/test-class-author.php
@@ -35,7 +35,6 @@ public function test_construct() {
$this->assertNotEmpty( $this->author->id );
$this->assertInternalType( 'array', $this->author->meta );
$this->assertNotEmpty( $this->author->meta );
- $this->assertInstanceOf( '\WP_Stream\Plugin', $this->author->plugin );
}
public function test_get() {
@@ -75,10 +74,6 @@ public function test_get_role() {
$this->assertEquals( 'Administrator', $this->author->get_role() );
}
- public function test_get_records_page_url() {
- $this->assertNotFalse( parse_url( $this->author->get_records_page_url() ) );
- }
-
public function test_is_deleted() {
$this->assertFalse( $this->author->is_deleted() );
}