Created
November 11, 2020 02:01
-
-
Save chikaibeneme/931f2936754b7a2a329566a3beddaddd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function cmdm_private_event( $content ) | |
| { | |
| global $post; | |
| $cmdm_content = ''; | |
| $cmdm_private = false; | |
| $cmdmc_post_types = array( 'tribe_events' ); | |
| if ( function_exists( 'tribe_get_custom_fields' ) ) | |
| { | |
| $additional_fields = tribe_get_custom_fields(); | |
| if ( isset($additional_fields['Privado']) && $additional_fields['Privado'] == 'Si' ) $cmdm_private = true ; | |
| } | |
| if ( in_array( $post->post_type, $cmdmc_post_types ) && $cmdm_private && !is_user_logged_in() ) | |
| { | |
| $cmdm_content .= ' | |
| <div class="et_pb_module et_pb_text et_pb_text_1 et_pb_text_align_left et_pb_bg_layout_light"> | |
| <div class="et_pb_text_inner"> | |
| <div style="width: auto; margin-bottom: 20px;"> | |
| <h2 style="margin-bottom: 0; font-size: 1.5em;">' . __('Private event','quofitness') . '</h2> | |
| <p>' . __('Please, login in order to attend this event.','quofitness') . '</p> | |
| </div> | |
| <div style="width: auto; border-bottom: 1px solid #cc0000; border-top: 1px solid #cc0000;"> | |
| <div id="login-code-container" style="margin: 20px auto; padding: 20px 20px 20px; max-width: 360px; background-color: #eee; border: 1px solid #ccc;"> | |
| <form name="loginform" id="loginform" action="/wp-login.php" method="post"> | |
| <input type="hidden" name="redirect_to" value="' . get_permalink( $post->ID ) . '"> | |
| <p class="login-username"><label for="user_login">' . __('Username or email','quofitness') . '</label> | |
| <input type="text" name="log" id="user_login" class="et_pb_contact_message input" value="" size="20"></p> | |
| <p class="login-password"><label for="user_pass">' . __('Password','quofitness') . '</label> | |
| <input type="password" name="pwd" id="user_pass" class="et_pb_contact_message input" value="" size="20"></p> | |
| <p class="login-submit"> | |
| <input type="submit" name="wp-submit" id="wp-submit" class="et_pb_contact_submit et_pb_button" value="' . __('Login','quofitness') . '"></p> | |
| </form> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| '; | |
| return $cmdm_content; | |
| } | |
| else | |
| { | |
| return $content; | |
| } | |
| } | |
| add_filter( 'the_content', 'cmdm_private_event' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment