Skip to content

Commit

Permalink
Reflect post type on summary in posts connector #8
Browse files Browse the repository at this point in the history
  • Loading branch information
shadyvb committed Dec 7, 2013
1 parent cd81c8b commit 87caf70
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions connectors/posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,25 +93,25 @@ public static function callback_transition_post_status( $new, $old, $post ) {
return;
}
elseif ( $old == 'auto-draft' && $new == 'draft' ) {
$message = __( '"%s" post drafted', 'stream' );
$message = __( '"%s" %s drafted', 'stream' );
$action = 'created';
}
elseif ( $old == 'auto-draft' && ( in_array( $new, array( 'publish', 'private' ) ) ) ) {
$message = __( '"%s" post published', 'stream' );
$message = __( '"%s" %s published', 'stream' );
$action = 'created';
}
elseif ( $old == 'draft' && ( in_array( $new, array( 'publish', 'private' ) ) ) ) {
$message = __( '"%s" post published', 'stream' );
$message = __( '"%s" %s published', 'stream' );
}
elseif ( $old == 'publish' && ( in_array( $new, array( 'draft' ) ) ) ) {
$message = __( '"%s" post unpublished', 'stream' );
$message = __( '"%s" %s unpublished', 'stream' );
}
elseif ( $new == 'trash' ) {
$message = __( '"%s" post trashed', 'stream' );
$message = __( '"%s" %s trashed', 'stream' );
$action = 'trashed';
}
else {
$message = __( '"%s" post updated', 'stream' );
$message = __( '"%s" %s updated', 'stream' );
}

if ( empty( $action ) ) {
Expand Down Expand Up @@ -139,6 +139,7 @@ public static function callback_transition_post_status( $new, $old, $post ) {
$message,
array(
'post_title' => $post->post_title,
'post_type' => $post->post_type,

This comment has been minimized.

Copy link
@frankiejarrett

frankiejarrett Dec 8, 2013

Contributor

@shadyvb What if the post type slug is library_book or something? I think we should reference the actual post type singular label here, not the post type slug.

$post_type = get_post_type_object( $post->post_type );
$post_type->labels->singular_name;

This comment has been minimized.

Copy link
@frankiejarrett

frankiejarrett Dec 8, 2013

Contributor

Done in e1312cf

'new_status' => $new,
'old_status' => $old,
'revision_id' => $revision_id,
Expand All @@ -161,9 +162,10 @@ public static function callback_deleted_post( $post_id ) {
return;
}
self::log(
__( '"%s" post deleted from trash', 'stream' ),
__( '"%s" %s deleted from trash', 'stream' ),
array(
'post_title' => $post->post_title,
'post_type' => $post->post_type,
),
$post->ID,
array(
Expand Down

0 comments on commit 87caf70

Please sign in to comment.