LLMS_Meta_Box_Order_Notes::output()

Function to field WP::output() method call Passes output instruction to parent


Return Return

(void)


Top ↑

Source Source

File: includes/admin/post-types/meta-boxes/class.llms.meta.box.order.notes.php

60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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' ), '&laquo;' ) . '</a> ';
        }
 
        if ( ! empty( $next_url ) ) {
            echo '<a class="button" href="' . $next_url . '">' . sprintf( __( 'Older %s', 'lifterlms' ), '&raquo;' ) . '</a>';
        }
    } else {
 
        _e( 'No order notes found.', 'lifterlms' );
 
    }// End if().
 
}

Top ↑

Changelog Changelog

Changelog
Version Description
3.35.0 Verify nonces and sanitize $_POST data.
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.