mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-04-22 11:03:43 +03:00

Uses action hooks to capture relevant events as log entries on a per-pledge basis. This provides a running history of a pledge and can be used as an audit log if questions arise about changes to a pledge or there are weird bugs. Fixes #39
56 lines
1.1 KiB
PHP
56 lines
1.1 KiB
PHP
<?php
|
|
namespace WordPressDotOrg\FiveForTheFuture\View;
|
|
|
|
/** @var array $log */
|
|
?>
|
|
|
|
<div class="5ftf-activity-log">
|
|
<?php if ( ! empty( $log ) ) : ?>
|
|
|
|
<table class="striped widefat">
|
|
<thead>
|
|
<tr>
|
|
<td>Date</td>
|
|
<td>Entry</td>
|
|
<td>User</td>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ( $log as $entry ) : ?>
|
|
<tr>
|
|
<td>
|
|
<?php echo esc_html( date( 'Y-m-d H:i:s', $entry['timestamp'] ) ); ?>
|
|
</td>
|
|
<td>
|
|
<?php if ( ! empty( $entry['data'] ) ) : ?>
|
|
<details>
|
|
<summary>
|
|
<?php echo wp_kses_data( $entry['message'] ); ?>
|
|
</summary>
|
|
<pre><?php echo esc_html( print_r( $entry['data'], true ) ); ?></pre>
|
|
</details>
|
|
<?php else : ?>
|
|
<?php echo wp_kses_data( $entry['message'] ); ?>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td>
|
|
<?php
|
|
$user = get_user_by( 'id', $entry['user_id'] );
|
|
if ( $user ) : ?>
|
|
<?php echo sanitize_user( $user->user_login ); ?>
|
|
<?php endif; ?>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
|
|
<?php else : ?>
|
|
|
|
<p>
|
|
There are no log entries.
|
|
</p>
|
|
|
|
<?php endif; ?>
|
|
</div>
|