Update :
I thought about this and I could just edit the actual post template so that certain information is displayed for non members and logged in users see more info – but I am not 100% sure how to do it.
I have the following code in my event-single.php file :
<?php
global $EM_Event;
/* @var $EM_Event EM_Event */
if ( is_user_logged_in() ) {
echo $EM_Event->output_single();
} else {
echo "user is logged OUT";
}
?>
The echo $EM_Event->output_single(); shows everything about the event which is what I want, but for the users that are not logged in I want to show everything EXCEPT the Booking information.
Any help on this please?
That looks good – but don’t edit the original file. That’ll get overwritten with plugin updates.
Instead, copy the event-single.php file that’s in
/plugins/events-manager/templates/templates
to
/plugins/events-manager/templates/
within your theme folder (you may need to create these folders).
The edits you make to that file will be preserved on plugin upgrades.
Thanks and just to clarify I have copied it to the relevant folder in my child theme, so I am not working on the original file.
My issue is displaying only the relevant info. I want to display the event the same way $EM_Event->output_single(); does, except I don’t want the Booking part of the event.
You mean you don’t want to show the booking form?
Yes. Currently it shows the Event title, Date, Location, Category and then the heading Bookings with the bookings form. I don’t want to show the Bookings part to users that are not logged in.
how about using conditional placeholder in your formatting > events > default single event format
e.g.
{has_bookings}
{logged_in}
<h3>Bookings</h3>
#_BOOKINGFORM
{/logged_in}
{/has_bookings}
*if nested conditional placeholder doesn’t work, you have to manually this record to your wp_options table:
option_name = dbem_conditional_recursions
option_value = 2
you could do this e.g. with the adminer plugin or phpmyadmin
agelonwl – Thanks for the reply.
My problem is not the conditional coding, my problem is that I don’t know how to format the logged in part of the code or I am not sure I understand what you meant here with your example code.
$EM_Event->output_single(); – This gives me all the details. I just need the code that will give me the same details without the Booking section.
I am a bit of a hacker when it comes to coding. I find my way through it but don’t always understand everything 🙂 Maybe just an example of a custom Events page will also help so I can see how to pull event information from the DB.
Thanks
$EM_Event->output_single(); – This gives me all the details. I just need the code that will give me the same details without the Booking section.
you need to wrapped the event details inside {logged_in}content here..{/logged_in} if you want to hide some details e.g. booking form/section to guest users and show all the details to logged-in users and since $EM_Event->output_single() format can be formatted using settings > formatting > events > default single event format
Ok… I THINK I get what you are telling me 🙂 This is indeed a much simpler solution than what I thought, no wonder I was so confused. I expected coding etc, but just changing settings makes sense.
I will give this a go and let you know.
THANK YOU!!
no problem, just ask if you have any further question.
Ok… I am starting to understand the Evnet Manager Formatting a bit better but is there a place where I can see some of the function calls like the {logged_in} etc? I found all the #_EVENT tags to use, but I need more help with the {loggede_in} etc.
As soon as I add the {logged_in}….{/logged_in}, it removes the Booking part for both logged in and logged out users. Can I use php inside the formatting window?
I got it working! THANKS!
Not sure what was wrong before but I added the {not_logged_in} tag as well and now it works.
Thanks again!