Theme My Login - Version 1.1.0

Version Description

Download this release

Release Info

Developer jfarthing84
Plugin Icon 128x128 Theme My Login
Version 1.1.0
Comparing to
See all releases

Code changes from version 1.0.1 to 1.1.0

Files changed (2) hide show
  1. readme.txt +11 -11
  2. theme-my-login.php +254 -2
readme.txt CHANGED
@@ -1,17 +1,17 @@
1
  === Theme My Login ===
2
  Contributors: jfarthing84
3
  Donate link: http://webdesign.jaedub.com
4
- Tags: wordpress, login, register, theme, form
5
  Requires at least: 2.5
6
  Tested up to: 2.5
7
- Stable tag: 1.1
8
 
9
- This plugin makes your registration and login pages look just like the rest of your website.
10
 
11
 
12
  == Description ==
13
 
14
- This plugin makes your registration and login pages look just like the rest of your website by replacing the wp-login.php page with a function that includes the header files, footer files, and all of the HTML in between that you specify in the 'Theme My Login' settings.
15
 
16
 
17
  == Installation ==
@@ -28,13 +28,15 @@ Upload the Theme My Login plugin to your 'wp-content/plugins' directory and acti
28
 
29
  5. Forgot Password Text - You can change this to whatever text you want to appear above your forgot password form. This defaults to 'Forgot Password'.
30
 
31
- 6. Template Header Files - Enter each header file used in your template, one per line. Typically, this is only header.php, but you can figure this out by clicking Appearance->Editor->Main Index Template. If the only function call you see is get_header() before the HTML then it's likely this is the only file you need to enter.
32
 
33
- 7. Template HTML After Header - Enter the HTML that appears between the get_header() function and the page code. You can probably figure this out by clicking Appearance->Editor->Main Index Template. The HTML you need to copy is everything between the last ?> in the top of the file and the line that looks something like this: <?php endif; ?> and the line that may look like this: <?php get_sidebar(); ?>. Keep in mind that if you are using a template that doesn't fit the typical scheme, you will need to experiment a bit to get this right.
34
 
35
- 8. Template HTML Before Footer - Enter the HTML that appears between the page code and the get_sidebar()/get_footer() functions. You can probably figure this out by clicking Appearance->Editor->Main Index Template. The HTML you need to copy is everything between the last ?> in the top of the file and the line that looks something like this: <?php if (have_posts()) : ?>. Keep in mind that if you are using a template that doesn't fit the typical scheme, you will need to experiment a bit to get this right.
36
 
37
- 9. Template Footer Files - Enter each footer file used in your template, one per line. Typically this is sidebar.php and footer.php. You can figure this out by clicking Appearance->Editor->Main Index Template. If you see the function calls get_sidebar() and get_footer() then you should be able to leave the defaults alone.
 
 
38
 
39
  Now you can save your changes and go test out your new themed login and registration pages. That's all!
40
 
@@ -43,6 +45,4 @@ Now you can save your changes and go test out your new themed login and registra
43
 
44
  * 1.0.0 - 2009-03-13 - Initial release version
45
  * 1.0.1 - 2009-03-14 - Made backwards compatible to WordPress 2.5+
46
-
47
-
48
- http://webdesign.jaedub.com
1
  === Theme My Login ===
2
  Contributors: jfarthing84
3
  Donate link: http://webdesign.jaedub.com
4
+ Tags: wordpress, login, register, theme, form, james kelly
5
  Requires at least: 2.5
6
  Tested up to: 2.5
7
+ Stable tag: 1.1.0
8
 
9
+ This plugin themes the WordPress login, register, forgot password and profile pages to look like the rest of your website.
10
 
11
 
12
  == Description ==
13
 
14
+ This plugin themes the WordPress login, register, forgot password and profile pages to look like the rest of your website. It replaces the wp-login.php and profile.php pages with functions that render your theme settings as specified in your WordPress administration panel under Settings->Theme My Login.
15
 
16
 
17
  == Installation ==
28
 
29
  5. Forgot Password Text - You can change this to whatever text you want to appear above your forgot password form. This defaults to 'Forgot Password'.
30
 
31
+ 6. Profile Text - You can change this to whatever text you want to appear above the user profile form. This defaults to 'Your Profile'.
32
 
33
+ 7. Template Header Files - Enter each header file used in your template, one per line. Typically, this is only header.php, but you can figure this out by clicking Appearance->Editor->Main Index Template. If the only function call you see is get_header() before the HTML then it's likely this is the only file you need to enter.
34
 
35
+ 8. Template HTML After Header - Enter the HTML that appears between the get_header() function and the page code. You can probably figure this out by clicking Appearance->Editor->Main Index Template. The HTML you need to copy is everything between the last ?> in the top of the file and the line that looks something like this: <?php endif; ?> and the line that may look like this: <?php get_sidebar(); ?>. Keep in mind that if you are using a template that doesn't fit the typical scheme, you will need to experiment a bit to get this right.
36
 
37
+ 9. Template HTML Before Footer - Enter the HTML that appears between the page code and the get_sidebar()/get_footer() functions. You can probably figure this out by clicking Appearance->Editor->Main Index Template. The HTML you need to copy is everything between the last ?> in the top of the file and the line that looks something like this: <?php if (have_posts()) : ?>. Keep in mind that if you are using a template that doesn't fit the typical scheme, you will need to experiment a bit to get this right.
38
+
39
+ 10. Template Footer Files - Enter each footer file used in your template, one per line. Typically this is sidebar.php and footer.php. You can figure this out by clicking Appearance->Editor->Main Index Template. If you see the function calls get_sidebar() and get_footer() then you should be able to leave the defaults alone.
40
 
41
  Now you can save your changes and go test out your new themed login and registration pages. That's all!
42
 
45
 
46
  * 1.0.0 - 2009-03-13 - Initial release version
47
  * 1.0.1 - 2009-03-14 - Made backwards compatible to WordPress 2.5+
48
+ * 1.1.0 - 2009-03-14 - Added custom profile to completely hide the back-end from subscribers
 
 
theme-my-login.php CHANGED
@@ -2,8 +2,8 @@
2
  /*
3
  Plugin Name: Theme My Login
4
  Plugin URI: http://webdesign.jaedub.com/wordpress-plugins/theme-my-login-plugin
5
- Description: This plugin creates custom login and register pages to replace the wp-login and wp-register pages.
6
- Version: 1.0.1
7
  Author: Jae Dub
8
  Author URI: http://webdesign.jaedub.com
9
 
@@ -13,6 +13,8 @@ Version History
13
  Initial release version
14
  1.0.1 - 2009-03-14
15
  Made backwards compatible to WordPress 2.5+
 
 
16
 
17
  */
18
 
@@ -32,6 +34,9 @@ if (!class_exists('ThemeMyLogin')) {
32
  add_action('init', array(&$this, 'Init'));
33
  add_action('admin_menu', array(&$this, 'AddAdminPage'));
34
 
 
 
 
35
  $this->LoadOptions();
36
  }
37
 
@@ -56,6 +61,7 @@ if (!class_exists('ThemeMyLogin')) {
56
  $this->options['tml_login_text'] = 'Log In';
57
  $this->options['tml_register_text'] = 'Register';
58
  $this->options['tml_password_text'] = 'Reset Password';
 
59
  }
60
 
61
  # Loads options from database
@@ -131,6 +137,7 @@ if (!class_exists('ThemeMyLogin')) {
131
  $this->SetOption('login_text', stripslashes($_POST['login_text']));
132
  $this->SetOption('register_text', stripslashes($_POST['register_text']));
133
  $this->SetOption('password_text', stripslashes($_POST['password_text']));
 
134
  $this->SetOption('login_redirect', stripslashes($_POST['login_redirect']));
135
  $this->SetOption('logout_redirect', stripslashes($_POST['logout_redirect']));
136
  $this->SetOption('header_html', stripslashes($_POST['header_html']));
@@ -142,6 +149,9 @@ if (!class_exists('ThemeMyLogin')) {
142
  } //end if
143
 
144
  ?>
 
 
 
145
  <div class="wrap">
146
  <?php if ( strlen($success) > 0 ) { ?>
147
  <div id="message" class="updated fade">
@@ -194,6 +204,13 @@ if (!class_exists('ThemeMyLogin')) {
194
  <span class="setting-description">This will appear above the forgot password form.</span>
195
  </td>
196
  </tr>
 
 
 
 
 
 
 
197
  <tr valign="top">
198
  <th scope="row"><label for="login_redirect">Template Header Files</label></th>
199
  <td>
@@ -238,6 +255,12 @@ if (!class_exists('ThemeMyLogin')) {
238
  $this->DoLogin();
239
  break;
240
  }
 
 
 
 
 
 
241
  }
242
 
243
  function DoHeader($title = 'Log In', $message = '', $wp_error = '') {
@@ -544,6 +567,235 @@ if (!class_exists('ThemeMyLogin')) {
544
  break;
545
  endswitch;
546
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
547
  }
548
  }
549
 
2
  /*
3
  Plugin Name: Theme My Login
4
  Plugin URI: http://webdesign.jaedub.com/wordpress-plugins/theme-my-login-plugin
5
+ Description: Themes the WordPress login, register, forgot password and profile pages to look like the rest of your website.
6
+ Version: 1.1.0
7
  Author: Jae Dub
8
  Author URI: http://webdesign.jaedub.com
9
 
13
  Initial release version
14
  1.0.1 - 2009-03-14
15
  Made backwards compatible to WordPress 2.5+
16
+ 1.1.0 - 2009-03-14
17
+ Added custom profile to completely hide the back-end from subscribers
18
 
19
  */
20
 
34
  add_action('init', array(&$this, 'Init'));
35
  add_action('admin_menu', array(&$this, 'AddAdminPage'));
36
 
37
+ if ( !isset($_POST['from']) && $_POST['from'] != 'profile' )
38
+ add_action('load-profile.php', array(&$this, 'DoProfile'));
39
+
40
  $this->LoadOptions();
41
  }
42
 
61
  $this->options['tml_login_text'] = 'Log In';
62
  $this->options['tml_register_text'] = 'Register';
63
  $this->options['tml_password_text'] = 'Reset Password';
64
+ $this->options['tml_profile_text'] = 'Your Profile';
65
  }
66
 
67
  # Loads options from database
137
  $this->SetOption('login_text', stripslashes($_POST['login_text']));
138
  $this->SetOption('register_text', stripslashes($_POST['register_text']));
139
  $this->SetOption('password_text', stripslashes($_POST['password_text']));
140
+ $this->SetOption('profile_text', stripslashes($_POST['profile_text']));
141
  $this->SetOption('login_redirect', stripslashes($_POST['login_redirect']));
142
  $this->SetOption('logout_redirect', stripslashes($_POST['logout_redirect']));
143
  $this->SetOption('header_html', stripslashes($_POST['header_html']));
149
  } //end if
150
 
151
  ?>
152
+ <div class="updated">
153
+ <p>If you like this plugin, please help keep it up to date by <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3836253">donating through PayPal</a>!</p>
154
+ </div>
155
  <div class="wrap">
156
  <?php if ( strlen($success) > 0 ) { ?>
157
  <div id="message" class="updated fade">
204
  <span class="setting-description">This will appear above the forgot password form.</span>
205
  </td>
206
  </tr>
207
+ <tr valign="top">
208
+ <th scope="row"><label for="profile_text">Profile Text</label></th>
209
+ <td>
210
+ <input name="profile_text" type="text" id="profile_text" value="<?php echo( htmlspecialchars ( $this->GetOption('profile_text') ) ); ?>" class="regular-text" />
211
+ <span class="setting-description">This will appear above the users profile.</span>
212
+ </td>
213
+ </tr>
214
  <tr valign="top">
215
  <th scope="row"><label for="login_redirect">Template Header Files</label></th>
216
  <td>
255
  $this->DoLogin();
256
  break;
257
  }
258
+
259
+ if ( is_admin() && current_user_can('edit_posts') === false && $pagenow != 'profile.php') {
260
+ $redirect_to = get_bloginfo('wpurl') . '/wp-admin/profile.php';
261
+ wp_safe_redirect($redirect_to);
262
+ die();
263
+ }
264
  }
265
 
266
  function DoHeader($title = 'Log In', $message = '', $wp_error = '') {
567
  break;
568
  endswitch;
569
  }
570
+
571
+ function DoProfile() {
572
+
573
+ function ProfileJS ( ) {
574
+ ?>
575
+ <script type="text/javascript">
576
+ function update_nickname ( ) {
577
+
578
+ var nickname = jQuery('#nickname').val();
579
+ var display_nickname = jQuery('#display_nickname').val();
580
+
581
+ if ( nickname == '' ) {
582
+ jQuery('#display_nickname').remove();
583
+ }
584
+ jQuery('#display_nickname').val(nickname).html(nickname);
585
+
586
+ }
587
+
588
+ jQuery(function($) {
589
+ $('#pass1').keyup( check_pass_strength )
590
+ $('.color-palette').click(function(){$(this).siblings('input[name=admin_color]').attr('checked', 'checked')});
591
+ } );
592
+
593
+ jQuery(document).ready( function() {
594
+ jQuery('#pass1,#pass2').attr('autocomplete','off');
595
+ jQuery('#nickname').blur(update_nickname);
596
+ });
597
+ </script>
598
+ <?php
599
+ }
600
+
601
+ function ProfileCSS ( ) {
602
+ ?>
603
+ <style type="text/css">
604
+ table.form-table th, table.form-table td {
605
+ padding: 0;
606
+ }
607
+ table.form-table th {
608
+ width: 150px;
609
+ vertical-align: text-top;
610
+ text-align: left;
611
+ }
612
+ p.message {
613
+ padding: 3px 5px;
614
+ background-color: lightyellow;
615
+ border: 1px solid yellow;
616
+ }
617
+ #display_name {
618
+ width: 250px;
619
+ }
620
+ .field-hint {
621
+ display: block;
622
+ clear: both;
623
+ }
624
+ </style>
625
+ <?php
626
+ }
627
+
628
+ if ( !$user_id ) {
629
+ $current_user = wp_get_current_user();
630
+ $user_id = $current_user->ID;
631
+ }
632
+
633
+ if ($current_user->has_cap('edit_posts') === false) {
634
+ $is_profile_page = true;
635
+ //add_filter('wp_title','cyc_title');
636
+ add_action('wp_head', 'ProfileJS');
637
+ add_action('wp_head', 'ProfileCSS');
638
+
639
+ wp_enqueue_script('jquery');
640
+
641
+ wp_reset_vars(array('action', 'redirect', 'profile', 'user_id', 'wp_http_referer'));
642
+ $wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashes($wp_http_referer));
643
+ $user_id = (int) $user_id;
644
+
645
+ $profileuser = get_user_to_edit($user_id);
646
+ if ( !current_user_can('edit_user', $user_id) )
647
+ wp_die(__('You do not have permission to edit this user.'));
648
+
649
+ $this->DoHeader(__($this->GetOption('profile_text')), '', $errors);
650
+ if ($_GET['updated'] == true) {
651
+ echo '<p class="message">Your profile has been updated.</p>';
652
+ }
653
+ ?>
654
+
655
+ <form name="profile" id="your-profile" action="" method="post">
656
+ <?php wp_nonce_field('update-user_' . $user_id) ?>
657
+ <?php if ( $wp_http_referer ) : ?>
658
+ <input type="hidden" name="wp_http_referer" value="<?php echo clean_url($wp_http_referer); ?>" />
659
+ <?php endif; ?>
660
+ <p>
661
+ <input type="hidden" name="from" value="profile" />
662
+ <input type="hidden" name="checkuser_id" value="<?php echo $user_ID ?>" />
663
+ </p>
664
+
665
+ <h3><?php _e('Name') ?></h3>
666
+
667
+ <table class="form-table">
668
+ <tr>
669
+ <th><label for="user_login"><?php _e('Username'); ?></label></th>
670
+ <td><input type="text" name="user_login" id="user_login" value="<?php echo $profileuser->user_login; ?>" disabled="disabled" /> <?php _e('Your username cannot be changed'); ?></td>
671
+ </tr>
672
+ <tr>
673
+ <th><label for="first_name"><?php _e('First name') ?></label></th>
674
+ <td><input type="text" name="first_name" id="first_name" value="<?php echo $profileuser->first_name ?>" /></td>
675
+ </tr>
676
+ <tr>
677
+ <th><label for="last_name"><?php _e('Last name') ?></label></th>
678
+ <td><input type="text" name="last_name" id="last_name" value="<?php echo $profileuser->last_name ?>" /></td>
679
+ </tr>
680
+ <tr>
681
+ <th><label for="nickname"><?php _e('Nickname') ?></label></th>
682
+ <td><input type="text" name="nickname" id="nickname" value="<?php echo $profileuser->nickname ?>" /></td>
683
+ </tr>
684
+ <tr>
685
+ <th><label for="display_name"><?php _e('Display name publicly&nbsp;as') ?></label></th>
686
+ <td>
687
+ <select name="display_name" id="display_name">
688
+ <?php
689
+ $public_display = array();
690
+ $public_display['display_displayname'] = $profileuser->display_name;
691
+ $public_display['display_nickname'] = $profileuser->nickname;
692
+ $public_display['display_username'] = $profileuser->user_login;
693
+ $public_display['display_firstname'] = $profileuser->first_name;
694
+ $public_display['display_firstlast'] = $profileuser->first_name.' '.$profileuser->last_name;
695
+ $public_display['display_lastfirst'] = $profileuser->last_name.' '.$profileuser->first_name;
696
+ $public_display = array_unique(array_filter(array_map('trim', $public_display)));
697
+ foreach($public_display as $id => $item) {
698
+ ?>
699
+ <option id="<?php echo $id; ?>" value="<?php echo $item; ?>"><?php echo $item; ?></option>
700
+ <?php
701
+ }
702
+ ?>
703
+ </select>
704
+ </td>
705
+ </tr>
706
+ </table>
707
+
708
+ <h3><?php _e('Contact Info') ?></h3>
709
+
710
+ <table class="form-table">
711
+ <tr>
712
+ <th><label for="email"><?php _e('E-mail') ?></label></th>
713
+ <td><input type="text" name="email" id="email" value="<?php echo $profileuser->user_email ?>" /> <?php _e('Required'); ?></td>
714
+ </tr>
715
+
716
+ <tr>
717
+ <th><label for="url"><?php _e('Website') ?></label></th>
718
+ <td><input type="text" name="url" id="url" value="<?php echo $profileuser->user_url ?>" /></td>
719
+ </tr>
720
+
721
+ <tr>
722
+ <th><label for="aim"><?php _e('AIM') ?></label></th>
723
+ <td><input type="text" name="aim" id="aim" value="<?php echo $profileuser->aim ?>" /></td>
724
+ </tr>
725
+
726
+ <tr>
727
+ <th><label for="yim"><?php _e('Yahoo IM') ?></label></th>
728
+ <td><input type="text" name="yim" id="yim" value="<?php echo $profileuser->yim ?>" /></td>
729
+ </tr>
730
+
731
+ <tr>
732
+ <th><label for="jabber"><?php _e('Jabber / Google Talk') ?></label></th>
733
+ <td><input type="text" name="jabber" id="jabber" value="<?php echo $profileuser->jabber ?>" /></td>
734
+ </tr>
735
+ </table>
736
+
737
+ <h3><?php _e('About Yourself'); ?></h3>
738
+
739
+ <table class="form-table">
740
+ <tr>
741
+ <th><label for="description"><?php _e('Biographical Info'); ?></label></th>
742
+ <td><textarea name="description" id="description" rows="5" cols="30"><?php echo $profileuser->description ?></textarea><br /><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?><br/><br/></td>
743
+ </tr>
744
+
745
+ <?php
746
+ $show_password_fields = apply_filters('show_password_fields', true);
747
+ if ( $show_password_fields ) :
748
+ ?>
749
+ <tr>
750
+ <th><label for="pass1"><?php _e('New Password'); ?></label></th>
751
+ <td>
752
+ <input type="password" name="pass1" id="pass1" size="16" value="" /><br/><?php _e("If you would like to change the password type a new one. Otherwise leave this blank."); ?><br />
753
+ <input type="password" name="pass2" id="pass2" size="16" value="" /><br/><?php _e("Type your new password again."); ?><br />
754
+ </td>
755
+ </tr>
756
+ <?php endif; ?>
757
+ </table>
758
+
759
+ <?php
760
+ do_action('profile_personal_options');
761
+ do_action('show_user_profile');
762
+ ?>
763
+
764
+ <?php if (count($profileuser->caps) > count($profileuser->roles)): ?>
765
+ <br class="clear" />
766
+ <table width="99%" style="border: none;" cellspacing="2" cellpadding="3" class="editform">
767
+ <tr>
768
+ <th scope="row"><?php _e('Additional Capabilities') ?></th>
769
+ <td><?php
770
+ $output = '';
771
+ foreach($profileuser->caps as $cap => $value) {
772
+ if(!$wp_roles->is_role($cap)) {
773
+ if($output != '') $output .= ', ';
774
+ $output .= $value ? $cap : "Denied: {$cap}";
775
+ }
776
+ }
777
+ echo $output;
778
+ ?></td>
779
+ </tr>
780
+ </table>
781
+ <?php endif; ?>
782
+
783
+ <p class="submit">
784
+ <input type="hidden" name="action" value="update" />
785
+ <input type="hidden" name="user_id" id="user_id" value="<?php echo $user_id; ?>" />
786
+ <input type="submit" id="cycsubmit" value="<?php $is_profile_page? _e('Update Profile') : _e('Update User') ?>" name="submit" />
787
+ </p>
788
+ </form>
789
+ </div>
790
+ <?php
791
+ echo $this->GetOption('footer_html');
792
+ $footer_files = $this->GetOption('footer_files');
793
+ foreach((array)$footer_files as $footer_file)
794
+ include(TEMPLATEPATH . '/' . $footer_file);
795
+
796
+ die();
797
+ }
798
+ }
799
  }
800
  }
801