Theme My Login - Version 7.0.5

Version Description

  • Allow custom actions to have custom slugs
  • Show the URL below each slug setting field
  • Add contextual help to plugin pages
  • Implement a "user panel" within the login widget
  • Add a filter to disable showing of the widget: tml_show_widget
  • Add a filter to change the avatar size in the "user_panel": tml_widget_avatar_size
  • Add a filter to change the links in the "user panel": tml_widget_user_links
Download this release

Release Info

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

Code changes from version 7.0.4 to 7.0.5

admin/hooks.php CHANGED
@@ -24,6 +24,7 @@ if ( is_multisite() ) {
24
  add_action( 'admin_menu', 'tml_admin_add_menu_items' );
25
  add_action( 'admin_init', 'tml_admin_register_settings' );
26
  }
 
27
 
28
  // Update
29
  add_action( 'admin_init', 'tml_admin_update' );
24
  add_action( 'admin_menu', 'tml_admin_add_menu_items' );
25
  add_action( 'admin_init', 'tml_admin_register_settings' );
26
  }
27
+ add_action( 'current_screen', 'tml_admin_add_settings_help_tabs' );
28
 
29
  // Update
30
  add_action( 'admin_init', 'tml_admin_update' );
admin/settings.php CHANGED
@@ -99,7 +99,7 @@ function tml_admin_get_settings_sections() {
99
  ),
100
  'tml_settings_slugs' => array(
101
  'title' => __( 'Slugs', 'theme-my-login' ),
102
- 'callback' => '__return_null',
103
  'page' => 'theme-my-login',
104
  ),
105
  ) );
@@ -113,127 +113,114 @@ function tml_admin_get_settings_sections() {
113
  * @return array The settings fields.
114
  */
115
  function tml_admin_get_settings_fields() {
116
- return (array) apply_filters( 'tml_admin_get_settings_fields', array(
117
- // Login
118
- 'tml_settings_login' => array(
119
- // Login type
120
- 'tml_login_type' => array(
121
- 'title' => __( 'Login Type', 'theme-my-login' ),
122
- 'callback' => 'tml_admin_setting_callback_radio_group_field',
123
- 'sanitize_callback' => 'sanitize_text_field',
124
- 'args' => array(
125
- 'label_for' => 'tml_login_type',
126
- 'legend' => __( 'Login Type', 'theme-my-login' ),
127
- 'options' => array(
128
- 'default' => __( 'Default', 'theme-my-login' ),
129
- 'username' => __( 'Username only', 'theme-my-login' ),
130
- 'email' => __( 'Email only', 'theme-my-login' ),
131
- ),
132
- 'checked' => get_site_option( 'tml_login_type', 'default' ),
133
  ),
 
134
  ),
135
  ),
136
- // Registration
137
- 'tml_settings_registration' => array(
138
- // Registration type
139
- 'tml_registration_type' => array(
140
- 'title' => __( 'Registration Type', 'theme-my-login' ),
141
- 'callback' => 'tml_admin_setting_callback_radio_group_field',
142
- 'sanitize_callback' => 'sanitize_text_field',
143
- 'args' => array(
144
- 'label_for' => 'tml_registration_type',
145
- 'legend' => __( 'Registration Type', 'theme-my-login' ),
146
- 'options' => array(
147
- 'default' => __( 'Default', 'theme-my-login' ),
148
- 'email' => __( 'Email only', 'theme-my-login' ),
149
- ),
150
- 'checked' => get_site_option( 'tml_registration_type', 'default' ),
151
- ),
152
- ),
153
- // User passwords
154
- 'tml_user_passwords' => array(
155
- 'title' => __( 'Passwords', 'theme-my-login' ),
156
- 'callback' => 'tml_admin_setting_callback_checkbox_field',
157
- 'sanitize_callback' => 'sanitize_text_field',
158
- 'args' => array(
159
- 'label_for' => 'tml_user_passwords',
160
- 'label' => __( 'Allow users to set their own password', 'theme-my-login' ),
161
- 'value' => '1',
162
- 'checked' => get_site_option( 'tml_user_passwords' ),
163
- ),
164
- ),
165
- // Auto-login
166
- 'tml_auto_login' => array(
167
- 'title' => __( 'Auto-Login', 'theme-my-login' ),
168
- 'callback' => 'tml_admin_setting_callback_checkbox_field',
169
- 'sanitize_callback' => 'sanitize_text_field',
170
- 'args' => array(
171
- 'label_for' => 'tml_auto_login',
172
- 'label' => __( 'Automatically log in users after registration', 'theme-my-login' ),
173
- 'value' => '1',
174
- 'checked' => get_site_option( 'tml_auto_login' ),
175
  ),
 
176
  ),
177
  ),
178
- // Slugs
179
- 'tml_settings_slugs' => array(
180
- // Login
181
- 'tml_login_slug' => array(
182
- 'title' => __( 'Log In' ),
183
- 'callback' => 'tml_admin_setting_callback_input_field',
184
- 'sanitize_callback' => 'sanitize_text_field',
185
- 'args' => array(
186
- 'label_for' => 'tml_login_slug',
187
- 'value' => get_site_option( 'tml_login_slug', 'login' ),
188
- 'input_class' => 'regular-text code',
189
- ),
190
  ),
191
- // Logout
192
- 'tml_logout_slug' => array(
193
- 'title' => __( 'Log Out' ),
194
- 'callback' => 'tml_admin_setting_callback_input_field',
195
- 'sanitize_callback' => 'tml_sanitize_slug',
196
- 'args' => array(
197
- 'label_for' => 'tml_logout_slug',
198
- 'value' => get_site_option( 'tml_logout_slug', 'logout' ),
199
- 'input_class' => 'regular-text code',
200
- ),
201
- ),
202
- // Register
203
- 'tml_register_slug' => array(
204
- 'title' => __( 'Register' ),
205
- 'callback' => 'tml_admin_setting_callback_input_field',
206
- 'sanitize_callback' => 'tml_sanitize_slug',
207
- 'args' => array(
208
- 'label_for' => 'tml_register_slug',
209
- 'value' => get_site_option( 'tml_register_slug', 'register' ),
210
- 'input_class' => 'regular-text code',
211
- ),
212
- ),
213
- // Lost password
214
- 'tml_lostpassword_slug' => array(
215
- 'title' => __( 'Lost Password' ),
216
- 'callback' => 'tml_admin_setting_callback_input_field',
217
- 'sanitize_callback' => 'tml_sanitize_slug',
218
- 'args' => array(
219
- 'label_for' => 'tml_lostpassword_slug',
220
- 'value' => get_site_option( 'tml_lostpassword_slug', 'lostpassword' ),
221
- 'input_class' => 'regular-text code',
222
- ),
223
- ),
224
- // Reset password
225
- 'tml_resetpass_slug' => array(
226
- 'title' => __( 'Reset Password' ),
227
- 'callback' => 'tml_admin_setting_callback_input_field',
228
- 'sanitize_callback' => 'tml_sanitize_slug',
229
- 'args' => array(
230
- 'label_for' => 'tml_resetpass_slug',
231
- 'value' => get_site_option( 'tml_resetpass_slug', 'resetpass' ),
232
- 'input_class' => 'regular-text code',
233
- ),
234
  ),
235
  ),
236
- ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  }
238
 
239
  /**
@@ -542,3 +529,115 @@ function tml_admin_save_ms_settings() {
542
  wp_redirect( $goback );
543
  exit;
544
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  ),
100
  'tml_settings_slugs' => array(
101
  'title' => __( 'Slugs', 'theme-my-login' ),
102
+ 'callback' => 'tml_admin_setting_callback_slugs_section',
103
  'page' => 'theme-my-login',
104
  ),
105
  ) );
113
  * @return array The settings fields.
114
  */
115
  function tml_admin_get_settings_fields() {
116
+ $fields = array();
117
+
118
+ // Login
119
+ $fields['tml_settings_login'] = array(
120
+ // Login type
121
+ 'tml_login_type' => array(
122
+ 'title' => __( 'Login Type', 'theme-my-login' ),
123
+ 'callback' => 'tml_admin_setting_callback_radio_group_field',
124
+ 'sanitize_callback' => 'sanitize_text_field',
125
+ 'args' => array(
126
+ 'label_for' => 'tml_login_type',
127
+ 'legend' => __( 'Login Type', 'theme-my-login' ),
128
+ 'options' => array(
129
+ 'default' => __( 'Default', 'theme-my-login' ),
130
+ 'username' => __( 'Username only', 'theme-my-login' ),
131
+ 'email' => __( 'Email only', 'theme-my-login' ),
 
132
  ),
133
+ 'checked' => get_site_option( 'tml_login_type', 'default' ),
134
  ),
135
  ),
136
+ );
137
+
138
+ // Registration
139
+ $fields['tml_settings_registration'] = array(
140
+ // Registration type
141
+ 'tml_registration_type' => array(
142
+ 'title' => __( 'Registration Type', 'theme-my-login' ),
143
+ 'callback' => 'tml_admin_setting_callback_radio_group_field',
144
+ 'sanitize_callback' => 'sanitize_text_field',
145
+ 'args' => array(
146
+ 'label_for' => 'tml_registration_type',
147
+ 'legend' => __( 'Registration Type', 'theme-my-login' ),
148
+ 'options' => array(
149
+ 'default' => __( 'Default', 'theme-my-login' ),
150
+ 'email' => __( 'Email only', 'theme-my-login' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  ),
152
+ 'checked' => get_site_option( 'tml_registration_type', 'default' ),
153
  ),
154
  ),
155
+ // User passwords
156
+ 'tml_user_passwords' => array(
157
+ 'title' => __( 'Passwords', 'theme-my-login' ),
158
+ 'callback' => 'tml_admin_setting_callback_checkbox_field',
159
+ 'sanitize_callback' => 'sanitize_text_field',
160
+ 'args' => array(
161
+ 'label_for' => 'tml_user_passwords',
162
+ 'label' => __( 'Allow users to set their own password', 'theme-my-login' ),
163
+ 'value' => '1',
164
+ 'checked' => get_site_option( 'tml_user_passwords' ),
 
 
165
  ),
166
+ ),
167
+ // Auto-login
168
+ 'tml_auto_login' => array(
169
+ 'title' => __( 'Auto-Login', 'theme-my-login' ),
170
+ 'callback' => 'tml_admin_setting_callback_checkbox_field',
171
+ 'sanitize_callback' => 'sanitize_text_field',
172
+ 'args' => array(
173
+ 'label_for' => 'tml_auto_login',
174
+ 'label' => __( 'Automatically log in users after registration', 'theme-my-login' ),
175
+ 'value' => '1',
176
+ 'checked' => get_site_option( 'tml_auto_login' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  ),
178
  ),
179
+ );
180
+
181
+ // Slugs
182
+ $fields['tml_settings_slugs'] = array();
183
+ foreach ( tml_get_actions() as $action ) {
184
+ if ( ! $action->show_in_slug_settings ) {
185
+ continue;
186
+ }
187
+
188
+ $slug_option = 'tml_' . $action->get_name() . '_slug';
189
+
190
+ $fields['tml_settings_slugs'][ $slug_option ] = array(
191
+ 'title' => $action->get_title(),
192
+ 'callback' => 'tml_admin_setting_callback_input_field',
193
+ 'sanitize_callback' => 'sanitize_text_field',
194
+ 'args' => array(
195
+ 'label_for' => $slug_option,
196
+ 'value' => get_site_option( $slug_option, $action->get_slug() ),
197
+ 'input_class' => 'regular-text code',
198
+ 'description' => sprintf( '<a href="%1$s">%1$s</a>', $action->get_url() ),
199
+ ),
200
+ );
201
+ }
202
+
203
+ /**
204
+ * Filters the settings fields.
205
+ *
206
+ * @since 7.0
207
+ *
208
+ * @param array $fields The settings fields.
209
+ */
210
+ return (array) apply_filters( 'tml_admin_get_settings_fields', $fields );
211
+ }
212
+
213
+ /**
214
+ * Render the "Slugs" section.
215
+ *
216
+ * @since 7.0.5
217
+ */
218
+ function tml_admin_setting_callback_slugs_section() {
219
+ ?>
220
+
221
+ <p><?php esc_html_e( 'The slugs defined here will be used to generate the URL to the corresponding action. You can see this URL below the slug field. If you would like to use pages for these actions, simply make sure the slug for the action below matches the slug of the page you would like to use for that action.', 'theme-my-login' ); ?></p>
222
+
223
+ <?php
224
  }
225
 
226
  /**
529
  wp_redirect( $goback );
530
  exit;
531
  }
532
+
533
+ /**
534
+ * Add contextual help to settings pages.
535
+ *
536
+ * @since 7.0.5
537
+ *
538
+ * @param WP_Screen $srceen The current screen object.
539
+ */
540
+ function tml_admin_add_settings_help_tabs( $screen ) {
541
+ global $plugin_page;
542
+
543
+ $help_tabs = $sidebar_links = array();
544
+
545
+ // Core page
546
+ if ( 'theme-my-login' == $plugin_page ) {
547
+ $help_tabs[] = array(
548
+ 'id' => 'theme-my-login-overview',
549
+ 'title' => __( 'Overview' ),
550
+ 'content' => '<p>' . implode( '</p><p>', array(
551
+ __( 'Welcome to Theme My Login!', 'theme-my-login' ),
552
+ __( 'Below, you can configure how you would like users to register and log in to your site.', 'theme-my-login' ),
553
+ __( 'Additionally, you can change the slugs that are used to generate the URLs that represent specific actions.', 'theme-my-login' ),
554
+ __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ),
555
+ ) ) . '</p>',
556
+ );
557
+
558
+ $sidebar_links[] = array(
559
+ 'title' => __( 'Documentation', 'theme-my-login' ),
560
+ 'url' => 'https://docs.thememylogin.com',
561
+ );
562
+
563
+ $sidebar_links[] = array(
564
+ 'title' => __( 'Support Forum', 'theme-my-login' ),
565
+ 'url' => 'https://wordpress.org/support/plugin/theme-my-login',
566
+ );
567
+
568
+ // Licenses page
569
+ } elseif ( 'theme-my-login-licenses' == $plugin_page ) {
570
+ $help_tabs[] = array(
571
+ 'id' => 'theme-my-login-licenses-overview',
572
+ 'title' => __( 'Overview' ),
573
+ 'content' => '<p>' . implode( '</p><p>', array(
574
+ __( 'When you purchase extensions for Theme My Login, you will enter your license keys on this page.', 'theme-my-login' ),
575
+ __( 'After you enter your license keys and click the Save Changes button at the bottom of the screen, you will see a new button next to each field with a license in it.', 'theme-my-login' ),
576
+ __( 'If you have not yet activated your license, this button will say "Activate". Click this button to activate your license.', 'theme-my-login' ),
577
+ __( 'If you have already activated your license, this button will say "Deactivate". Click this button to deactivate your license.', 'theme-my-login' ),
578
+ ) ) . '</p>',
579
+ );
580
+
581
+ $sidebar_links[] = array(
582
+ 'title' => __( 'Documentation on Installing Extensions', 'theme-my-login' ),
583
+ 'url' => 'https://docs.thememylogin.com/article/59-how-do-i-install-an-extension',
584
+ );
585
+ $sidebar_links[] = array(
586
+ 'title' => __( 'Support Form', 'theme-my-login' ),
587
+ 'url' => 'https://thememylogin.com/support',
588
+ );
589
+
590
+ // Extensions page
591
+ } elseif ( 'theme-my-login-extensions' == $plugin_page ) {
592
+ $help_tabs[] = array(
593
+ 'id' => 'theme-my-login-extensions-overview',
594
+ 'title' => __( 'Overview' ),
595
+ 'content' => '<p>' . implode( '</p><p>', array(
596
+ __( 'This page shows you all of the extensions available to purchase for Theme My Login.', 'theme-my-login' ),
597
+ __( 'Once you purchase an extension, you download it from your email receipt or your account page on our website. Then, you install it just like a normal WordPress plugin.', 'theme-my-login' ),
598
+ ) ) . '</p>',
599
+ );
600
+
601
+ $sidebar_links[] = array(
602
+ 'title' => __( 'Documentation on Installing Extensions', 'theme-my-login' ),
603
+ 'url' => 'https://docs.thememylogin.com/article/59-how-do-i-install-an-extension',
604
+ );
605
+ $sidebar_links[] = array(
606
+ 'title' => __( 'Extensions Store', 'theme-my-login' ),
607
+ 'url' => 'https://thememylogin.com/extensions',
608
+ );
609
+ $sidebar_links[] = array(
610
+ 'title' => __( 'Your Theme My Login Account', 'theme-my-login' ),
611
+ 'url' => 'https://thememylogin.com/your-account',
612
+ );
613
+
614
+ // Extension page
615
+ } elseif ( $extension = tml_get_extension( $plugin_page ) ) {
616
+ $settings_page = $extension->get_settings_page_args();
617
+ if ( ! empty( $settings_page['help_tabs'] ) ) {
618
+ $help_tabs = $settings_page['help_tabs'];
619
+ }
620
+ if ( ! empty( $settings_page['help_sidebar_links'] ) ) {
621
+ $sidebar_links = $settings_page['help_sidebar_links'];
622
+ }
623
+ }
624
+
625
+ // Add the help tabs
626
+ if ( ! empty( $help_tabs ) ) {
627
+ foreach ( $help_tabs as $help_tab ) {
628
+ $screen->add_help_tab( $help_tab );
629
+ }
630
+ }
631
+
632
+ // Add the sidebar links
633
+ if ( ! empty( $sidebar_links ) ) {
634
+ $sidebar_content = '<p><strong>' . __( 'For more information:' ) . '</strong></p>';
635
+ foreach ( $sidebar_links as $sidebar_link ) {
636
+ $sidebar_content .= sprintf( '<p><a href="%s">%s</a></p>',
637
+ $sidebar_link['url'],
638
+ $sidebar_link['title']
639
+ );
640
+ }
641
+ $screen->set_help_sidebar( $sidebar_content );
642
+ }
643
+ }
includes/actions.php CHANGED
@@ -65,12 +65,13 @@ function tml_register_default_actions() {
65
 
66
  // Confirm Action (Data Requests)
67
  tml_register_action( 'confirmaction', array(
68
- 'title' => __( 'Your Data Request', 'theme-my-login' ),
69
- 'slug' => 'confirmaction',
70
- 'callback' => 'tml_confirmaction_handler',
71
- 'show_on_forms' => false,
72
- 'show_in_widget' => false,
73
- 'show_in_nav_menus' => false,
 
74
  ) );
75
  }
76
 
65
 
66
  // Confirm Action (Data Requests)
67
  tml_register_action( 'confirmaction', array(
68
+ 'title' => __( 'Your Data Request', 'theme-my-login' ),
69
+ 'slug' => 'confirmaction',
70
+ 'callback' => 'tml_confirmaction_handler',
71
+ 'show_on_forms' => false,
72
+ 'show_in_widget' => false,
73
+ 'show_in_nav_menus' => false,
74
+ 'show_in_slug_settings' => false,
75
  ) );
76
  }
77
 
includes/class-theme-my-login-action.php CHANGED
@@ -77,6 +77,13 @@ class Theme_My_Login_Action {
77
  */
78
  public $show_nav_menu_item;
79
 
 
 
 
 
 
 
 
80
  /**
81
  * Construct the instance.
82
  *
@@ -86,13 +93,14 @@ class Theme_My_Login_Action {
86
  * @param array $args {
87
  * Optional. An array of arguments.
88
  *
89
- * @type string $title The action title.
90
- * @type string $slug The action slug.
91
- * @type callable $callback The action callback to fire when accessed.
92
- * @type bool|string $show_on_forms Whether a link to the action should be shown on forms or not.
93
- * @type bool $show_in_widget Whether this action should be selectable in the widget or not.
94
- * @type bool $show_in_nav_menus Whether this action should be available for use in nav menus or not.
95
- * @type bool $show_nav_menu_item Whether to show an assigned nav menu item or not.
 
96
  * }
97
  */
98
  public function __construct( $name, $args = array() ) {
@@ -100,13 +108,14 @@ class Theme_My_Login_Action {
100
  $this->set_name( $name );
101
 
102
  $args = wp_parse_args( $args, array(
103
- 'title' => '',
104
- 'slug' => '',
105
- 'callback' => '',
106
- 'network' => false,
107
- 'show_on_forms' => true,
108
- 'show_in_widget' => true,
109
- 'show_in_nav_menus' => true,
 
110
  ) );
111
 
112
  if ( ! isset( $args['show_nav_menu_item'] ) ) {
@@ -117,11 +126,12 @@ class Theme_My_Login_Action {
117
  $this->set_slug( $args['slug'] );
118
  $this->set_callback( $args['callback'] );
119
 
120
- $this->network = (bool) $args['network'];
121
- $this->show_on_forms = $args['show_on_forms'];
122
- $this->show_in_widget = (bool) $args['show_in_widget'];
123
- $this->show_in_nav_menus = (bool) $args['show_in_nav_menus'];
124
- $this->show_nav_menu_item = (bool) $args['show_nav_menu_item'];
 
125
  }
126
 
127
  /**
77
  */
78
  public $show_nav_menu_item;
79
 
80
+ /**
81
+ * Whether this action should be shown in the slug settings or not.
82
+ *
83
+ * @var bool
84
+ */
85
+ public $show_in_slug_settings = true;
86
+
87
  /**
88
  * Construct the instance.
89
  *
93
  * @param array $args {
94
  * Optional. An array of arguments.
95
  *
96
+ * @type string $title The action title.
97
+ * @type string $slug The action slug.
98
+ * @type callable $callback The action callback to fire when accessed.
99
+ * @type bool|string $show_on_forms Whether a link to the action should be shown on forms or not.
100
+ * @type bool $show_in_widget Whether this action should be selectable in the widget or not.
101
+ * @type bool $show_in_nav_menus Whether this action should be available for use in nav menus or not.
102
+ * @type bool $show_nav_menu_item Whether to show an assigned nav menu item or not.
103
+ * @type bool $show_in_slug_settings Whether this action should be shown in the slug settings or not.
104
  * }
105
  */
106
  public function __construct( $name, $args = array() ) {
108
  $this->set_name( $name );
109
 
110
  $args = wp_parse_args( $args, array(
111
+ 'title' => '',
112
+ 'slug' => '',
113
+ 'callback' => '',
114
+ 'network' => false,
115
+ 'show_on_forms' => true,
116
+ 'show_in_widget' => true,
117
+ 'show_in_nav_menus' => true,
118
+ 'show_in_slug_settings' => true,
119
  ) );
120
 
121
  if ( ! isset( $args['show_nav_menu_item'] ) ) {
126
  $this->set_slug( $args['slug'] );
127
  $this->set_callback( $args['callback'] );
128
 
129
+ $this->network = (bool) $args['network'];
130
+ $this->show_on_forms = $args['show_on_forms'];
131
+ $this->show_in_widget = (bool) $args['show_in_widget'];
132
+ $this->show_in_nav_menus = (bool) $args['show_in_nav_menus'];
133
+ $this->show_nav_menu_item = (bool) $args['show_nav_menu_item'];
134
+ $this->show_in_slug_settings = (bool) $args['show_in_slug_settings'];
135
  }
136
 
137
  /**
includes/class-theme-my-login-widget.php CHANGED
@@ -35,15 +35,28 @@ class Theme_My_Login_Widget extends WP_Widget {
35
  * @param array $instance
36
  */
37
  public function widget( $args, $instance ) {
38
- $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? tml_get_action_title( $instance['action'] ) : $instance['title'], $instance, $this->id_base );
39
-
40
- if ( is_user_logged_in() ) {
 
 
 
 
 
 
 
 
 
 
41
  return;
42
  }
43
 
44
- if ( tml_is_action() ) {
45
- return;
 
 
46
  }
 
47
 
48
  echo $args['before_widget'];
49
 
@@ -51,11 +64,80 @@ class Theme_My_Login_Widget extends WP_Widget {
51
  echo $args['before_title'] . $title . $args['after_title'];
52
  }
53
 
54
- echo tml_shortcode( array(
55
- 'action' => $instance['action'],
56
- 'show_links' => $instance['show_links'],
57
- 'redirect_to' => $_SERVER['REQUEST_URI'],
58
- ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
  echo $args['after_widget'];
61
  }
@@ -68,7 +150,6 @@ class Theme_My_Login_Widget extends WP_Widget {
68
  */
69
  public function form( $instance ) {
70
  $instance = wp_parse_args( $instance, array(
71
- 'title' => '',
72
  'action' => 'login',
73
  'show_links' => true,
74
  ) );
@@ -78,12 +159,6 @@ class Theme_My_Login_Widget extends WP_Widget {
78
  ) );
79
  ?>
80
 
81
- <p>
82
- <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?>
83
- <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
84
- </label>
85
- </p>
86
-
87
  <p>
88
  <label for="<?php echo $this->get_field_id( 'action' ); ?>"><?php _e( 'Action:' ); ?>
89
  <select class="widefat" id="<?php echo $this->get_field_id( 'action' ); ?>" name="<?php echo $this->get_field_name( 'action' ); ?>">
@@ -115,12 +190,10 @@ class Theme_My_Login_Widget extends WP_Widget {
115
  $instance = $old_instance;
116
 
117
  $new_instance = wp_parse_args( (array) $new_instance, array(
118
- 'title' => '',
119
  'action' => 'login',
120
  'show_links' => false,
121
  ) );
122
 
123
- $instance['title'] = sanitize_text_field( $new_instance['title'] );
124
  $instance['action'] = sanitize_text_field( $new_instance['action'] );
125
  $instance['show_links'] = (bool) $new_instance['show_links'];
126
 
35
  * @param array $instance
36
  */
37
  public function widget( $args, $instance ) {
38
+ $show_widget = ( is_user_logged_in() && 'login' != $instance['action'] ) || ! tml_is_action();
39
+
40
+ /**
41
+ * Filters whether to show the widget or not.
42
+ *
43
+ * @since 7.0.5
44
+ *
45
+ * @param bool $show_widget Whether to show the widget or not.
46
+ * @param array $instance The widget instance settings.
47
+ */
48
+ $show_widget = apply_filters( 'tml_show_widget', $show_widget, $instance );
49
+
50
+ if ( ! $show_widget ) {
51
  return;
52
  }
53
 
54
+ if ( is_user_logged_in() ) {
55
+ $title = _x( 'Welcome', 'Howdy' );
56
+ } else {
57
+ $title = tml_get_action_title( $instance['action'] );
58
  }
59
+ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
60
 
61
  echo $args['before_widget'];
62
 
64
  echo $args['before_title'] . $title . $args['after_title'];
65
  }
66
 
67
+ if ( is_user_logged_in() ) :
68
+ /**
69
+ * Filters the size of the avatar shwon in the widget when logged in.
70
+ *
71
+ * @since 7.0.5
72
+ *
73
+ * @param int $avatar_size The size of the avatar shown in the widget when logged in.
74
+ */
75
+ $avatar_size = apply_filters( 'tml_widget_avatar_size', 64 );
76
+
77
+ /**
78
+ * Filters the links shown in the widget when logged in.
79
+ *
80
+ * @since 7.0.5
81
+ *
82
+ * @param array $user_links The links shown in the widget when logged in.
83
+ */
84
+ $user_links = apply_filters( 'tml_widget_user_links', array(
85
+ 'dashboard' => array(
86
+ 'title' => __( 'Dashboard' ),
87
+ 'url' => admin_url(),
88
+ ),
89
+ 'profile' => array(
90
+ 'title' => __( 'Profile' ),
91
+ 'url' => admin_url( 'profile.php' ),
92
+ ),
93
+ 'logout' => array(
94
+ 'title' => __( 'Log Out' ),
95
+ 'url' => wp_logout_url(),
96
+ ),
97
+ ) );
98
+ ?>
99
+
100
+ <div class="tml tml-user-panel">
101
+ <?php if ( ! empty( $avatar_size ) ) : ?>
102
+ <div class="tml-user-avatar"><?php echo get_avatar( get_current_user_id(), $avatar_size ); ?></div>
103
+ <?php endif; ?>
104
+
105
+ <?php if ( ! empty( $user_links ) ) : ?>
106
+ <ul class="tml-user-links">
107
+
108
+ <?php foreach ( $user_links as $name => $user_link ) : ?>
109
+
110
+ <li class="tml-user-link-<?php echo esc_attr( $name ); ?>">
111
+ <a href="<?php echo esc_url( $user_link['url'] ); ?>"><?php echo esc_html( $user_link['title'] ); ?></a>
112
+ </li>
113
+
114
+ <?php endforeach; ?>
115
+
116
+ </ul>
117
+ <?php endif; ?>
118
+
119
+ <?php
120
+ /**
121
+ * Fires at the end of the logged in widget.
122
+ *
123
+ * @since 7.0.5
124
+ *
125
+ * @param array $instance The widget instance settings.
126
+ */
127
+ do_action( 'tml_widget_user_panel', $instance );
128
+ ?>
129
+
130
+ </div>
131
+
132
+ <?php else :
133
+
134
+ echo tml_shortcode( array(
135
+ 'action' => $instance['action'],
136
+ 'show_links' => $instance['show_links'],
137
+ 'redirect_to' => $_SERVER['REQUEST_URI'],
138
+ ) );
139
+
140
+ endif;
141
 
142
  echo $args['after_widget'];
143
  }
150
  */
151
  public function form( $instance ) {
152
  $instance = wp_parse_args( $instance, array(
 
153
  'action' => 'login',
154
  'show_links' => true,
155
  ) );
159
  ) );
160
  ?>
161
 
 
 
 
 
 
 
162
  <p>
163
  <label for="<?php echo $this->get_field_id( 'action' ); ?>"><?php _e( 'Action:' ); ?>
164
  <select class="widefat" id="<?php echo $this->get_field_id( 'action' ); ?>" name="<?php echo $this->get_field_name( 'action' ); ?>">
190
  $instance = $old_instance;
191
 
192
  $new_instance = wp_parse_args( (array) $new_instance, array(
 
193
  'action' => 'login',
194
  'show_links' => false,
195
  ) );
196
 
 
197
  $instance['action'] = sanitize_text_field( $new_instance['action'] );
198
  $instance['show_links'] = (bool) $new_instance['show_links'];
199
 
languages/theme-my-login.pot CHANGED
@@ -2,15 +2,15 @@
2
  # This file is distributed under the same license as the Theme My Login package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Theme My Login 7.0.4\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/theme-my-login\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2018-06-18T19:50:47-04:00\n"
13
- "PO-Revision-Date: 2018-06-18T19:50:47-04:00\n"
14
  "X-Domain: theme-my-login\n"
15
 
16
  #: includes/functions.php:402
@@ -36,7 +36,7 @@ msgstr ""
36
  msgid "Your Data Request"
37
  msgstr ""
38
 
39
- #: includes/actions.php:463
40
  msgid "Registration complete. You may now log in."
41
  msgstr ""
42
 
@@ -51,7 +51,7 @@ msgstr ""
51
  msgid "A login form for your site."
52
  msgstr ""
53
 
54
- #: includes/class-theme-my-login-widget.php:99
55
  msgid "Show action links?"
56
  msgstr ""
57
 
@@ -114,66 +114,131 @@ msgstr ""
114
  msgid "Slugs"
115
  msgstr ""
116
 
117
- #: admin/settings.php:121
118
- #: admin/settings.php:126
119
  msgid "Login Type"
120
  msgstr ""
121
 
122
- #: admin/settings.php:128
123
- #: admin/settings.php:147
124
  msgid "Default"
125
  msgstr ""
126
 
127
- #: admin/settings.php:129
128
  msgid "Username only"
129
  msgstr ""
130
 
131
- #: admin/settings.php:130
132
- #: admin/settings.php:148
133
  msgid "Email only"
134
  msgstr ""
135
 
136
- #: admin/settings.php:140
137
- #: admin/settings.php:145
138
  msgid "Registration Type"
139
  msgstr ""
140
 
141
- #: admin/settings.php:155
142
  msgid "Passwords"
143
  msgstr ""
144
 
145
- #: admin/settings.php:160
146
  msgid "Allow users to set their own password"
147
  msgstr ""
148
 
149
- #: admin/settings.php:167
150
  msgid "Auto-Login"
151
  msgstr ""
152
 
153
- #: admin/settings.php:172
154
  msgid "Automatically log in users after registration"
155
  msgstr ""
156
 
157
- #: admin/settings.php:433
 
 
 
 
158
  msgid "Active"
159
  msgstr ""
160
 
161
- #: admin/settings.php:437
162
  msgid "Invalid"
163
  msgstr ""
164
 
165
- #: admin/settings.php:440
166
  msgid "Inactive"
167
  msgstr ""
168
 
169
- #: admin/settings.php:455
170
  msgid "Deactivate"
171
  msgstr ""
172
 
173
- #: admin/settings.php:457
174
  msgid "Activate"
175
  msgstr ""
176
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  #: admin/extensions.php:61
178
  msgid "Whoops! Looks like there was an error fetching extensions from the server. Please try again."
179
  msgstr ""
2
  # This file is distributed under the same license as the Theme My Login package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Theme My Login 7.0.5\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/theme-my-login\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2018-06-20T16:01:48-04:00\n"
13
+ "PO-Revision-Date: 2018-06-20T16:01:48-04:00\n"
14
  "X-Domain: theme-my-login\n"
15
 
16
  #: includes/functions.php:402
36
  msgid "Your Data Request"
37
  msgstr ""
38
 
39
+ #: includes/actions.php:464
40
  msgid "Registration complete. You may now log in."
41
  msgstr ""
42
 
51
  msgid "A login form for your site."
52
  msgstr ""
53
 
54
+ #: includes/class-theme-my-login-widget.php:174
55
  msgid "Show action links?"
56
  msgstr ""
57
 
114
  msgid "Slugs"
115
  msgstr ""
116
 
117
+ #: admin/settings.php:122
118
+ #: admin/settings.php:127
119
  msgid "Login Type"
120
  msgstr ""
121
 
122
+ #: admin/settings.php:129
123
+ #: admin/settings.php:149
124
  msgid "Default"
125
  msgstr ""
126
 
127
+ #: admin/settings.php:130
128
  msgid "Username only"
129
  msgstr ""
130
 
131
+ #: admin/settings.php:131
132
+ #: admin/settings.php:150
133
  msgid "Email only"
134
  msgstr ""
135
 
136
+ #: admin/settings.php:142
137
+ #: admin/settings.php:147
138
  msgid "Registration Type"
139
  msgstr ""
140
 
141
+ #: admin/settings.php:157
142
  msgid "Passwords"
143
  msgstr ""
144
 
145
+ #: admin/settings.php:162
146
  msgid "Allow users to set their own password"
147
  msgstr ""
148
 
149
+ #: admin/settings.php:169
150
  msgid "Auto-Login"
151
  msgstr ""
152
 
153
+ #: admin/settings.php:174
154
  msgid "Automatically log in users after registration"
155
  msgstr ""
156
 
157
+ #: admin/settings.php:221
158
+ msgid "The slugs defined here will be used to generate the URL to the corresponding action. You can see this URL below the slug field. If you would like to use pages for these actions, simply make sure the slug for the action below matches the slug of the page you would like to use for that action."
159
+ msgstr ""
160
+
161
+ #: admin/settings.php:420
162
  msgid "Active"
163
  msgstr ""
164
 
165
+ #: admin/settings.php:424
166
  msgid "Invalid"
167
  msgstr ""
168
 
169
+ #: admin/settings.php:427
170
  msgid "Inactive"
171
  msgstr ""
172
 
173
+ #: admin/settings.php:442
174
  msgid "Deactivate"
175
  msgstr ""
176
 
177
+ #: admin/settings.php:444
178
  msgid "Activate"
179
  msgstr ""
180
 
181
+ #: admin/settings.php:551
182
+ msgid "Welcome to Theme My Login!"
183
+ msgstr ""
184
+
185
+ #: admin/settings.php:552
186
+ msgid "Below, you can configure how you would like users to register and log in to your site."
187
+ msgstr ""
188
+
189
+ #: admin/settings.php:553
190
+ msgid "Additionally, you can change the slugs that are used to generate the URLs that represent specific actions."
191
+ msgstr ""
192
+
193
+ #: admin/settings.php:559
194
+ msgid "Documentation"
195
+ msgstr ""
196
+
197
+ #: admin/settings.php:564
198
+ msgid "Support Forum"
199
+ msgstr ""
200
+
201
+ #: admin/settings.php:574
202
+ msgid "When you purchase extensions for Theme My Login, you will enter your license keys on this page."
203
+ msgstr ""
204
+
205
+ #: admin/settings.php:575
206
+ msgid "After you enter your license keys and click the Save Changes button at the bottom of the screen, you will see a new button next to each field with a license in it."
207
+ msgstr ""
208
+
209
+ #: admin/settings.php:576
210
+ msgid "If you have not yet activated your license, this button will say \"Activate\". Click this button to activate your license."
211
+ msgstr ""
212
+
213
+ #: admin/settings.php:577
214
+ msgid "If you have already activated your license, this button will say \"Deactivate\". Click this button to deactivate your license."
215
+ msgstr ""
216
+
217
+ #: admin/settings.php:582
218
+ #: admin/settings.php:602
219
+ msgid "Documentation on Installing Extensions"
220
+ msgstr ""
221
+
222
+ #: admin/settings.php:586
223
+ msgid "Support Form"
224
+ msgstr ""
225
+
226
+ #: admin/settings.php:596
227
+ msgid "This page shows you all of the extensions available to purchase for Theme My Login."
228
+ msgstr ""
229
+
230
+ #: admin/settings.php:597
231
+ msgid "Once you purchase an extension, you download it from your email receipt or your account page on our website. Then, you install it just like a normal WordPress plugin."
232
+ msgstr ""
233
+
234
+ #: admin/settings.php:606
235
+ msgid "Extensions Store"
236
+ msgstr ""
237
+
238
+ #: admin/settings.php:610
239
+ msgid "Your Theme My Login Account"
240
+ msgstr ""
241
+
242
  #: admin/extensions.php:61
243
  msgid "Whoops! Looks like there was an error fetching extensions from the server. Please try again."
244
  msgstr ""
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: thememylogin, jfarthing84
3
  Tags: login, register, password, branding, customize, widget, wp-login, wp-login.php
4
  Requires at least: 4.6
5
  Tested up to: 4.9.6
6
- Stable tag: 7.0.4
7
 
8
  The ultimate login branding solution! Theme My Login offers matchless customization of your WordPress user experience!
9
 
@@ -59,6 +59,15 @@ Report bugs, suggest ideas and participate in development at [GitHub](https://gi
59
 
60
  == Changelog ==
61
 
 
 
 
 
 
 
 
 
 
62
  = 7.0.4 =
63
  * Fix a notice that appears when unregistering an action
64
  * Don't fire form actions until the form is being rendered
3
  Tags: login, register, password, branding, customize, widget, wp-login, wp-login.php
4
  Requires at least: 4.6
5
  Tested up to: 4.9.6
6
+ Stable tag: 7.0.5
7
 
8
  The ultimate login branding solution! Theme My Login offers matchless customization of your WordPress user experience!
9
 
59
 
60
  == Changelog ==
61
 
62
+ = 7.0.5 =
63
+ * Allow custom actions to have custom slugs
64
+ * Show the URL below each slug setting field
65
+ * Add contextual help to plugin pages
66
+ * Implement a "user panel" within the login widget
67
+ * Add a filter to disable showing of the widget: `tml_show_widget`
68
+ * Add a filter to change the avatar size in the "user_panel": `tml_widget_avatar_size`
69
+ * Add a filter to change the links in the "user panel": `tml_widget_user_links`
70
+
71
  = 7.0.4 =
72
  * Fix a notice that appears when unregistering an action
73
  * Don't fire form actions until the form is being rendered
theme-my-login.php CHANGED
@@ -10,7 +10,7 @@
10
  Plugin Name: Theme My Login
11
  Plugin URI: https://thememylogin.com
12
  Description: Creates an alternate login, registration and password recovery experience within your theme.
13
- Version: 7.0.4
14
  Author: Theme My Login
15
  Author URI: https://thememylogin.com
16
  License: GPLv2
@@ -24,7 +24,7 @@ Network: true
24
  *
25
  * @since 7.0
26
  */
27
- define( 'THEME_MY_LOGIN_VERSION', '7.0.4' );
28
 
29
  /**
30
  * Stores the path to TML.
10
  Plugin Name: Theme My Login
11
  Plugin URI: https://thememylogin.com
12
  Description: Creates an alternate login, registration and password recovery experience within your theme.
13
+ Version: 7.0.5
14
  Author: Theme My Login
15
  Author URI: https://thememylogin.com
16
  License: GPLv2
24
  *
25
  * @since 7.0
26
  */
27
+ define( 'THEME_MY_LOGIN_VERSION', '7.0.5' );
28
 
29
  /**
30
  * Stores the path to TML.