LLMS_Meta_Box_Order_Notes::output()
Function to field WP::output() method call Passes output instruction to parent
Contents
Return Return
(void)
Source Source
File: includes/admin/post-types/meta-boxes/class.llms.meta.box.order.notes.php
public function output() {
$order = new LLMS_Order( $this->post );
$curr_page = isset( $_GET['notes-page'] ) ? absint( wp_unslash( $_GET['notes-page'] ) ) : 1;
$per_page = 10;
$edit_link = get_edit_post_link( $this->post->ID );
$notes = $order->get_notes( $per_page, $curr_page );
$next_page = ( count( $notes ) == $per_page ) ? count( $order->get_notes( $per_page, $curr_page + 1 ) ) : 0;
$prev_url = ( $curr_page > 1 ) ? add_query_arg( 'notes-page', $curr_page - 1, $edit_link ) . '#' . $this->id : false;
$next_url = ( $next_page ) ? add_query_arg( 'notes-page', $curr_page + 1, $edit_link ) . '#' . $this->id : false;
if ( $notes ) {
echo '<ul class="llms-order-notes">';
foreach ( $notes as $note ) {
?>
<li class="llms-order-note" id="llms-order-note-<?php echo $note->comment_ID; ?>">
<div class="llms-order-note-content"><?php echo wpautop( get_comment_text( $note->comment_ID ) ); ?></div>
<div class="llms-order-note-meta">
<?php printf( _x( 'by %s', 'order note author', 'lifterlms' ), get_comment_author( $note->comment_ID ) ); ?>
<?php printf( _x( 'on %s', 'order note date', 'lifterlms' ), get_comment_date( 'M j, Y h:i a', $note->comment_ID ) ); ?>
</div>
</li>
<?php
}
echo '</ul>';
if ( ! empty( $prev_url ) || ! empty( $next_url ) ) {
echo '<hr>';
}
if ( ! empty( $prev_url ) ) {
echo '<a class="button" href="' . $prev_url . '">' . sprintf( __( '%s Newer', 'lifterlms' ), '«' ) . '</a> ';
}
if ( ! empty( $next_url ) ) {
echo '<a class="button" href="' . $next_url . '">' . sprintf( __( 'Older %s', 'lifterlms' ), '»' ) . '</a>';
}
} else {
_e( 'No order notes found.', 'lifterlms' );
}// End if().
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.35.0 | Verify nonces and sanitize $_POST data. |
| 3.0.0 | Introduced. |