Skip to content

Commit

Permalink
Prevent date from being displayed twice in the Recently Added/Modifie…
Browse files Browse the repository at this point in the history
…d Dashboard admin widgets.
  • Loading branch information
shazahm1 committed Jan 29, 2024
1 parent 9e36961 commit a95f9d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions templates/dashboard-recent-added/dashboard-recent-added.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,15 @@ public static function card( $entry, $template, $atts ) {

if ( is_admin() ) {

$dateFormat = "{$atts['date_format']} g:ia";
$editTokenURL = _nonce::url( 'admin.php?page=connections_manage&cn-action=edit_entry&id=' . $entry->getId(), 'entry_edit', $entry->getId() );

if ( current_user_can( 'connections_edit_entry' ) ) {

echo '<span class="cn-entry-name"><a class="row-title" title="', esc_attr( "Edit {$entry->getName()}" ), '" href="', esc_url( $editTokenURL ), '"> ', esc_html( $entry->getName() ) . '</a></span> <span class="cn-list-date">', esc_html( $entry->getDateAdded( $dateFormat ) ), '</span>';
echo '<span class="cn-entry-name"><a class="row-title" title="', esc_attr( "Edit {$entry->getName()}" ), '" href="', esc_url( $editTokenURL ), '"> ', esc_html( $entry->getName() ) . '</a></span> <span class="cn-list-date">', esc_html( $entry->getDateAdded( $atts['date_format'] ) ), '</span>';

} else {

echo '<span class="cn-entry-name">', esc_html( $entry->getName() ), '</span> <span class="cn-list-date">', esc_html( $entry->getDateAdded( $dateFormat ) ), '</span>';
echo '<span class="cn-entry-name">', esc_html( $entry->getName() ), '</span> <span class="cn-list-date">', esc_html( $entry->getDateAdded( $atts['date_format'] ) ), '</span>';
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,15 @@ public static function card( $entry, $template, $atts ) {

if ( is_admin() ) {

$dateFormat = "{$atts['date_format']} g:ia";
$editTokenURL = _nonce::url( 'admin.php?page=connections_manage&cn-action=edit_entry&id=' . $entry->getId(), 'entry_edit', $entry->getId() );

if ( current_user_can( 'connections_edit_entry' ) ) {

echo '<span class="cn-entry-name"><a class="row-title" title="', esc_attr( 'Edit ' . $entry->getName() ), '" href="', esc_url( $editTokenURL ), '"> ', esc_html( $entry->getName() ) . '</a></span> <span class="cn-list-date">', esc_html( $entry->getFormattedTimeStamp( $dateFormat ) ), '</span>';
echo '<span class="cn-entry-name"><a class="row-title" title="', esc_attr( 'Edit ' . $entry->getName() ), '" href="', esc_url( $editTokenURL ), '"> ', esc_html( $entry->getName() ) . '</a></span> <span class="cn-list-date">', esc_html( $entry->getFormattedTimeStamp( $atts['date_format'] ) ), '</span>';

} else {

echo '<span class="cn-entry-name">', esc_html( $entry->getName() ), '</span> <span class="cn-list-date">', esc_html( $entry->getFormattedTimeStamp( $dateFormat ) ), '</span>';
echo '<span class="cn-entry-name">', esc_html( $entry->getName() ), '</span> <span class="cn-list-date">', esc_html( $entry->getFormattedTimeStamp( $atts['date_format'] ) ), '</span>';
}

}
Expand Down

0 comments on commit a95f9d2

Please sign in to comment.