Displaying widget for only logged in users
-
Custom edit made to “classes\es-register.php”
This custom edit hides the widget from anyone not logged in and asks them to login or register
Hope someone finds it useful 🙂
<form class="es_widget_form"> <?php if ( is_user_logged_in() ) { ?> <?php global $current_user , $user_email; get_currentuserinfo(); ?> <?php if( $es_desc <> "" ) { ?> <div class="es_caption"><?php echo $es_desc; ?></div> <?php } ?> <div class="es_msg"><span id="es_msg"></span></div> <?php if( $es_name == "YES" ) { ?> <div class="es_lablebox"><?php _e('Name', 'email-subscribers'); ?></div> <div class="es_textbox"> <!-- WSP Edit --> <input class="es_textbox_class" name="es_txt_name" id="es_txt_name" value="<?PHP echo $current_user->display_name; ?>" maxlength="225" type="text"> </div> <?php } ?> <div class="es_lablebox"><?php _e('Email *', 'email-subscribers'); ?></div> <div class="es_textbox"> <input class="es_textbox_class" name="es_txt_email" id="es_txt_email" onkeypress="if(event.keyCode==13) es_submit_page('<?php echo $url; ?>')" value="<?PHP echo $user_email; ?>" maxlength="225" type="text"> </div> <div class="es_button"> <input class="es_textbox_button" name="es_txt_button" id="es_txt_button" onClick="return es_submit_page('<?php echo $url; ?>')" value="<?php _e('Subscribe', 'email-subscribers'); ?>" type="button"> </div> <?php if( $es_name != "YES" ) { ?> <input name="es_txt_name" id="es_txt_name" value="" type="hidden"> <?php } ?> <input name="es_txt_group" id="es_txt_group" value="<?php echo $es_group; ?>" type="hidden"> <? } else { echo 'If you would like to sing up for our newsletter please <a href="'.wp_registration_url().'">register</a> or <a href="'.wp_login_url().'">login</a>.';}; ?> </form>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Displaying widget for only logged in users’ is closed to new replies.