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

Author Select #328

Merged
merged 13 commits into from
Feb 15, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
check if user is an error before returning formatted data
liamdefty committed Jan 9, 2018
commit ffcde3ec89392a18c0ad47732a7552a3b4dd3eee
6 changes: 6 additions & 0 deletions classes/class-wpcom-liveblog-entry.php
Original file line number Diff line number Diff line change
@@ -102,6 +102,7 @@ public function get_timestamp() {
public function for_json() {
$entry_id = $this->replaces ? $this->replaces : $this->get_id();
$css_classes = implode( ' ', get_comment_class( '', $entry_id, $this->comment->comment_post_ID ) );

$entry = array(
'id' => $entry_id,
'type' => $this->get_type(),
@@ -114,6 +115,7 @@ public function for_json() {
'contributors' => self::get_contributors_for_json( $entry_id ),
'entry_time' => get_comment_date( 'U', $entry_id ),
);

$entry = apply_filters( 'liveblog_entry_for_json', $entry, $this );
return (object) $entry;
}
@@ -434,6 +436,10 @@ private static function get_contributors_for_json( $comment_id ) {
* @param object $user The user object
*/
private static function get_user_data_for_json( $user ) {
if ( is_wp_error( $user ) ) {
return array();
}

$avatar_size = apply_filters( 'liveblog_entry_avatar_size', self::default_avatar_size );
return array(
'id' => $user->ID,