Forum Replies Created
-
AuthorPosts
-
Jeff
ParticipantThat got me on the right track. Here’s the code I used to sort events into different arrays based on which tickets each event had and then pass the php variables back to javascript for populating a drop down selector list with the dates for each seminar. Confusing to explain, but it’s what I needed to do.
<?php global $post; // Ensure the global $post variable is in scope global $product; $returnedArray = array(); $basicSeminarsArray = array(); $advancedSeminarsArray = array(); $endonasalSeminarsArray = array(); $basicadvancedSeminarsArray = array(); $masterclassSeminarsArray = array(); //$basicSeminarsArray = array("Jan 10, 2017 - New York, NY, USA - Basic Seminar", "Jan 20, 2017 - Madison, WI, USA - Basic Seminar", "Feb 12, 2017 - Austin, TX, USA - Basic Seminar"); $events = tribe_get_events( array( 'start_date' => date( '2017-01-01 12:00:00' ), 'end_date' => date( '2026-12-31 12:00:00' ), 'eventDisplay' => 'custom', 'posts_per_page' => -1 )); $todaysDate = date("Y-m-d H:i:s"); if ( empty( $events ) ) { //do something... } // Or we may have some to show else foreach( $events as $post ) { // setup_postdata( $post ); $event_id = get_the_ID(); $eventDate = tribe_get_end_date(null,true,"Y-m-d H:i:s"); $state = tribe_get_state(); if(empty($state)) { $locationStringJeff = tribe_get_city().', '.tribe_get_country(); } else { if (tribe_get_country()=='United States') { $locationStringJeff = tribe_get_city().', '.tribe_get_state().', USA'; } else { $locationStringJeff = tribe_get_city().', '.tribe_get_state().', '.tribe_get_country(); } } if(strpos(get_the_title(), "Convention")) { $wordConventionWasFound = true; } else { $wordConventionWasFound = false; } $position = strpos(get_the_title(), "–"); $title_text = substr(get_the_title(), 0, $position); $major_city_text = substr(get_the_title(), $position); //Ali wants to show the major city like Chicago so since this is already in the title why not... //echo $event_id; if (($eventDate >= $todaysDate) && (tribe_events_has_tickets()) && !$wordConventionWasFound) { $fullEventLayout = tribe_get_start_date(null,false,'M j').'-'.tribe_get_end_date(null,false, 'j, Y').' '.$major_city_text; $tickets_class = Tribe__Tickets__RSVP::get_instance(); $tickets = TribeEventsTickets::get_event_tickets( $event_id ); foreach ( $tickets as $ticket ) { if($ticket->name == "Basic") { array_push($basicSeminarsArray, $fullEventLayout); } elseif ($ticket->name == "Advanced") { array_push($advancedSeminarsArray, $fullEventLayout); } elseif ($ticket->name == "Endonasal") { array_push($endonasalSeminarsArray, $fullEventLayout); } elseif ($ticket->name == "Basicadvanced") { array_push($basicadvancedSeminarsArray, $fullEventLayout); } elseif ($ticket->name == "Masterclass") { array_push($masterclassSeminarsArray, $fullEventLayout); } } } } if ($product->post->post_title == "Basic Seminar") { $returnedArray = $basicSeminarsArray; } elseif ($product->post->post_title == "Advanced Seminar") { $returnedArray = $advancedSeminarsArray; } elseif ($product->post->post_title == "EndoNasal Seminar") { $returnedArray = $endonasalSeminarsArray; } elseif ($product->post->post_title == "Basic Seminar & Advanced Workshop") { $returnedArray = $basicadvancedSeminarsArray; } elseif ($product->post->post_title == "Master Class") { $returnedArray = $masterclassSeminarsArray; } ?> <script type="text/javascript"> jQuery(document).ready(function(){ //jQuery('input[name=doctors_name_1]').val("Bob Henry"); //jQuery('select[name=current_abc_level_1]').val("level1"); //alert("Hello"); var $el = jQuery('select[name=seminar_date_1]'); var $returnedArrayJS = <?php echo json_encode($returnedArray); ?>; //alert("Length: "+$eventArrayJS.length); jQuery.each($returnedArrayJS, function (i, event) { $el.append('<option value="'+event+'">'+event+'</option>'); }); }); </script>January 9, 2017 at 12:32 pm in reply to: Code to print out all events plus the tickets for each event all at once #1215285Jeff
ParticipantActually, we just decided today we’re not going to be using tickets so I don’t need you to answer this question. Thanks
Jeff
ParticipantYour question isn’t about Events Calendar, it’s about passing variables from a url via GET and then processing those variables in your php script. It’s very easy to do with a normal, non-wordpress, website. And the info can be found at: http://html.net/tutorials/php/lesson10.php
Again in a normal website you could have your url be like this:
/auctions/photo/list_events_page.php?start_date=2016-01-01&end_date=2016-12-31Then on the list_events_page.php page you would have code like this:
<?php
$start = $_GET[“start_date”]; //Pulls the info from the URL and puts it in the $start variable
$end = $_GET[“end_date”] //Same here
$events = tribe_get_events( array(
‘start_date’ => date($start),
‘end_date’ => date($end),
‘eventDisplay’ => ‘custom’,
‘posts_per_page’ => -1
));?>
Then use some of the other code above to display what you want from the events in the loop that I used to setup a nice looking tabular format for your information.However, you’re using WordPress which makes these variables within the url more of a hassle. I only looked into it briefly and here’s a link describing a few methods of passing these variables.
http://stackoverflow.com/questions/4586835/how-to-pass-extra-variables-in-url-with-wordpressHope this helps.
Jeff
ParticipantI wrote the code below to show events from the start to end of each year, then in the table I show all the events. However only the events which haven’t passed have hyperlinks to the event. The past events just show as text. I’m a complete newbie to this so I might be wrong in how I’m doing it, but it works. If Josh says ignore my code, then ignore it. You can also take out all the commented code. It was useful for me to learn so I left it in.
<div id="schedule"> <table border="0" cellpadding="3"> <tbody> <?php global $post; // Ensure the global $post variable is in scope $row = 0; $events = tribe_get_events( array( 'start_date' => date( '2016-01-01 12:00:00' ), 'end_date' => date( '2026-12-31 12:00:00' ), 'eventDisplay' => 'custom', 'posts_per_page' => -1 )); $todaysDate = date("Y-m-d H:i:s"); if ( empty( $events ) ) { echo 'Sorry, nothing found.'; } // Or we may have some to show else foreach( $events as $post ) { setup_postdata( $post ); //echo get_the_title( $post ) . '--Jeff'.tribe_get_start_date().'<br/>'; //echo "*".tribe_get_start_date(null,false, "Y-m-d H:i:s"); //$eventDate=get_post_meta($id,'_EventStartDate', "Y-m-d H:i:s"); //if ($eventDate >= $todayDate) { //echo "*"; //} if ($row%2 == 0) { echo "<tr class=\"opposite\">".PHP_EOL; } else { echo "<tr class=\"normal\">".PHP_EOL; } $eventDate = tribe_get_end_date(null,true,"Y-m-d H:i:s"); //echo $todaysDate." ".$eventDate; $state = tribe_get_state(); if(empty($state)) { $locationStringJeff = tribe_get_city().', '.tribe_get_country(); } else { if (tribe_get_country()=='United States') { $locationStringJeff = tribe_get_city().', '.tribe_get_state().', USA'; } else { $locationStringJeff = tribe_get_city().', '.tribe_get_state().', '.tribe_get_country(); } } if (tribe_events_has_tickets()) { $starString = "*"; $textColor = "#000000"; } else { $starString = ""; $textColor = "#777777"; } $position = strpos(get_the_title(), "–"); $title_text = substr(get_the_title(), 0, $position); //This removes text after the dash $major_city_text = substr(get_the_title(), $position); //Ali wants to show the major city like Chicago so since this is already in the title why not... if ($eventDate <= $todaysDate) { ?> <td class="date"><?php echo tribe_get_start_date(null,false,'M j').'-'.tribe_get_end_date(null,false, 'j, Y').$starString; ?></td><td class="location" style="color:<?php echo $textColor?>;"><?php echo $major_city_text ?></td><td class="level"><?php echo $title_text;?></td> <?php } else { ?> <td class="date"><a href="<?php echo esc_url( tribe_get_event_link() ); ?>" title="<?php the_title_attribute() ?>" rel="bookmark"><?php echo tribe_get_start_date(null,false,'M j').'-'.tribe_get_end_date(null,false, 'j, Y').$starString; ?></a></td><td class="location" style="color:<?php echo $textColor?>;"><?php echo $major_city_text ?></td><td class="level"><?php echo $title_text;?></td> <?php } //echo tribe_events_get_the_excerpt (); //Playing around with getting the text from the main event description -- This is a tribe event //echo the_content(); //Getting the text from the main event using WordPress function...allows html, but then also inserts images which I won't want in an RSVP email... echo "</tr>". PHP_EOL; $row++; } //php echo tribe_get_city().', '.tribe_get_state(); //echo $title_text; ?> </tbody> </table> </div>October 15, 2016 at 11:14 am in reply to: Email Obfuscation using antispambot() not working with tribe_get_organizer_email #1177233Jeff
ParticipantWait a minute. Did you automatically add the email obfuscation now so that I don’t need the extra code in the functions.php file? It appears as if that’s what happened. I like the feature, just wasn’t aware of it. Am I correct?
October 15, 2016 at 10:57 am in reply to: Email Obfuscation using antispambot() not working with tribe_get_organizer_email #1177232Jeff
ParticipantSorry, in the code before I forgot the semicolons. But adding them didn’t help and this code doesn’t work either:
“><?php echo esc_attr(tribe_get_organizer_email()); ?>October 13, 2016 at 8:59 am in reply to: Accessing Event Calendar variables in pages other than Event Calendar pages #1175958Jeff
ParticipantWonderful!!! Thank you very much.
October 11, 2016 at 7:11 pm in reply to: Accessing Event Calendar variables in pages other than Event Calendar pages #1175198Jeff
ParticipantWow, you’re right. I was able to paste this code into the tab indirectly which you can see here:
http://a82.dd7.myftpupload.com/product/basic-seminar-4#tab-description
Then click on the tab “RSVP Your Seminar Choice”
The code is below.So now in the loop I need to identify if the event has RSVP functionality added or not. This way I can separate events into two separate lists. The seminars that a person can RSVP to and the seminars where no RSVP tickets were set up in the event. I looked for a function that identified that, but didn’t have much luck. No need to look at the code below since it works. But I need to identify this distinction between the events.
<div id=”schedule”>
<table border=”0″ cellpadding=”3″>
<tbody>
<?php
echo “hello”;
global $post; // Ensure the global $post variable is in scope
$row = 0;
$events = tribe_get_events( array(
‘start_date’ => date( ‘2016-01-01 12:00:00’ ),
‘end_date’ => date( ‘2026-12-31 12:00:00’ ),
‘eventDisplay’ => ‘custom’,
‘posts_per_page’ => -1
));
$todaysDate = date(“Y-m-d H:i:s”);
if ( empty( $events ) ) {
echo ‘Sorry, nothing found.’;
}// Or we may have some to show
else foreach( $events as $post ) {
// setup_postdata( $post );
//echo get_the_title( $post ) . ‘–Jeff’.tribe_get_start_date().'<br/>’;
//echo “*”.tribe_get_start_date(null,false, “Y-m-d H:i:s”);
//$eventDate=get_post_meta($id,’_EventStartDate’, “Y-m-d H:i:s”);
//if ($eventDate >= $todayDate) {
//echo “*”;
//}
if ($row%2 == 0) {
echo “<tr class=\”opposite\”>”.PHP_EOL;
} else {
echo “<tr class=\”normal\”>”.PHP_EOL;
}
$eventDate = tribe_get_start_date(null,true,”Y-m-d H:i:s”);
//echo $todaysDate.” “.$eventDate;
$state = tribe_get_state();
if(empty($state)) {
$locationStringJeff = tribe_get_city().’, ‘.tribe_get_country();
} else {
if (tribe_get_country()==’United States’) {
$locationStringJeff = tribe_get_city().’, ‘.tribe_get_state().’, USA’;
} else {
$locationStringJeff = tribe_get_city().’, ‘.tribe_get_state().’, ‘.tribe_get_country();
}
}
$position = strpos(get_the_title(), “–”);
$title_text = substr(get_the_title(), 0, $position);if ($eventDate < $todaysDate) { ?>
<td class=”date”><?php echo tribe_get_start_date(null,false,’M j’).’-‘.tribe_get_end_date(null,false, ‘j, Y’); ?></td><td class=”location”><?php echo $locationStringJeff ?></td><td class=”level”><?php echo $title_text;?></td>
<?php
} else { ?>
<td class=”date”>” title=”<?php the_title_attribute() ?>” rel=”bookmark”><?php echo tribe_get_start_date(null,false,’M j’).’-‘.tribe_get_end_date(null,false, ‘j, Y’); ?></td><td class=”location”><?php echo $locationStringJeff ?></td><td class=”level”><?php echo $title_text;?></td>
<?php
}
echo “</tr>”. PHP_EOL;
$row++;
}
?>
</tbody>
</table>
</div>October 10, 2016 at 5:32 pm in reply to: Accessing Event Calendar variables in pages other than Event Calendar pages #1174716Jeff
ParticipantOr I could always make a stand alone php page with the short list of events that I’m talking about (dynamically generated however) and using iframe they could be put right into the tab with little trouble. Thing is what should that php look like without trying to just copy a wordpress event page with all the extra html in it that probably isn’t needed. Just need the basic layout I guess.
October 10, 2016 at 5:19 pm in reply to: Accessing Event Calendar variables in pages other than Event Calendar pages #1174711Jeff
ParticipantYes, completely recreate a simple list of events almost exactly as you see here:
http://a82.dd7.myftpupload.com/events
but have them within the tab of certain products. This might seem kind of dumb, but I want certain events in one tab and other events in another tab. Doctors will only pay for the events listed in the first tab and they’ll pay other people for the events listed in the second tab.I redid most of the code for the page I’ve given you the link to. I know it’s not what most people would want, but this works great for our situation. I wrote that code within an event calendar template which gets added to a full WordPress page with all the <script> tags that allow access the event calendar variables. When I compare the code for the events page given above I see a bunch of <script> tags for the event calendar plugin, but when I look in my store, only a few exist.
So I’m wondering if you’ve ran into this situation before. Where people wanted access to all the event calendar variables on pages other than your predefined pages. I can add shortcodes in the tabs, but not sure if your shortcodes will give me what I want.
I could also add script tags into headers using another plugin that allows anything to be added anywhere and with this plugin I could insert php into the tab using shortcodes as well. I haven’t tried this because I thought you might have a better idea.
Does this clarify things better?
Jeff
ParticipantThe problem is resolved. Kind of confusing because tickets pro doesn’t seem to have the rsvp.php file, but you might be correct, that I copied the template while having tickets pro activated. Don’t know, but I copied the latest rsvp.php from tickets basic and works great. Thanks
Jeff
ParticipantWell I purchased Event Tickets Plus as well, but it is deactivated. I don’t need the purchasing ability anymore since I’m doing our seminars in the store directly without ticketing since there are so many options for pricing.
So are you saying the whole Attendee list thing is just an Event Tickets Plus thing? Could I have copied a file and then templated it from the Events Tickets Plus and that’s why this option is showing up for me? I did play around a long time before I decided not to use it. Maybe that’s why I have the code. Possible?
Jeff
ParticipantI’m just being cautious here because I don’t want attendees emails scanned by robots. An example event is here: http://a82.dd7.myftpupload.com/event/basic-advanced-endonasal-cranial-correction-seminar-chicago-illinois
When you add a ticket the part opens up about Not listing on the Public List. I found where to remove this code so that’s not the concern and I will remove it after I hear back from you. But since I’m not going to allow people to see this part, and therefore check the box that they don’t want to be on a public list, I was concerned that they would be automatically added to this mysterious public list for the world to see.
I’ve modified the template files to a moderate degree and probably removed this public list anyway. You’ll see by going back to All Events how much I’ve changed the code through templates. I realize there’s the administrator only available list which no one can see.
So since I never saw this public list in the first place I’m just making sure it isn’t showing someplace else where webbots could find the list.
Do you think I’m good to go?
October 4, 2016 at 6:45 pm in reply to: What file does the text FREE get generated in this screen #1172532Jeff
ParticipantWorked great. Kind of confusing at times what all the different files do. Thanks for your help.
-
AuthorPosts
