Do you want to restrict registration to certain events to logged in members only but still have other events open to the public? If the answer to the above question is yes, then this extension is for you. This extension allows you to set a flag to any event so registration is restricted to those that have a current membership.
A custom data set called “Member only event?” Is created once this extension has been installed. The custom data has been set to be used for Events and the option “Is this Custom Data Set public?” is unchecked so that this information is not visible on the event info page. Some default Pre-form Help text has also been set which can be amended as required.
The extension also comes with a UI to set membership statuses for members that should be eligible to register for member only events. For example, only members with a membership status of new, current or grace will be authorised to register for member only events. You can also display a message to users that aren’t eligible to register for the event. Administer > CiviEvent > Member Only Event Settings
If the checkbox for “Is this a member only event?” has been set for a particular event, then users that are not eligible to register for the member only event will NOT see the Register Now button and will be presented with the message as set in the UI. If users manage to force themselves to the event registration page, then they will be redirected back to the event info page and displayed with the message as set in the UI
Extension page - https://civicrm.org/extensions/member-only-event