Title: Login mandatory
Last modified: April 30, 2018

---

# Login mandatory

 *  Resolved [ximenavin](https://wordpress.org/support/users/ximenavin/)
 * (@ximenavin)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/login-mandatory/)
 * Hi,
 * I need users to log in or create an account before they can register for an event.
   How can I do that?
    Regards.

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

 *  [Ed](https://wordpress.org/support/users/erishel/)
 * (@erishel)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/login-mandatory/#post-10248014)
 * Hey there **[@ximenavin](https://wordpress.org/support/users/ximenavin/)**,
 * Thanks for reaching out!
 * If you are using Event Tickets along with The Events Calendar, this can be done
   easily within the tickets settings.
 * If you are just using The Events Calendar, this can definitely be done but would
   require some PHP knowledge. The [Themer’s guide](https://theeventscalendar.com/knowledgebase/themers-guide/)
   would be a great place to start.
 * Hope that helps, take care!
    Ed
 *  Thread Starter [ximenavin](https://wordpress.org/support/users/ximenavin/)
 * (@ximenavin)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/login-mandatory/#post-10280308)
 * Hi Ed, thank you for your answer.
 * We are using The Events Calendar, I think we need to change something in the 
   single-event.php file. Can you tell me how to start? O were can we find the code?
 * Regards,
    -  This reply was modified 8 years, 1 month ago by [ximenavin](https://wordpress.org/support/users/ximenavin/).
 *  [Ed](https://wordpress.org/support/users/erishel/)
 * (@erishel)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/login-mandatory/#post-10282412)
 * You could try a snippet like the following to require users to login (this would
   need to be placed in your functions.php file):
 *     ```
       <?php
       /**
        * Default Events Template
        * This file is the basic wrapper template for all the views if 'Default Events Template'
        * is selected in Events -> Settings -> Template -> Events Template.
        *
        * Override this template in your own theme by creating a file at [your-theme]/tribe-events/default-template.php
        *
        * @package TribeEventsCalendar
        *
        */
   
       if ( ! defined( 'ABSPATH' ) ) {
       	die( '-1' );
       }
   
       get_header();
       ?>
   
        <?php if ( is_user_logged_in() ) {?>
   
       	<div id="tribe-events-pg-template">
       		<?php tribe_events_before_html(); ?>
       		<?php tribe_get_view(); ?>
       		<?php tribe_events_after_html(); ?>
       	</div> <!-- #tribe-events-pg-template -->
   
       	<?php } else { ?>
       		<p>Please log in to view calendar.</p>
       	<?php } ?>
   
       <?php
       get_footer(); ?>
       ```
   
 * This would be a good start and could definitely be tweaked to more suit your 
   needs. I’d also like to point out that one of our other plugins [Event Tickets](https://wordpress.org/plugins/event-tickets/)
   can be configured to do this as well.
 * Hope that helps!
 *  [Courtney Robertson](https://wordpress.org/support/users/courane01/)
 * (@courane01)
 * [7 years, 12 months ago](https://wordpress.org/support/topic/login-mandatory/#post-10411008)
 * Hey there! This thread has been inactive for a while so we’re going to go ahead
   and mark it Resolved. Please feel free to open a new thread if any other questions
   come up and we’d be happy to help. 🙂
 * Thanks
    Courtney 🙂

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

The topic ‘Login mandatory’ is closed to new replies.

 * ![](https://ps.w.org/the-events-calendar/assets/icon-256x256.gif?rev=2516440)
 * [The Events Calendar](https://wordpress.org/plugins/the-events-calendar/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/the-events-calendar/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/the-events-calendar/)
 * [Active Topics](https://wordpress.org/support/plugin/the-events-calendar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/the-events-calendar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/the-events-calendar/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [Courtney Robertson](https://wordpress.org/support/users/courane01/)
 * Last activity: [7 years, 12 months ago](https://wordpress.org/support/topic/login-mandatory/#post-10411008)
 * Status: resolved