Opal-Estate-Pro/templates/user/messages.php

54 lines
2.2 KiB
PHP
Raw Normal View History

2020-05-21 12:08:16 +02:00
<?php
$args = [
'cpage' => isset( $_GET['cpage'] ) ? abs( (int) $_GET['cpage'] ) : 1,
'items_per_page' => 10,
];
$messages = opalestate_get_message_by_user( $args );
2019-09-10 06:27:33 +02:00
?>
<div class="opalestate-admin-box">
2020-05-21 12:08:16 +02:00
<h3 class="page-title"><?php echo sprintf( esc_html__( 'Messages for you', 'opalestate-pro' ), '' ); ?></h3>
<div class="opalestate-messages-list">
<div class="message-item">
<table>
<?php foreach ( $messages['items'] as $message ): ?>
<tr>
<td width="220">
<img src="<?php echo OpalEstate_User::get_author_picture( $message->sender_id ); ?>" width="60" alt="<?php esc_attr_e( 'User Avatar', 'opalestate-pro' ); ?>"/>
<?php if ( $message->sender_id ) : ?>
<span><?php echo opalestate_user_fullname( $message->sender_id ); ?></span>
<?php endif; ?>
<?php if ( isset( $message->name ) && $message->name ) : ?>
<span><?php echo esc_html( $message->name ); ?></span>
<?php endif; ?>
<div><?php echo esc_html( $message->sender_email ); ?></div>
<div><?php echo esc_html( $message->phone ); ?></div>
</td>
<td>
<a href="<?php echo opalestate_get_read_message_uri( $message->id ); ?>">
<h6><?php echo esc_html( $message->subject ); ?></h6>
<p><?php echo esc_html( $message->message ); ?></p>
</a>
</td>
<td width="200"><code><?php echo esc_html( $message->created ); ?></code></td>
</tr>
2019-09-10 06:27:33 +02:00
<?php endforeach; ?>
2020-05-21 12:08:16 +02:00
</table>
</div>
<div class="opalestate-pagination pagination-main">
<?php
echo paginate_links( [
'base' => add_query_arg( 'cpage', '%#%' ),
'format' => '',
'prev_text' => esc_html__( '&laquo;' ),
'next_text' => esc_html__( '&raquo;' ),
'total' => ceil( $messages['total'] / $args['items_per_page'] ),
'current' => $args['cpage'],
] );
2019-09-10 06:27:33 +02:00
?>
2020-05-21 12:08:16 +02:00
</div>
</div>
2019-09-10 06:27:33 +02:00
</div>