0

I recently inherited and transferred a wordpress website that contains various custom plugins. Everything seems to be working correctly except one link in the admin section assocaited with a plugin. The page comes up blank when the link is clicked when it should list all bookings. There are no syntax errors.

I know this is a long shot, but I was wondering if anybody can notice any problems with the below function that handles the page? Any insight would be greatly appreciated.

/**
 *  List all bookings
 */
function admin_list_bookings($class_id = false, $wrapper=true) {
    global $ae_EventManager;
    // View single?
    if (isset($_GET['view_booking']) && is_numeric($_GET['view_booking'])) {    $this->admin_view_booking($_GET['view_booking']); return; }
    // Delete posts?
    if (isset($_POST['DeleteLogs']) && !empty($_POST['sel_bookings']) && is_array($_POST['sel_bookings'])) {
        foreach ($_POST['sel_bookings'] as $delete_id) {
            wp_delete_post($delete_id, true);
        }
        echo '<div class="updated"><p>Selected logs have been deleted.</p></div>'."\n";
    }
    // Load all bookings
    $booking_log_type = 'private';
    if (isset($_GET['logtype']))    $booking_log_type = 'any';
    $bookings = get_posts(array(
        'post_type'     => $this->booking_type,
        'numberposts'   => -1,
        'post_status'   => $booking_log_type,
        'post_parent'   => (is_numeric($class_id) ? $class_id : false),
    ));

    // Output
    if ($wrapper) {
    echo '<div class="wrap">'."\n";
    echo '<h2>View Class Bookings</h2>'."\n";
    echo '<form class="plugin_settings" method="post" action="'.esc_url($_SERVER['REQUEST_URI']).'">'."\n";
    echo wp_nonce_field($this->nonce);
    }
    ?>
    <table class="widefat">
      <thead><tr><?php if ($wrapper) {  ?><th><input type="checkbox" id="check_all" /></th><?php    }   ?>
        <th>Date</th><th>Class</th><th>Name</th><th># Seats</th><th>Booking Cost</th><th>Status</th></tr></thead>
      <tbody>
    <?php
    foreach ($bookings as $booking) {
        $booking->post_content = $this->__unserialize($booking->post_content);
        $log = $booking->post_content;
    //          echo '<pre>'; print_r($booking); echo '</pre>';
        $view_link = 'edit.php?post_type='.$ae_EventManager->course_type.'&page&view_booking='.$booking->ID;
        ?>
        <tr>
            <?php   if ($wrapper) {     ?>
            <td class="ctrl"><input type="checkbox" name="sel_bookings[]" value="<?php echo $booking->ID; ?>" /></td>
            <?php   }                   ?>
            <td><a href="<?php echo $view_link; ?>"><?php echo $this->format_time_ago($booking->post_date); ?></a></td>
            <td><?php echo $log['course_name'].'<br />'.date('d-m-Y H:ia', strtotime($log['class_date'].' '.$log['class_time'])); ?></td>
            <td><?php echo $log['tickets'][0]['firstname'].' '.$log['tickets'][0]['lastname']; ?></td>
            <td><?php echo $log['number_seats']; ?></td>
            <td><?php echo '$'.number_format($log['transaction_total'], 2); ?></td>
            <td><?php echo $log['payment_method'].'<br />'.$log['eway_response']['ResponseMessage']; ?></td>
        </tr>
        <?php
    }
    ?>
1
  • This is a shot in the dark as there are countless possibilities. First, try turning on WP Debug. If this is happening due to a PHP error (which I bet that it is), you will be able to see what's going on and fix the error. Also admin_menu() and admin_enqueue() are too easily common names for functions, which could be throwing a Fatal error: Cannot redeclare admin_menu() [...] or such. Commented Feb 14, 2014 at 2:35

1 Answer 1

1

Just add a closing curly bracket } at the end of admin_list_bookings function

Sign up to request clarification or add additional context in comments.

2 Comments

Unless he copied & pasted incorrectly, this ought to do it.
Sorry, I did paste incorrectly.. there are no syntax errors.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.