Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)

  • Dreitausend
    Participant

    @jantenner

    Since I really like this code …

    
    <?php
    /*
    * Called by wp-content/themes/twentyten/plugins/events-manager/placeholders/attendees.php
    * Called by procedure described in /wp-content/plugins/events-manager/templates/placeholders/readme.txt
    *
    *
    * @Shonu
    * @Date 16/08/2011 11:45:19
    */
    showBookingsTable();
    ##########################################################################################################
    function showBookingsTable($attributes = array()){
       global $EM_Event;
       if(!$EM_Event || !$EM_Event->rsvp ) return;
       $lister     = $EM_Event->get_bookings(); ///$bookings->get( $args = array());//
       $bookerList = $lister->bookings;
       $wpCurrentUserObj = wp_get_current_user();
       $currentUserID = $wpCurrentUserObj->ID;
       $userProfile = "/wp-admin/user-edit.php?user_id=#ID#";
       $table .= "<tr>"
                            ."<th>Full Name</th>"
                            ."<th>Time registered</th>"
                            ."<th>Status</th>"
                            ."<th>Seats</th>"
                            ."<th>Comments</th>"
                   ."</tr>";
       //error_reporting(E_WARNING);
       foreach($bookerList as $EM_Booking)
       {
             $atendeesNo = $atendeesNo + $EM_Booking->spaces;
             if(0){
             echo "<pre>";
             print_r($EM_Booking);
             echo "</pre>";
             }
             $bookedUserID = $EM_Booking->person_id;//Not the user ID!! It is a ticket id or so
             $personObj = $EM_Booking->person;
    
             $userFirstname = $personObj->first_name;
             $userLastname  = $personObj->last_name;
             $userDispname  = $EM_Booking->person->display_name;
             if(0){
             echo "<pre>";
             print_r($personObj);
             echo "</pre>";
             }
             /* @var $EM_Booking EM_Booking */
             $aTRs = array();
             foreach( $EM_Booking->get_tickets_bookings() as $EM_Ticket_Booking)
             {
                /* @var $EM_Ticket EM_Ticket */
                /* @var $EM_Ticket_Booking EM_Ticket_Booking */
                $EM_Ticket = $EM_Ticket_Booking->get_ticket();
                $isCurrentUser = $bookedUserID == $currentUserID;
    
                $userName = "<span title='login or register to reveal'>*********</span>";
                if(is_user_logged_in()){
                   if($userLastname && $userFirstname)
                      $userName = $userFirstname . " " . $userLastname ;
                   else //if($userFirstname)
                      //$userName = $EM_Booking->person->display_name;
                      $userName = $userDispname;
                }
                $sorterStringPrefix = "<!-- ".$EM_Booking->timestamp."-->";
                //$userProfile = $currentUserID ? "<a href=\"".str_replace("#ID#", $currentUserID, $userProfile)."\">$userName</a>":$userName;
                $row = array(
                   //$EM_Booking->id,
                   $userName ,//. " [$bookedUserID = $currentUserID]"
                   //$EM_Booking->person->user_email,
                   //$EM_Booking->person->phone,
                   date('d.m.Y H:i', $EM_Booking->timestamp),
                   $EM_Booking->get_status(),
                   //$EM_Ticket->name,
                   $EM_Ticket_Booking->get_spaces(),
                   //$EM_Ticket_Booking->get_price(),
                   preg_replace("/<|>/", "-", $EM_Booking->comment)
                );
                //Display all values
                $newTR = $sorterStringPrefix."<tr ".($isCurrentUser ? "style='background-color:#FFFFDD;'":"")."><!-- $currentUserID === {$EM_Booking->id} -->\r\n";
                foreach($row as $value){
                   //$value = str_replace('"', '""', $value);
                   //$value = str_replace("=", "", $value);
                   //$file .= '"' .  preg_replace("/\n\r|\r\n|\n|\r/", ".     ", $value) . '",';
                   $newTR .= "\t<td>" .  $value . "</td>\r\n";
                }
                $newTR .= "</tr>\r\n";
                $aTRs[$EM_Booking->timestamp] = $newTR;
             }
    
             if(0)
                $table .= $newTR;
             else{
                natsort($aTRs);
                $table .= implode("", $aTRs);
             }
       }//booker list
       $table .= "<tr><th colspan='3' style='text-align:right'>Total Attendees so far</th><td><b>$atendeesNo</b></td></tr>";
       reset($bookerList);
       if(!$lister || !$bookerList)
          echo "<p><b>Sorry, nobody is yet attending...</b></p>";
       else
          echo "<table><caption><h3>People Attending</h3></caption>\r\n" . $table . "</table>";
    }
    ?>
    

    … I tried to implement your code-snippet into it. But since I’m not a programmer, I just can’t figure it out. So I’d be very happy if you could give me a hint 🙂


    Dreitausend
    Participant

    @jantenner

    Awesome! That did it! Thanks!
    Here is my new code:

    
    <?php
    
    /* @var $EM_Event EM_Event */
    $people = array();
    foreach($EM_Event->get_bookings() as $EM_Booking){
            $people[$EM_Booking->person->ID] = $EM_Booking->person;
    		$user_info = get_userdata($referring_user_id);
    }
    ?>
    
            <ul class="event-attendees">
            <?php foreach($people as $EM_Person): ?>
            <li>
            <?php $user_info = get_userdata($EM_Person->ID);
            echo get_avatar($EM_Person->ID, 50) . " " . $user_info->first_name . " " . $user_info->last_name . " " . $location = xprofile_get_field_data( 'Ort', $EM_Person->ID, $multi_format = 'comma' )  ;
            ?></li>
            <?php endforeach; ?>
    </ul>
    
Viewing 2 replies - 1 through 2 (of 2 total)
Skip to toolbar