Viewing 1 replies (of 1 total)
  • Thread Starter brayandelmondes

    (@brayandelmondes)

    /**
    * I solved it myself, just replace the code in the file (class-points-shortcodes).
    */

    public static function points_user_points_details ( $atts, $content = null ) {
    $options = shortcode_atts(
    array(
    ‘user_id’ => ”,
    ‘items_per_page’ => 10,
    ‘order_by’ => ‘point_id’,
    ‘order’ => ‘DESC’,
    ‘description’ => true
    ),
    $atts
    );
    extract( $options );

    if ( is_string( $description ) && ( ( $description == ‘0’ ) || ( strtolower( $description ) == ‘false’ ) ) ) {
    $description = false;
    }

    $desc_th = ”;
    if ( $description ) {
    $desc_th = ‘<th>’ . __( ‘Description’, ‘points’ ) . ‘</th>’;
    }

    $user_id = get_current_user_id();
    $points = Points::get_points_by_user( $user_id, null, $order_by, $order, OBJECT );

    // Pagination
    $total = sizeof( $points );
    $page = isset( $_GET[‘cpage’] ) ? abs( (int) $_GET[‘cpage’] ) : 1;
    $offset = ( $page * $items_per_page ) – $items_per_page;
    $totalPage = ceil($total / $items_per_page);

    $points = Points::get_points_by_user( $user_id, $items_per_page, $order_by, $order, OBJECT, $offset );

    $output = ‘<table class=”points_user_points_table”>’ .
    ‘<tr>’ .
    ‘<th>’ . ucfirst( Points::get_label( 100 ) ) . ‘</th>’ .
    $desc_th .
    ‘</tr>’;

    if ( $user_id !== 0 ) {
    if ( sizeof( $points ) > 0 ) {
    foreach ( $points as $point ) {
    $desc_td = ”;
    if ( $description ) {
    $desc_td = ‘<td>’ . $point->description . ‘</td>’;
    }
    $output .= ‘<tr>’ .

    ‘<td>’ . $point->points . ‘</td>’ .
    $desc_td .
    ‘</tr>’;
    }
    }
    }

    $output .= ‘</table>’;

Viewing 1 replies (of 1 total)
  • The topic ‘how to remove datetime and type fields?’ is closed to new replies.