User registration & user profile – Profile Builder - Version 2.1.2

Version Description

  • Created Add-On Page in Profile Builder
  • Added support for Twenty Fifteen theme to better target inputs
  • Add support for "redirect_url" parameter to Login shortcode (will do the same thing as "redirect" - for consistency)
  • Added "redirect_url" parameter to Register and Edit-profile shortcodes
Download this release

Release Info

Developer madalin.ungureanu
Plugin Icon 128x128 User registration & user profile – Profile Builder
Version 2.1.2
Comparing to
See all releases

Code changes from version 2.1.1 to 2.1.2

admin/add-ons.php ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Function that creates the "Add-Ons" submenu page
4
+ *
5
+ * @since v.2.1.0
6
+ *
7
+ * @return void
8
+ */
9
+ function wppb_register_add_ons_submenu_page() {
10
+ add_submenu_page( 'profile-builder', __( 'Add-Ons', 'profilebuilder' ), __( 'Add-Ons', 'profilebuilder' ), 'manage_options', 'profile-builder-add-ons', 'wppb_add_ons_content' );
11
+ }
12
+ add_action( 'admin_menu', 'wppb_register_add_ons_submenu_page', 19 );
13
+
14
+
15
+ /**
16
+ * Function that adds content to the "Add-Ons" submenu page
17
+ *
18
+ * @since v.2.1.0
19
+ *
20
+ * @return string
21
+ */
22
+ function wppb_add_ons_content() {
23
+
24
+ $version = 'Free';
25
+ $version = ( ( PROFILE_BUILDER == 'Profile Builder Pro' ) ? 'Pro' : $version );
26
+ $version = ( ( PROFILE_BUILDER == 'Profile Builder Hobbyist' ) ? 'Hobbyist' : $version );
27
+
28
+ ?>
29
+
30
+ <div class="wrap wppb-add-on-wrap">
31
+
32
+ <h2><?php _e( 'Add-Ons', 'profilebuilder' ); ?></h2>
33
+
34
+ <span id="wppb-add-on-activate-button-text" class="wppb-add-on-user-messages"><?php echo __( 'Activate', 'profilebuilder' ); ?></span>
35
+
36
+ <span id="wppb-add-on-downloading-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Downloading and installing...', 'profilebuilder' ); ?></span>
37
+ <span id="wppb-add-on-download-finished-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Installation complete', 'profilebuilder' ); ?></span>
38
+
39
+ <span id="wppb-add-on-activated-button-text" class="wppb-add-on-user-messages"><?php echo __( 'Add-On is Active', 'profilebuilder' ); ?></span>
40
+ <span id="wppb-add-on-activated-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Add-On has been activated', 'profilebuilder' ) ?></span>
41
+ <span id="wppb-add-on-activated-error-button-text" class="wppb-add-on-user-messages"><?php echo __( 'Retry Install', 'profilebuilder' ) ?></span>
42
+
43
+ <span id="wppb-add-on-is-active-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Add-On is <strong>active</strong>', 'profilebuilder' ); ?></span>
44
+ <span id="wppb-add-on-is-not-active-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Add-On is <strong>inactive</strong>', 'profilebuilder' ); ?></span>
45
+
46
+ <span id="wppb-add-on-deactivate-button-text" class="wppb-add-on-user-messages"><?php echo __( 'Deactivate', 'profilebuilder' ) ?></span>
47
+ <span id="wppb-add-on-deactivated-message-text" class="wppb-add-on-user-messages"><?php echo __( 'Add-On has been deactivated.', 'profilebuilder' ) ?></span>
48
+
49
+ <div id="the-list">
50
+
51
+ <?php
52
+
53
+ $wppb_add_ons = wppb_add_ons_get_remote_content();
54
+ $wppb_get_all_plugins = get_plugins();
55
+ $wppb_get_active_plugins = get_option('active_plugins');
56
+
57
+
58
+
59
+ if( $wppb_add_ons === false ) {
60
+
61
+ echo __('Something went wrong, we could not connect to the server. Please try again later.', 'profilebuilder');
62
+
63
+ } else {
64
+
65
+ foreach( $wppb_add_ons as $key => $wppb_add_on ):
66
+
67
+ $wppb_add_on_exists = 0;
68
+ $wppb_add_on_is_active = 0;
69
+
70
+ // Check to see if add-on is in the plugins folder
71
+ foreach( $wppb_get_all_plugins as $wppb_plugin_key => $wppb_plugin ) {
72
+ if( strpos( $wppb_plugin['Name'], $wppb_add_on['name'] ) !== false && strpos( $wppb_plugin['AuthorName'], 'Cozmoslabs' ) !== false ) {
73
+ $wppb_add_on_exists = 1;
74
+
75
+ if( in_array( $wppb_plugin_key, $wppb_get_active_plugins ) ) {
76
+ $wppb_add_on_is_active = 1;
77
+ }
78
+
79
+ $wppb_add_on['plugin_file'] = $wppb_plugin_key;
80
+ }
81
+ }
82
+
83
+ echo '<div class="plugin-card wppb-add-on">';
84
+ echo '<div class="plugin-card-top">';
85
+
86
+ echo '<a target="_blank" href="' . $wppb_add_on['url'] . '?utm_source=wpbackend&utm_medium=clientsite&utm_content=add-on-page&utm_campaign=PB' . $version . '">';
87
+ echo '<img src="' . $wppb_add_on['thumbnail_url'] . '" />';
88
+ echo '</a>';
89
+
90
+ echo '<h3 class="wppb-add-on-title">';
91
+ echo '<a target="_blank" href="' . $wppb_add_on['url'] . '?utm_source=wpbackend&utm_medium=clientsite&utm_content=add-on-page&utm_campaign=PB' . $version . '">';
92
+ echo $wppb_add_on['name'];
93
+ echo '</a>';
94
+ echo '</h3>';
95
+
96
+ echo '<h3 class="wppb-add-on-price">' . $wppb_add_on['price'] . '</h3>';
97
+ echo '<p class="wppb-add-on-description">' . $wppb_add_on['description'] . '</p>';
98
+
99
+ echo '</div>';
100
+
101
+ $wppb_version_validation = version_compare( PROFILE_BUILDER_VERSION, $wppb_add_on['product_version'] );
102
+
103
+ ( $wppb_version_validation != -1 ) ? $wppb_version_validation_class = 'wppb-add-on-compatible' : $wppb_version_validation_class = 'wppb-add-on-not-compatible';
104
+
105
+ echo '<div class="plugin-card-bottom ' . $wppb_version_validation_class . '">';
106
+
107
+ if( $wppb_version_validation != -1 ) {
108
+
109
+ if( $wppb_add_on_exists ) {
110
+
111
+ if( !$wppb_add_on_is_active ) {
112
+
113
+ echo '<a class="wppb-add-on-activate right button button-secondary" href="' . $wppb_add_on['plugin_file'] . '">' . __( 'Activate', 'profilebuilder' ) . '</a>';
114
+ echo '<span class="dashicons dashicons-no-alt"></span><span class="wppb-add-on-message">' . __( 'Add-On is <strong>inactive</strong>', 'profilebuilder' ) . '</span>';
115
+
116
+ } else {
117
+
118
+ echo '<a class="wppb-add-on-deactivate right button button-secondary" href="' . $wppb_add_on['plugin_file'] . '">' . __( 'Deactivate', 'profilebuilder' ) . '</a>';
119
+ echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . __( 'Add-On is <strong>active</strong>', 'profilebuilder' ) . '</span>';
120
+
121
+ }
122
+
123
+ } else {
124
+
125
+ ( $wppb_add_on['paid'] ) ? $wppb_paid_link_class = 'button-primary' : $wppb_paid_link_class = 'button-secondary wppb-add-on-download';
126
+ ( $wppb_add_on['paid'] ) ? $wppb_paid_link_text = __( 'Buy Now', 'profilebuilder' ) : $wppb_paid_link_text = __( 'Install Now', 'profilebuilder' );
127
+ ( $wppb_add_on['paid'] ) ? $wppb_paid_href_utm_text = '?utm_source=wpbackend&utm_medium=clientsite&utm_content=add-on-page-buy-button&utm_campaign=PB' . $version : $wppb_paid_href_utm_text = '&utm_source=wpbackend&utm_medium=clientsite&utm_content=add-on-page&utm_campaign=PB' . $version;
128
+
129
+ echo '<a target="_blank" class="right button ' . $wppb_paid_link_class . '" href="' . $wppb_add_on['download_url'] . $wppb_paid_href_utm_text . '" data-add-on-slug="profile-builder-' . $wppb_add_on['slug'] . '" data-add-on-name="' . $wppb_add_on['name'] . '" >' . $wppb_paid_link_text . '</a>';
130
+ echo '<span class="dashicons dashicons-yes"></span><span class="wppb-add-on-message">' . __( 'Compatible with your version of Profile Builder.', 'profilebuilder' ) . '</span>';
131
+
132
+ }
133
+
134
+ echo '<div class="spinner"></div>';
135
+
136
+ } else {
137
+ echo ' ' . '<a class="button button-secondary right" href="' . admin_url('plugins.php') . '">' . __( 'Update', 'profilebuilder' ) . '</a>';
138
+ echo '<span class="wppb-add-on-message">' . __( 'Not compatible with your version of Profile Builder.', 'profilebuilder' ) . '</span><br />';
139
+ echo '<span class="wppb-add-on-message">' . __( 'Minimum required Profile Builder version:', 'profilebuilder' ) . '<strong> ' . $wppb_add_on['product_version'] . '</strong></span>';
140
+ }
141
+
142
+ // We had to put this error here because we need the url of the add-on
143
+ echo '<span class="wppb-add-on-user-messages wppb-error-manual-install">' . sprintf( __( 'Could not install add-on. Retry or <a href="%s" target="_blank">install manually</a>.', 'profilebuilder' ), esc_url( $wppb_add_on['url'] ) ) . '</span>';
144
+
145
+ echo '</div>';
146
+ echo '</div>';
147
+
148
+ endforeach;
149
+ }
150
+
151
+ ?>
152
+ </div>
153
+ </div>
154
+ <?php
155
+ }
156
+
157
+ /*
158
+ * Function that returns the array of add-ons from cozmoslabs.com if it finds the file
159
+ * If something goes wrong it returns false
160
+ *
161
+ * @since v.2.1.0
162
+ */
163
+ function wppb_add_ons_get_remote_content() {
164
+
165
+ $response = wp_remote_get('http://www.cozmoslabs.com/wp-content/plugins/cozmoslabs-products-add-ons/profile-builder-add-ons.json');
166
+
167
+ if( is_wp_error($response) ) {
168
+ return false;
169
+ } else {
170
+ $json_file_contents = $response['body'];
171
+ $wppb_add_ons = json_decode( $json_file_contents, true );
172
+ }
173
+
174
+ if( !is_object( $wppb_add_ons ) && !is_array( $wppb_add_ons ) ) {
175
+ return false;
176
+ }
177
+
178
+ return $wppb_add_ons;
179
+
180
+ }
181
+
182
+
183
+ /*
184
+ * Function that is triggered through Ajax to activate an add-on
185
+ *
186
+ * @since v.2.1.0
187
+ */
188
+ function wppb_add_on_activate() {
189
+
190
+ // Setup variables from POST
191
+ $wppb_add_on_to_activate = $_POST['wppb_add_on_to_activate'];
192
+ $response = $_POST['wppb_add_on_index'];
193
+
194
+ if( !is_plugin_active( $wppb_add_on_to_activate )) {
195
+ activate_plugin( $wppb_add_on_to_activate );
196
+ }
197
+
198
+ echo $response;
199
+ wp_die();
200
+ }
201
+ add_action( 'wp_ajax_wppb_add_on_activate', 'wppb_add_on_activate' );
202
+
203
+
204
+ /*
205
+ * Function that is triggered through Ajax to deactivate an add-on
206
+ *
207
+ * @since v.2.1.0
208
+ */
209
+ function wppb_add_on_deactivate() {
210
+
211
+ // Setup variables from POST
212
+ $wppb_add_on_to_deactivate = $_POST['wppb_add_on_to_deactivate'];
213
+ $response = $_POST['wppb_add_on_index'];
214
+
215
+ deactivate_plugins( $wppb_add_on_to_deactivate );
216
+
217
+ echo $response;
218
+ wp_die();
219
+
220
+ }
221
+ add_action( 'wp_ajax_wppb_add_on_deactivate', 'wppb_add_on_deactivate' );
222
+
223
+
224
+ /*
225
+ * Function that downloads and unzips the .zip file returned from Cozmoslabs
226
+ *
227
+ * @since v.2.1.0
228
+ */
229
+ function wppb_add_on_download_zip_file() {
230
+
231
+ // Set the response to success and change it later if needed
232
+ $response = $_POST['wppb_add_on_index'];
233
+ $add_on_index = $response;
234
+
235
+ // Setup variables from POST
236
+ $wppb_add_on_download_url = $_POST['wppb_add_on_download_url'];
237
+ $wppb_add_on_zip_name = $_POST['wppb_add_on_zip_name'];
238
+
239
+
240
+ // Get .zip file
241
+ $remote_response = wp_remote_get( $wppb_add_on_download_url );
242
+ if( is_wp_error( $remote_response ) ) {
243
+ $response = 'error-' . $add_on_index;
244
+ } else {
245
+ $file_contents = $remote_response['body'];
246
+ }
247
+
248
+
249
+ // Put the file in the plugins directory
250
+ if( isset( $file_contents ) ) {
251
+ if( file_put_contents( WP_PLUGIN_DIR . '/' . $wppb_add_on_zip_name, $file_contents ) === false ) {
252
+ $response = 'error-' . $add_on_index;
253
+ }
254
+ }
255
+
256
+
257
+ // Unzip the file
258
+ if( $response != 'error' ) {
259
+ WP_Filesystem();
260
+ if( unzip_file( WP_PLUGIN_DIR . '/' . $wppb_add_on_zip_name , WP_PLUGIN_DIR ) ) {
261
+ // Remove the zip file after we are all done
262
+ unlink( WP_PLUGIN_DIR . '/' . $wppb_add_on_zip_name );
263
+ } else {
264
+ $response = 'error-' . $add_on_index;
265
+ }
266
+ }
267
+
268
+ echo $response;
269
+ wp_die();
270
+ }
271
+ add_action( 'wp_ajax_wppb_add_on_download_zip_file', 'wppb_add_on_download_zip_file' );
272
+
273
+
274
+ /*
275
+ * Function that retrieves the data of the newly added plugin
276
+ *
277
+ * @since v.2.1.0
278
+ */
279
+ function wppb_add_on_get_new_plugin_data() {
280
+ $wppb_add_on_name = $_POST['wppb_add_on_name'];
281
+
282
+ $wppb_get_all_plugins = get_plugins();
283
+ foreach( $wppb_get_all_plugins as $wppb_plugin_key => $wppb_plugin ) {
284
+
285
+ if( strpos( $wppb_plugin['Name'], $wppb_add_on_name ) !== false && strpos( $wppb_plugin['AuthorName'], 'Cozmoslabs' ) !== false ) {
286
+
287
+ // Deactivate the add-on if it's active
288
+ if( is_plugin_active( $wppb_plugin_key )) {
289
+ deactivate_plugins( $wppb_plugin_key );
290
+ }
291
+
292
+ // Return the plugin path
293
+ echo $wppb_plugin_key;
294
+ }
295
+ }
296
+
297
+ wp_die();
298
+ }
299
+ add_action( 'wp_ajax_wppb_add_on_get_new_plugin_data', 'wppb_add_on_get_new_plugin_data' );
assets/css/style-back-end.css CHANGED
@@ -437,6 +437,94 @@
437
  display: block;
438
  }
439
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
440
  /* Manage Fields Responsive CSS */
441
  @media screen and ( max-width: 1125px ) {
442
  /* Manage Fields Responsive */
437
  display: block;
438
  }
439
 
440
+ /* Add-Ons page */
441
+ .wppb-add-on-user-messages{ display: none; }
442
+
443
+ .wppb-add-on-wrap .plugin-card-bottom:after {
444
+ display: block;
445
+ content: '';
446
+ clear: both;
447
+ }
448
+
449
+ .wppb-add-on a:focus {
450
+ box-shadow: none;
451
+ }
452
+
453
+ .wppb-add-on img {
454
+ max-width: 100%;
455
+ height: auto;
456
+ }
457
+
458
+ .wppb-add-on .wppb-add-on-title {
459
+ letter-spacing: -0.7px;
460
+ margin-bottom: 7px;
461
+ }
462
+
463
+ .wppb-add-on .wppb-add-on-title a {
464
+ text-decoration: none;
465
+ color: inherit;
466
+ }
467
+
468
+ .wppb-add-on .wppb-add-on-price {
469
+ font-size: 1.1em;
470
+ letter-spacing: -0.7px;
471
+ margin-top: 7px;
472
+ }
473
+
474
+ .wppb-add-on-compatible span {
475
+ line-height: 28px;
476
+ }
477
+
478
+ .wppb-add-on-not-compatible {
479
+ position: relative;
480
+ }
481
+
482
+ .wppb-add-on-not-compatible:before {
483
+ display: block;
484
+ content: '';
485
+ position: absolute;
486
+ width: 4px;
487
+ height: 100%;
488
+ background: #d54e21;
489
+ top: 0;
490
+ left: 0;
491
+ }
492
+
493
+ .wppb-add-on .button {
494
+ position: relative;
495
+ }
496
+
497
+ .wppb-add-on .button.wppb-add-on-deactivate {
498
+ opacity: 0;
499
+ }
500
+
501
+ .wppb-add-on .spinner {
502
+ display: block;
503
+ margin-top: 4px;
504
+ opacity: 0;
505
+ }
506
+
507
+ .wppb-add-on-spinner {
508
+ opacity: 0;
509
+ position: absolute;
510
+ top: 50%;
511
+ left: 50%;
512
+ margin-top: -10px;
513
+ margin-left: -10px;
514
+ display: block;
515
+ width: 20px;
516
+ height: 20px;
517
+ background: url('../images/spinner.gif') no-repeat center;
518
+ }
519
+
520
+ .wppb-confirmation-success {
521
+ color: #27ae60;
522
+ }
523
+
524
+ .wppb-confirmation-error {
525
+ color: #c0392b;
526
+ }
527
+
528
  /* Manage Fields Responsive CSS */
529
  @media screen and ( max-width: 1125px ) {
530
  /* Manage Fields Responsive */
assets/css/style-front-end.css CHANGED
@@ -151,8 +151,8 @@
151
  float:left;
152
  min-height:1px;
153
  }
154
-
155
  .wppb-form-field input,
 
156
  .wppb-form-field select,
157
  .wppb-form-field textarea,
158
  .wppb-checkboxes,
151
  float:left;
152
  min-height:1px;
153
  }
 
154
  .wppb-form-field input,
155
+ .wppb-form-field input[type="text"], .wppb-form-field input[type="email"], .wppb-form-field input[type="url"], .wppb-form-field input[type="password"], .wppb-form-field input[type="search"],
156
  .wppb-form-field select,
157
  .wppb-form-field textarea,
158
  .wppb-checkboxes,
assets/images/spinner.gif ADDED
Binary file
assets/js/jquery-pb-add-ons.js ADDED
@@ -0,0 +1,329 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ /*
3
+ * Function to download/activate add-ons on button click
4
+ */
5
+ jQuery('.wppb-add-on .button').on( 'click', function(e) {
6
+ if( jQuery(this).attr('disabled') ) {
7
+ return false;
8
+ }
9
+
10
+ // Download add-on
11
+ if( jQuery(this).hasClass('wppb-add-on-download') ) {
12
+ e.preventDefault();
13
+ wppb_add_on_download_and_install( jQuery(this) );
14
+ }
15
+
16
+ // Activate add-on
17
+ if( jQuery(this).hasClass('wppb-add-on-activate') ) {
18
+ e.preventDefault();
19
+ wppb_add_on_activate( jQuery(this) );
20
+ }
21
+
22
+ // Deactivate add-on
23
+ if( jQuery(this).hasClass('wppb-add-on-deactivate') ) {
24
+ e.preventDefault();
25
+ wppb_add_on_deactivate( jQuery(this) );
26
+ }
27
+ });
28
+
29
+
30
+ /*
31
+ * Make deactivate button from Add-On is Active message button
32
+ */
33
+ jQuery('.wppb-add-on').on( 'hover', function() {
34
+
35
+ $button = jQuery(this).find('.wppb-add-on-deactivate');
36
+
37
+ if( $button.length > 0 ) {
38
+ $button
39
+ .animate({
40
+ opacity: 1
41
+ }, 100);
42
+ }
43
+ });
44
+
45
+ /*
46
+ * Make Add-On is Active message button from deactivate button
47
+ */
48
+ jQuery('.wppb-add-on').on( 'mouseleave', function() {
49
+
50
+ $button = jQuery(this).find('.wppb-add-on-deactivate');
51
+
52
+ if( $button.length > 0 ) {
53
+ $button
54
+ .animate({
55
+ opacity: 0
56
+ }, 100);
57
+ }
58
+ });
59
+
60
+
61
+ /*
62
+ * Download Add-On from Cozmoslabs on click
63
+ */
64
+ function wppb_add_on_download_and_install( $button ) {
65
+ $download_button = $button;
66
+
67
+ var fade_in_out_speed = 300;
68
+ var download_url = $download_button.attr('href');
69
+ var file_name = $download_button.attr('data-add-on-slug') + '.zip';
70
+ var add_on_name = $download_button.attr('data-add-on-name');
71
+ var add_on_index = $download_button.parents('.wppb-add-on').index('.wppb-add-on');
72
+
73
+ $download_button
74
+ .attr('disabled', true);
75
+
76
+ $spinner = $download_button.siblings('.spinner');
77
+
78
+ $spinner.animate({
79
+ opacity: 0.7
80
+ }, 100);
81
+
82
+ // Remove the current displayed message
83
+ wppb_add_on_remove_status_message( $download_button, fade_in_out_speed );
84
+
85
+ // Set status confirmation message
86
+ wppb_add_on_set_status_message( $download_button, 'dashicons-download', jQuery('#wppb-add-on-downloading-message-text').text(), fade_in_out_speed, fade_in_out_speed );
87
+
88
+
89
+ jQuery.post( ajaxurl, { action: 'wppb_add_on_download_zip_file', wppb_add_on_download_url: download_url, wppb_add_on_zip_name: file_name, wppb_add_on_name: add_on_name, wppb_add_on_index: add_on_index }, function( response ) {
90
+
91
+ // Check if we have any errors and display a message to the user
92
+ if( response.indexOf('error') === 0 ) {
93
+ response = response.split('-');
94
+ add_on_index = response[1];
95
+
96
+ $download_button = jQuery('.wppb-add-on').eq( add_on_index ).find('.button');
97
+ $error_message = jQuery('.wppb-add-on').eq( add_on_index).find('.wppb-error-manual-install');
98
+
99
+ $download_button
100
+ .blur()
101
+ .removeAttr('disabled')
102
+ .text( jQuery('#wppb-add-on-activated-error-button-text').text() );
103
+
104
+ $spinner = $download_button.siblings('.spinner');
105
+ $spinner.animate({
106
+ opacity: 0
107
+ }, 0);
108
+
109
+ // Remove the current displayed message
110
+ wppb_add_on_remove_status_message( $download_button, fade_in_out_speed);
111
+
112
+ // Set status confirmation message
113
+ wppb_add_on_set_status_message( $download_button, 'dashicons-no-alt', $error_message.html(), fade_in_out_speed, fade_in_out_speed, false );
114
+
115
+ return false;
116
+ }
117
+
118
+ // If everything goes well go ahead and
119
+ var add_on_index = response;
120
+ jQuery.post( ajaxurl, { action: 'wppb_add_on_get_new_plugin_data', wppb_add_on_name: add_on_name }, function( plugin_path ) {
121
+
122
+ $download_button = jQuery('.wppb-add-on').eq( add_on_index ).find('.button');
123
+
124
+ $download_button
125
+ .blur()
126
+ .removeClass('wppb-add-on-download')
127
+ .addClass('wppb-add-on-activate')
128
+ .attr('href', plugin_path )
129
+ .removeAttr('disabled')
130
+ .text( jQuery('#wppb-add-on-activate-button-text').text() );
131
+
132
+ $spinner = $download_button.siblings('.spinner');
133
+ $spinner.animate({
134
+ opacity: 0
135
+ }, 0);
136
+
137
+ // Remove the current displayed message
138
+ wppb_add_on_remove_status_message( $download_button, fade_in_out_speed);
139
+
140
+ // Set status confirmation message
141
+ wppb_add_on_set_status_message( $download_button, 'dashicons-yes', jQuery('#wppb-add-on-download-finished-message-text').text(), fade_in_out_speed, fade_in_out_speed, true );
142
+
143
+ });
144
+
145
+ });
146
+ }
147
+
148
+
149
+ /*
150
+ * Function that activates the add-on
151
+ */
152
+ function wppb_add_on_activate( $button ) {
153
+ $activate_button = $button;
154
+
155
+ var fade_in_out_speed = 300;
156
+ var plugin = $activate_button.attr('href');
157
+ var add_on_index = $activate_button.parents('.wppb-add-on').index('.wppb-add-on');
158
+
159
+ $activate_button
160
+ .attr('disabled', true);
161
+
162
+ $spinner = $activate_button.siblings('.spinner');
163
+
164
+ $spinner.animate({
165
+ opacity: 0.7
166
+ }, 100);
167
+
168
+ // Remove the current displayed message
169
+ wppb_add_on_remove_status_message( $activate_button, fade_in_out_speed);
170
+
171
+ jQuery.post( ajaxurl, { action: 'wppb_add_on_activate', wppb_add_on_to_activate: plugin, wppb_add_on_index: add_on_index }, function( response ) {
172
+
173
+ add_on_index = response;
174
+
175
+ $activate_button = jQuery('.wppb-add-on').eq( add_on_index ).find('.button');
176
+
177
+ $activate_button
178
+ .blur()
179
+ .removeClass('wppb-add-on-activate')
180
+ .addClass('wppb-add-on-deactivate')
181
+ .removeAttr('disabled')
182
+ .text( jQuery('#wppb-add-on-deactivate-button-text').text() );
183
+
184
+ $spinner = $activate_button.siblings('.spinner');
185
+
186
+ $spinner.animate({
187
+ opacity: 0
188
+ }, 0);
189
+
190
+ // Set status confirmation message
191
+ wppb_add_on_set_status_message( $activate_button, 'dashicons-yes', jQuery('#wppb-add-on-activated-message-text').text(), fade_in_out_speed, 0, true );
192
+ wppb_add_on_remove_status_message( $activate_button, fade_in_out_speed, 2000 );
193
+
194
+ // Set is active message
195
+ wppb_add_on_set_status_message( $activate_button, 'dashicons-yes', jQuery('#wppb-add-on-is-active-message-text').html(), fade_in_out_speed, 2000 + fade_in_out_speed );
196
+ });
197
+ }
198
+
199
+
200
+
201
+ /*
202
+ * Function that deactivates the add-on
203
+ */
204
+ function wppb_add_on_deactivate( $button ) {
205
+
206
+ var fade_in_out_speed = 300;
207
+ var plugin = $button.attr('href');
208
+ var add_on_index = $button.parents('.wppb-add-on').index('.wppb-add-on');
209
+
210
+ $button
211
+ .removeClass('wppb-add-on-deactivate')
212
+ .attr('disabled', true);
213
+
214
+ $spinner = $button.siblings('.spinner');
215
+
216
+ $spinner.animate({
217
+ opacity: 0.7
218
+ }, 100);
219
+
220
+ // Remove the current displayed message
221
+ wppb_add_on_remove_status_message( $button, fade_in_out_speed );
222
+
223
+ jQuery.post( ajaxurl, { action: 'wppb_add_on_deactivate', wppb_add_on_to_deactivate: plugin, wppb_add_on_index: add_on_index }, function( response ) {
224
+
225
+ add_on_index = response;
226
+
227
+ $button = jQuery('.wppb-add-on').eq( add_on_index ).find('.button');
228
+
229
+ $button
230
+ .blur()
231
+ .removeClass('wppb-add-on-is-active')
232
+ .addClass('wppb-add-on-activate')
233
+ .attr( 'disabled', false )
234
+ .text( jQuery('#wppb-add-on-activate-button-text').text() );
235
+
236
+ $spinner = $button.siblings('.spinner');
237
+
238
+ $spinner.animate({
239
+ opacity: 0
240
+ }, 0);
241
+
242
+ // Set status confirmation message
243
+ wppb_add_on_set_status_message( $button, 'dashicons-yes', jQuery('#wppb-add-on-deactivated-message-text').text(), fade_in_out_speed, 0, true );
244
+ wppb_add_on_remove_status_message( $button, fade_in_out_speed, 2000 );
245
+
246
+ // Set is active message
247
+ wppb_add_on_set_status_message( $button, 'dashicons-no-alt', jQuery('#wppb-add-on-is-not-active-message-text').html(), fade_in_out_speed, 2000 + fade_in_out_speed );
248
+
249
+ });
250
+ }
251
+
252
+
253
+ /*
254
+ * Function used to remove the status message of an add-on
255
+ *
256
+ * @param object $button - The jQuery object of the add-on box button that was pressed
257
+ * @param int fade_in_out_speed - The speed of the fade in and out animations
258
+ * @param int delay - Delay removing of the message
259
+ *
260
+ */
261
+ function wppb_add_on_remove_status_message( $button, fade_in_out_speed, delay ) {
262
+
263
+ if( typeof( delay ) == 'undefined' ) {
264
+ delay = 0;
265
+ }
266
+
267
+ setTimeout( function() {
268
+
269
+ $button.siblings('.dashicons')
270
+ .animate({
271
+ opacity: 0
272
+ }, fade_in_out_speed );
273
+
274
+ $button.siblings('.wppb-add-on-message')
275
+ .animate({
276
+ opacity: 0
277
+ }, fade_in_out_speed );
278
+
279
+ }, delay);
280
+
281
+ }
282
+
283
+ /*
284
+ * Function used to remove the status message of an add-on
285
+ *
286
+ * @param object $button - The jQuery object of the add-on box button that was pressed
287
+ * @param string message_icon_class - The string name of the class we want the icon to have
288
+ * @param string message_text - The text we want the user to see
289
+ * @param int fade_in_out_speed - The speed of the fade in and out animations
290
+ * @param bool success - If true adds a class to style the message as a success one, if false adds a class to style the message as a failure
291
+ *
292
+ */
293
+ function wppb_add_on_set_status_message( $button, message_icon_class, message_text, fade_in_out_speed, delay, success ) {
294
+
295
+ if( typeof( delay ) == 'undefined' ) {
296
+ delay = 0;
297
+ }
298
+
299
+ setTimeout(function() {
300
+
301
+ $button.siblings('.dashicons')
302
+ .css('opacity', 0)
303
+ .attr('class', 'dashicons')
304
+ .addClass( message_icon_class )
305
+ .animate({ opacity: 1}, fade_in_out_speed);
306
+
307
+ $button.siblings('.wppb-add-on-message')
308
+ .css('opacity', 0)
309
+ .attr( 'class', 'wppb-add-on-message' )
310
+ .html( message_text )
311
+ .animate({ opacity: 1}, fade_in_out_speed);
312
+
313
+ if( typeof( success ) != 'undefined' ) {
314
+ if( success == true ) {
315
+ $button.siblings('.dashicons')
316
+ .addClass('wppb-confirmation-success');
317
+ $button.siblings('.wppb-add-on-message')
318
+ .addClass('wppb-confirmation-success');
319
+ } else if( success == false ) {
320
+ $button.siblings('.dashicons')
321
+ .addClass('wppb-confirmation-error');
322
+ $button.siblings('.wppb-add-on-message')
323
+ .addClass('wppb-confirmation-error');
324
+ }
325
+ }
326
+
327
+ }, delay );
328
+
329
+ }
assets/js/jquery-pb-sitewide.js CHANGED
@@ -106,4 +106,4 @@ jQuery( function() {
106
  jQuery('#' + jQuery(this).attr('href')).dialog('open');
107
  });
108
  });
109
- });
106
  jQuery('#' + jQuery(this).attr('href')).dialog('open');
107
  });
108
  });
109
+ });
features/functions.php CHANGED
@@ -234,13 +234,16 @@ function wppb_print_cpt_script( $hook ){
234
  wp_enqueue_script( 'wppb-manage-fields-live-change', WPPB_PLUGIN_URL . 'assets/js/jquery-manage-fields-live-change.js', array(), PROFILE_BUILDER_VERSION, true );
235
  }
236
 
237
- if ( ( $hook == 'profile-builder_page_manage-fields' ) || ( $hook == 'profile-builder_page_profile-builder-basic-info' ) || ( $hook == 'profile-builder_page_profile-builder-modules' ) || ( $hook == 'profile-builder_page_profile-builder-general-settings' ) || ( $hook == 'profile-builder_page_profile-builder-admin-bar-settings' ) || ( $hook == 'profile-builder_page_profile-builder-register' ) || ( $hook == 'profile-builder_page_profile-builder-wppb_userListing' ) || ( $hook == 'profile-builder_page_profile-builder-wppb_customRedirect' ) || ( $hook == 'profile-builder_page_profile-builder-wppb_emailCustomizer' ) || ( $hook == 'profile-builder_page_profile-builder-wppb_emailCustomizerAdmin' ) ){
238
  wp_enqueue_style( 'wppb-back-end-style', WPPB_PLUGIN_URL . 'assets/css/style-back-end.css', false, PROFILE_BUILDER_VERSION );
239
  }
240
 
241
  if ( $hook == 'profile-builder_page_profile-builder-general-settings' )
242
  wp_enqueue_script( 'wppb-manage-fields-live-change', WPPB_PLUGIN_URL . 'assets/js/jquery-email-confirmation.js', array(), PROFILE_BUILDER_VERSION, true );
243
-
 
 
 
244
  if ( isset( $_GET['post_type'] ) || isset( $_GET['post'] ) ){
245
  if ( isset( $_GET['post_type'] ) )
246
  $post_type = $_GET['post_type'];
234
  wp_enqueue_script( 'wppb-manage-fields-live-change', WPPB_PLUGIN_URL . 'assets/js/jquery-manage-fields-live-change.js', array(), PROFILE_BUILDER_VERSION, true );
235
  }
236
 
237
+ if ( ( $hook == 'profile-builder_page_manage-fields' ) || ( $hook == 'profile-builder_page_profile-builder-basic-info' ) || ( $hook == 'profile-builder_page_profile-builder-modules' ) || ( $hook == 'profile-builder_page_profile-builder-general-settings' ) || ( $hook == 'profile-builder_page_profile-builder-admin-bar-settings' ) || ( $hook == 'profile-builder_page_profile-builder-register' ) || ( $hook == 'profile-builder_page_profile-builder-wppb_userListing' ) || ( $hook == 'profile-builder_page_profile-builder-wppb_customRedirect' ) || ( $hook == 'profile-builder_page_profile-builder-wppb_emailCustomizer' ) || ( $hook == 'profile-builder_page_profile-builder-wppb_emailCustomizerAdmin' ) || ( $hook == 'profile-builder_page_profile-builder-add-ons' ) ){
238
  wp_enqueue_style( 'wppb-back-end-style', WPPB_PLUGIN_URL . 'assets/css/style-back-end.css', false, PROFILE_BUILDER_VERSION );
239
  }
240
 
241
  if ( $hook == 'profile-builder_page_profile-builder-general-settings' )
242
  wp_enqueue_script( 'wppb-manage-fields-live-change', WPPB_PLUGIN_URL . 'assets/js/jquery-email-confirmation.js', array(), PROFILE_BUILDER_VERSION, true );
243
+
244
+ if( $hook == 'profile-builder_page_profile-builder-add-ons' )
245
+ wp_enqueue_script( 'wppb-add-ons', WPPB_PLUGIN_URL . 'assets/js/jquery-pb-add-ons.js', array(), PROFILE_BUILDER_VERSION, true );
246
+
247
  if ( isset( $_GET['post_type'] ) || isset( $_GET['post'] ) ){
248
  if ( isset( $_GET['post_type'] ) )
249
  $post_type = $_GET['post_type'];
front-end/class-formbuilder.php CHANGED
@@ -5,6 +5,7 @@ class Profile_Builder_Form_Creator{
5
  'form_fields' => array(),
6
  'form_name' => '',
7
  'role' => '', //used only for the register-form settings
 
8
  );
9
  private $args;
10
 
@@ -36,14 +37,15 @@ class Profile_Builder_Form_Creator{
36
  function wppb_retrieve_custom_settings(){
37
  $this->args['login_after_register'] = apply_filters( 'wppb_automatically_login_after_register', 'No' ); //used only for the register-form settings
38
  $this->args['redirect_activated'] = apply_filters( 'wppb_redirect_default_setting', '' );
39
- $this->args['redirect_url'] = apply_filters( 'wppb_redirect_default_location', wppb_curpageurl() );
40
  /* for register forms check to see if we have a custom redirect "Redirect After Register" */
41
  if( PROFILE_BUILDER == 'Profile Builder Pro' ) {
42
  if ($this->args['form_type'] == 'register') {
43
  $wppb_module_settings = get_option('wppb_module_settings');
44
  if (isset($wppb_module_settings['wppb_customRedirect']) && ($wppb_module_settings['wppb_customRedirect'] == 'show')) {
45
  $custom_redirect = get_option('customRedirectSettings');
46
- if (isset($custom_redirect['afterRegister']) && ($custom_redirect['afterRegister'] == 'yes') && (trim($custom_redirect['afterRegisterTarget']) != '')) {
 
47
  $this->args['redirect_url'] = $this->args['custom_redirect_after_register_url'] = apply_filters('wppb_redirect_default_location', $custom_redirect['afterRegisterTarget']);
48
  }
49
  }
@@ -124,11 +126,10 @@ class Profile_Builder_Form_Creator{
124
  }
125
 
126
  function wppb_get_redirect(){
127
- if ( $this->args['login_after_register'] == 'Yes' )
128
  return $this->wppb_log_in_user();
129
- if ( $this->args['redirect_activated'] == 'No' || ( $this->args['form_type'] == 'edit_profile' && $this->args['form_name'] == 'unspecified' ) || ( $this->args['form_type'] == 'register' && $this->args['form_name'] == 'unspecified' && wppb_curpageurl() == $this->args['redirect_url'] ) )
130
  return '';
131
-
132
  /* if we don't have a preference on the form for redirect then if we have a custom redirect "after register redirect" option redirect to that if not don't do anything */
133
  if ( $this->args['redirect_activated'] == '-' ){
134
  if( !empty( $this->args['custom_redirect_after_register_url'] ) )
5
  'form_fields' => array(),
6
  'form_name' => '',
7
  'role' => '', //used only for the register-form settings
8
+ 'redirect_url' => '',
9
  );
10
  private $args;
11
 
37
  function wppb_retrieve_custom_settings(){
38
  $this->args['login_after_register'] = apply_filters( 'wppb_automatically_login_after_register', 'No' ); //used only for the register-form settings
39
  $this->args['redirect_activated'] = apply_filters( 'wppb_redirect_default_setting', '' );
40
+ $this->args['redirect_url'] = apply_filters( 'wppb_redirect_default_location', ($this->args['redirect_url'] != '') ? $this->args['redirect_url'] : wppb_curpageurl() );
41
  /* for register forms check to see if we have a custom redirect "Redirect After Register" */
42
  if( PROFILE_BUILDER == 'Profile Builder Pro' ) {
43
  if ($this->args['form_type'] == 'register') {
44
  $wppb_module_settings = get_option('wppb_module_settings');
45
  if (isset($wppb_module_settings['wppb_customRedirect']) && ($wppb_module_settings['wppb_customRedirect'] == 'show')) {
46
  $custom_redirect = get_option('customRedirectSettings');
47
+ //Make sure Custom Redirects are set and there was no "redirect_url" parameter set in the shortcode
48
+ if (isset($custom_redirect['afterRegister']) && ($custom_redirect['afterRegister'] == 'yes') && (trim($custom_redirect['afterRegisterTarget']) != '') && ($this->args['redirect_url'] == wppb_curpageurl())) {
49
  $this->args['redirect_url'] = $this->args['custom_redirect_after_register_url'] = apply_filters('wppb_redirect_default_location', $custom_redirect['afterRegisterTarget']);
50
  }
51
  }
126
  }
127
 
128
  function wppb_get_redirect(){
129
+ if ( $this->args['login_after_register'] == 'Yes' )
130
  return $this->wppb_log_in_user();
131
+ if ( $this->args['redirect_activated'] == 'No' || ( $this->args['form_type'] == 'edit_profile' && $this->args['form_name'] == 'unspecified' && wppb_curpageurl() == $this->args['redirect_url'] ) || ( $this->args['form_type'] == 'register' && $this->args['form_name'] == 'unspecified' && wppb_curpageurl() == $this->args['redirect_url'] ) )
132
  return '';
 
133
  /* if we don't have a preference on the form for redirect then if we have a custom redirect "after register redirect" option redirect to that if not don't do anything */
134
  if ( $this->args['redirect_activated'] == '-' ){
135
  if( !empty( $this->args['custom_redirect_after_register_url'] ) )
front-end/edit-profile.php CHANGED
@@ -52,9 +52,9 @@ function wppb_autologin_after_password_changed(){
52
 
53
  function wppb_front_end_profile_info( $atts ){
54
  // get value set in the shortcode as parameter, still need to default to something else than empty string
55
- extract( shortcode_atts( array( 'form_name' => 'unspecified' ), $atts, 'wppb-edit-profile' ) );
56
  global $$form_name;
57
- $$form_name = new Profile_Builder_Form_Creator( array( 'form_type' => 'edit_profile', 'form_name' => $form_name ) );
58
 
59
  return $$form_name;
60
  }
52
 
53
  function wppb_front_end_profile_info( $atts ){
54
  // get value set in the shortcode as parameter, still need to default to something else than empty string
55
+ extract( shortcode_atts( array( 'form_name' => 'unspecified', 'redirect_url' => '' ), $atts, 'wppb-edit-profile' ) );
56
  global $$form_name;
57
+ $$form_name = new Profile_Builder_Form_Creator( array( 'form_type' => 'edit_profile', 'form_name' => $form_name, 'redirect_url' => $redirect_url ) );
58
 
59
  return $$form_name;
60
  }
front-end/login.php CHANGED
@@ -132,7 +132,7 @@ add_filter( 'login_redirect', 'wppb_login_redirect', 10, 3 );
132
  /* shortcode function */
133
  function wppb_front_end_login( $atts ){
134
 
135
- extract( shortcode_atts( array( 'display' => true, 'redirect' =>'', 'register_url'=>'', 'lostpassword_url'=>'' ), $atts ) );
136
 
137
  $wppb_generalSettings = get_option('wppb_general_settings');
138
 
@@ -140,6 +140,9 @@ function wppb_front_end_login( $atts ){
140
  // set up the form arguments
141
  $form_args = array( 'echo' => false, 'id_submit' => 'wppb-submit' );
142
 
 
 
 
143
  // maybe set up the redirect argument
144
  if( empty( $redirect ) ){
145
  if( PROFILE_BUILDER == 'Profile Builder Pro' ) {
132
  /* shortcode function */
133
  function wppb_front_end_login( $atts ){
134
 
135
+ extract( shortcode_atts( array( 'display' => true, 'redirect' => '', 'redirect_url' => '', 'register_url' => '', 'lostpassword_url' => '' ), $atts ) );
136
 
137
  $wppb_generalSettings = get_option('wppb_general_settings');
138
 
140
  // set up the form arguments
141
  $form_args = array( 'echo' => false, 'id_submit' => 'wppb-submit' );
142
 
143
+ //Add support for "redirect_url" parameter for Login shortcode (will do the same thing as "redirect" - for consistency with Register, Edit Profile shortcodes)
144
+ if ( !empty($redirect_url) ) $redirect = $redirect_url;
145
+
146
  // maybe set up the redirect argument
147
  if( empty( $redirect ) ){
148
  if( PROFILE_BUILDER == 'Profile Builder Pro' ) {
front-end/recover.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Function that checks if a user is approved before reseting the password
4
  *
5
  * @param string $data either the user login or the users email
6
  * @param string $what what field we query for when getting the user
@@ -8,7 +8,7 @@
8
  function wppb_check_for_unapproved_user( $data, $what ){
9
  $retMessage = '';
10
  $messageNo = '';
11
-
12
  $wppb_generalSettings = get_option( 'wppb_general_settings' );
13
  if( !empty( $wppb_generalSettings['adminApproval'] ) && $wppb_generalSettings['adminApproval'] == 'yes' ){
14
  $user = ( ( $what == 'user_email' ) ? get_user_by( 'email', $data ) : get_user_by( 'login', $data ) );
@@ -16,11 +16,11 @@ function wppb_check_for_unapproved_user( $data, $what ){
16
  if ( wp_get_object_terms( $user->data->ID, 'user_status' ) ){
17
  $retMessage = '<strong>'. __('ERROR', 'profilebuilder') . '</strong>: ' . __('Your account has to be confirmed by an administrator before you can use the "Password Reset" feature.', 'profilebuilder');
18
  $retMessage = apply_filters('wppb_recover_password_unapporved_user', $retMessage);
19
-
20
  $messageNo = '6';
21
  }
22
  }
23
-
24
  return array( $retMessage, $messageNo );
25
  }
26
 
@@ -28,7 +28,7 @@ function wppb_check_for_unapproved_user( $data, $what ){
28
  * Function that retrieves the unique user key from the database. If we don't have one we generate one and add it to the database
29
  *
30
  * @param string $requested_user_login the user login
31
- *
32
  */
33
  function wppb_retrieve_activation_key( $requested_user_login ){
34
  global $wpdb;
@@ -40,11 +40,11 @@ function wppb_retrieve_activation_key( $requested_user_login ){
40
  // Generate something random for a key...
41
  $key = wp_generate_password( 20, false );
42
  do_action('wppb_retrieve_password_key', $requested_user_login, $key);
43
-
44
  // Now insert the new md5 key into the db
45
  $wpdb->update($wpdb->users, array('user_activation_key' => $key), array('user_login' => $requested_user_login));
46
  }
47
-
48
  return $key;
49
  }
50
 
@@ -52,7 +52,7 @@ function wppb_retrieve_activation_key( $requested_user_login ){
52
  * Function that creates a generate new password form
53
  *
54
  * @param array $post_data $_POST
55
- *
56
  */
57
  function wppb_create_recover_password_form( $user, $post_data ){
58
  ?>
@@ -92,8 +92,8 @@ function wppb_create_recover_password_form( $user, $post_data ){
92
  <input name="recover_password2" type="submit" id="wppb-recover-password-button" class="submit button" value="<?php echo apply_filters('wppb_recover_password_button_name1', $button_name); ?>" />
93
  <input name="action2" type="hidden" id="action2" value="recover_password2" />
94
  </p><!-- .form-submit -->
95
- <?php wp_nonce_field( 'verify_true_password_recovery2_'.$user->ID, 'password_recovery_nonce_field2' ); ?>
96
- </form><!-- #recover_password -->
97
  <?php
98
  }
99
 
@@ -102,16 +102,16 @@ function wppb_create_recover_password_form( $user, $post_data ){
102
  *
103
  * @param WP_User $user the user object
104
  * @param array $post_data $_POST
105
- *
106
  */
107
  function wppb_create_generate_password_form( $post_data ){
108
  ?>
109
  <form enctype="multipart/form-data" method="post" id="wppb-recover-password" class="wppb-user-forms" action="<?php echo add_query_arg( 'submitted', 'yes', wppb_curpageurl() ); ?>">
110
- <?php
111
  $recover_notification = '<p>' . __( 'Please enter your username or email address.', 'profilebuilder' );
112
  $recover_notification .= '<br/>'.__( 'You will receive a link to create a new password via email.', 'profilebuilder' ).'</p>';
113
  echo apply_filters( 'wppb_recover_password_message1', $recover_notification );
114
-
115
  $username_email = ( isset( $post_data['username_email'] ) ? $post_data['username_email'] : '' );
116
 
117
  $recover_input = '<ul>
@@ -120,7 +120,7 @@ function wppb_create_recover_password_form( $user, $post_data ){
120
  <input class="text-input" name="username_email" type="text" id="username_email" value="'.trim( $username_email ).'" />
121
  </li><!-- .username_email --></ul>';
122
  echo apply_filters( 'wppb_recover_password_gemerate_password_input', $recover_input, trim( $username_email ) );
123
- ?>
124
  <p class="form-submit">
125
  <?php $button_name = __('Get New Password', 'profilebuilder'); ?>
126
  <input name="recover_password" type="submit" id="wppb-recover-password-button" class="submit button" value="<?php echo apply_filters('wppb_recover_password_button_name3', $button_name); ?>" />
@@ -139,36 +139,36 @@ function wppb_front_end_password_recovery(){
139
  global $wppb_shortcode_on_front;
140
  $wppb_shortcode_on_front = true;
141
  $message = $messageNo = $message2 = $messageNo2 = $linkLoginName = $linkKey = '';
142
-
143
  global $wpdb;
144
 
145
  ob_start();
146
 
147
  //Get general settings
148
  $wppb_generalSettings = get_option( 'wppb_general_settings' );
149
-
150
  // If the user entered an email/username, process the request
151
  if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'recover_password' && wp_verify_nonce($_POST['password_recovery_nonce_field'],'verify_true_password_recovery') ) {
152
-
153
  $postedData = $_POST['username_email']; //we get the raw data
154
  //check to see if it's an e-mail (and if this is valid/present in the database) or is a username
155
-
156
-
157
  // if we do not have an email in the posted date we try to get the email for that user
158
  if( !is_email( $postedData ) ){
159
  if (username_exists($postedData)){
160
  $query = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE user_login= %s", $postedData ) );
161
  if( !empty( $query[0] ) ){
162
- $postedData = $query[0]->user_email;
163
  }
164
  }
165
  else{
166
  $message = __( 'The username entered wasn\'t found in the database!', 'profilebuilder').'<br/>'.__('Please check that you entered the correct username.', 'profilebuilder' );
167
  $message = apply_filters( 'wppb_recover_password_sent_message4', $message );
168
  $messageNo = '4';
169
- }
170
  }
171
-
172
  // we should have an email by this point
173
  if ( is_email( $postedData ) ){
174
  if ( email_exists( $postedData ) ){
@@ -176,34 +176,34 @@ function wppb_front_end_password_recovery(){
176
  if ($retVal[0] != ''){
177
  $message = $retVal[0];
178
  $messageNo = $retVal [1];
179
-
180
  }else{
181
  $message = sprintf( __( 'Check your e-mail for the confirmation link.', 'profilebuilder'), $postedData );
182
  $message = apply_filters( 'wppb_recover_password_sent_message1', $message, $postedData );
183
  $messageNo = '1';
184
-
185
  //verify e-mail validity
186
  $query = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE user_email= %s", $postedData ) );
187
  if( !empty( $query[0] ) ){
188
  $requestedUserID = $query[0]->ID;
189
- $requestedUserLogin = $query[0]->user_login;
190
  $requestedUserEmail = $query[0]->user_email;
191
 
192
  if( $wppb_generalSettings['loginWith'] == 'username' )
193
  $display_username_email = $query[0]->user_login;
194
  else
195
  $display_username_email = $query[0]->user_email;
196
-
197
  //search if there is already an activation key present, if not create one
198
  $key = wppb_retrieve_activation_key( $requestedUserLogin );
199
-
200
  //send primary email message
201
  $recoveruserMailMessage1 = sprintf( __('Someone requested that the password be reset for the following account: <b>%1$s</b><br/>If this was a mistake, just ignore this email and nothing will happen.<br/>To reset your password, visit the following link:%2$s', 'profilebuilder'), $display_username_email, '<a href="'.add_query_arg( array( 'loginName' => $requestedUserLogin, 'key' => $key ), wppb_curpageurl() ).'">'.add_query_arg( array( 'loginName' => $requestedUserLogin, 'key' => $key ), wppb_curpageurl() ).'</a>');
202
- $recoveruserMailMessage1 = apply_filters( 'wppb_recover_password_message_content_sent_to_user1', $recoveruserMailMessage1, $requestedUserID, $requestedUserLogin );
203
-
204
  $recoveruserMailMessageTitle1 = sprintf(__('Password Reset from "%1$s"', 'profilebuilder'), $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES));
205
- $recoveruserMailMessageTitle1 = apply_filters('wppb_recover_password_message_title_sent_to_user1', $recoveruserMailMessageTitle1);
206
-
207
  //we add this filter to enable html encoding
208
  add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));
209
  //send mail to the user notifying him of the reset request
@@ -217,14 +217,14 @@ function wppb_front_end_password_recovery(){
217
  }
218
  }
219
  }
220
-
221
  }elseif ( !email_exists( $postedData ) ){
222
  $message = __('The email address entered wasn\'t found in the database!', 'profilebuilder').'<br/>'.__('Please check that you entered the correct email address.', 'profilebuilder');
223
  $message = apply_filters('wppb_recover_password_sent_message2', $message);
224
  $messageNo = '2';
225
  }
226
- }
227
-
228
  }
229
  // If the user used the correct key-code, update his/her password
230
  elseif ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action2'] ) && $_POST['action2'] == 'recover_password2' && wp_verify_nonce( $_POST['password_recovery_nonce_field2'], 'verify_true_password_recovery2_'.$_POST['userData'] ) ) {
@@ -264,10 +264,10 @@ function wppb_front_end_password_recovery(){
264
 
265
  //send secondary mail to the user containing the username and the new password
266
  $recoveruserMailMessage2 = sprintf( __( 'You have successfully reset your password to: %1$s', 'profilebuilder' ), $new_pass );
267
- $recoveruserMailMessage2 = apply_filters( 'wppb_recover_password_message_content_sent_to_user2', $recoveruserMailMessage2, $display_username_email );
268
 
269
  $recoveruserMailMessageTitle2 = sprintf( __('Password Successfully Reset for %1$s on "%2$s"', 'profilebuilder' ), $display_username_email, $blogname = wp_specialchars_decode( get_option('blogname'), ENT_QUOTES ) );
270
- $recoveruserMailMessageTitle2 = apply_filters( 'wppb_recover_password_message_title_sent_to_user2', $recoveruserMailMessageTitle2 );
271
 
272
  //we add this filter to enable html encoding
273
  add_filter( 'wp_mail_content_type',create_function( '', 'return "text/html"; ') );
@@ -278,15 +278,15 @@ function wppb_front_end_password_recovery(){
278
 
279
  //send email to admin
280
  $recoveradminMailMessage = sprintf( __( '%1$s has requested a password change via the password reset feature.<br/>His/her new password is:%2$s', 'profilebuilder' ), $display_username_email, $_POST['passw1'] );
281
- $recoveradminMailMessage = apply_filters( 'wppb_recover_password_message_content_sent_to_admin', $recoveradminMailMessage );
282
 
283
  $recoveradminMailMessageTitle = sprintf( __( 'Password Successfully Reset for %1$s on "%2$s"', 'profilebuilder' ), $display_username_email, $blogname = wp_specialchars_decode( get_option('blogname'), ENT_QUOTES ) );
284
- $recoveradminMailMessageTitle = apply_filters( 'wppb_recover_password_message_title_sent_to_admin', $recoveradminMailMessageTitle );
285
 
286
 
287
  //we disable the feature to send the admin a notification mail but can be still used using filters
288
  $recoveradminMailMessageTitle = '';
289
- $recoveradminMailMessageTitle = apply_filters( 'wppb_recover_password_message_title_sent_to_admin', $recoveradminMailMessageTitle );
290
 
291
  //we add this filter to enable html encoding
292
  add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));
@@ -299,9 +299,9 @@ function wppb_front_end_password_recovery(){
299
  $message2 = __( 'The entered passwords don\'t match!', 'profilebuilder' );
300
  $messageNo2 = '2';
301
  }
302
-
303
  }
304
-
305
  ?>
306
 
307
  <div class="wppb_holder" id="wppb-recover-password">
@@ -318,54 +318,54 @@ function wppb_front_end_password_recovery(){
318
  $login = $_GET['loginName'];
319
 
320
  $user = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE user_activation_key = %s AND user_login = %s", $key, $login ) );
321
-
322
  if( !empty( $user ) ){
323
  //check if the "finalAction" variable is not in the address bar, if it is, don't display the form anymore
324
  if( isset( $_GET['finalAction'] ) && ( $_GET['finalAction'] == 'yes' ) ){
325
  if( $messageNo2 == '2' ){
326
  echo apply_filters( 'wppb_recover_password_password_changed_message2', '<p class="wppb-error">'.$message2.'</p>', $message2 );
327
-
328
  wppb_create_recover_password_form( $user, $_POST );
329
 
330
  }elseif( $messageNo2 == '1' )
331
- echo apply_filters( 'wppb_recover_password_password_changed_message1', '<p class="wppb-success">'.$message2.'</p>', $message2 );
332
-
333
  }else{
334
  wppb_create_recover_password_form( $user, $_POST );
335
  }
336
  }else{
337
  if( $messageNo2 == '1' )
338
- echo apply_filters( 'wppb_recover_password_password_changed_message1', '<p class="wppb-success">'.$message2.'</p>', $message2 );
339
-
340
  elseif( $messageNo2 == '2' )
341
  echo apply_filters( 'wppb_recover_password_password_changed_message2', '<p class="wppb-error">'.$message2.'</p>', $message2 );
342
-
343
  else
344
  echo apply_filters( 'wppb_recover_password_invalid_key_message', '<p class="wppb-warning"><b>'.__( 'ERROR:', 'profilebuilder' ).'</b>'.__( 'Invalid key!', 'profilebuilder' ).'</p>' );
345
  }
346
-
347
  }else{
348
  //display error message and the form
349
  if (($messageNo == '') || ($messageNo == '2') || ($messageNo == '4')){
350
  echo apply_filters( 'wppb_recover_password_displayed_message1', '<p class="wppb-warning">'.$message.'</p>' );
351
-
352
  wppb_create_generate_password_form( $_POST );
353
-
354
  }elseif (($messageNo == '5') || ($messageNo == '6'))
355
- echo apply_filters( 'wppb_recover_password_displayed_message1', '<p class="wppb-warning">'.$message.'</p>' );
356
-
357
  else
358
- echo apply_filters( 'wppb_recover_password_displayed_message2', '<p class="wppb-success">'.$message.'</p>' ); //display success message
359
  }
360
-
361
  // use this action hook to add extra content after the password recovery form.
362
  do_action( 'wppb_after_recover_password_fields' );
363
  ?>
364
  </div>
365
-
366
  <?php
367
  $output = ob_get_contents();
368
- ob_end_clean();
369
-
370
  return $output;
371
  }
1
  <?php
2
  /**
3
+ * Function that checks if a user is approved before reseting the password
4
  *
5
  * @param string $data either the user login or the users email
6
  * @param string $what what field we query for when getting the user
8
  function wppb_check_for_unapproved_user( $data, $what ){
9
  $retMessage = '';
10
  $messageNo = '';
11
+
12
  $wppb_generalSettings = get_option( 'wppb_general_settings' );
13
  if( !empty( $wppb_generalSettings['adminApproval'] ) && $wppb_generalSettings['adminApproval'] == 'yes' ){
14
  $user = ( ( $what == 'user_email' ) ? get_user_by( 'email', $data ) : get_user_by( 'login', $data ) );
16
  if ( wp_get_object_terms( $user->data->ID, 'user_status' ) ){
17
  $retMessage = '<strong>'. __('ERROR', 'profilebuilder') . '</strong>: ' . __('Your account has to be confirmed by an administrator before you can use the "Password Reset" feature.', 'profilebuilder');
18
  $retMessage = apply_filters('wppb_recover_password_unapporved_user', $retMessage);
19
+
20
  $messageNo = '6';
21
  }
22
  }
23
+
24
  return array( $retMessage, $messageNo );
25
  }
26
 
28
  * Function that retrieves the unique user key from the database. If we don't have one we generate one and add it to the database
29
  *
30
  * @param string $requested_user_login the user login
31
+ *
32
  */
33
  function wppb_retrieve_activation_key( $requested_user_login ){
34
  global $wpdb;
40
  // Generate something random for a key...
41
  $key = wp_generate_password( 20, false );
42
  do_action('wppb_retrieve_password_key', $requested_user_login, $key);
43
+
44
  // Now insert the new md5 key into the db
45
  $wpdb->update($wpdb->users, array('user_activation_key' => $key), array('user_login' => $requested_user_login));
46
  }
47
+
48
  return $key;
49
  }
50
 
52
  * Function that creates a generate new password form
53
  *
54
  * @param array $post_data $_POST
55
+ *
56
  */
57
  function wppb_create_recover_password_form( $user, $post_data ){
58
  ?>
92
  <input name="recover_password2" type="submit" id="wppb-recover-password-button" class="submit button" value="<?php echo apply_filters('wppb_recover_password_button_name1', $button_name); ?>" />
93
  <input name="action2" type="hidden" id="action2" value="recover_password2" />
94
  </p><!-- .form-submit -->
95
+ <?php wp_nonce_field( 'verify_true_password_recovery2_'.$user->ID, 'password_recovery_nonce_field2' ); ?>
96
+ </form><!-- #recover_password -->
97
  <?php
98
  }
99
 
102
  *
103
  * @param WP_User $user the user object
104
  * @param array $post_data $_POST
105
+ *
106
  */
107
  function wppb_create_generate_password_form( $post_data ){
108
  ?>
109
  <form enctype="multipart/form-data" method="post" id="wppb-recover-password" class="wppb-user-forms" action="<?php echo add_query_arg( 'submitted', 'yes', wppb_curpageurl() ); ?>">
110
+ <?php
111
  $recover_notification = '<p>' . __( 'Please enter your username or email address.', 'profilebuilder' );
112
  $recover_notification .= '<br/>'.__( 'You will receive a link to create a new password via email.', 'profilebuilder' ).'</p>';
113
  echo apply_filters( 'wppb_recover_password_message1', $recover_notification );
114
+
115
  $username_email = ( isset( $post_data['username_email'] ) ? $post_data['username_email'] : '' );
116
 
117
  $recover_input = '<ul>
120
  <input class="text-input" name="username_email" type="text" id="username_email" value="'.trim( $username_email ).'" />
121
  </li><!-- .username_email --></ul>';
122
  echo apply_filters( 'wppb_recover_password_gemerate_password_input', $recover_input, trim( $username_email ) );
123
+ ?>
124
  <p class="form-submit">
125
  <?php $button_name = __('Get New Password', 'profilebuilder'); ?>
126
  <input name="recover_password" type="submit" id="wppb-recover-password-button" class="submit button" value="<?php echo apply_filters('wppb_recover_password_button_name3', $button_name); ?>" />
139
  global $wppb_shortcode_on_front;
140
  $wppb_shortcode_on_front = true;
141
  $message = $messageNo = $message2 = $messageNo2 = $linkLoginName = $linkKey = '';
142
+
143
  global $wpdb;
144
 
145
  ob_start();
146
 
147
  //Get general settings
148
  $wppb_generalSettings = get_option( 'wppb_general_settings' );
149
+
150
  // If the user entered an email/username, process the request
151
  if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'recover_password' && wp_verify_nonce($_POST['password_recovery_nonce_field'],'verify_true_password_recovery') ) {
152
+
153
  $postedData = $_POST['username_email']; //we get the raw data
154
  //check to see if it's an e-mail (and if this is valid/present in the database) or is a username
155
+
156
+
157
  // if we do not have an email in the posted date we try to get the email for that user
158
  if( !is_email( $postedData ) ){
159
  if (username_exists($postedData)){
160
  $query = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE user_login= %s", $postedData ) );
161
  if( !empty( $query[0] ) ){
162
+ $postedData = $query[0]->user_email;
163
  }
164
  }
165
  else{
166
  $message = __( 'The username entered wasn\'t found in the database!', 'profilebuilder').'<br/>'.__('Please check that you entered the correct username.', 'profilebuilder' );
167
  $message = apply_filters( 'wppb_recover_password_sent_message4', $message );
168
  $messageNo = '4';
169
+ }
170
  }
171
+
172
  // we should have an email by this point
173
  if ( is_email( $postedData ) ){
174
  if ( email_exists( $postedData ) ){
176
  if ($retVal[0] != ''){
177
  $message = $retVal[0];
178
  $messageNo = $retVal [1];
179
+
180
  }else{
181
  $message = sprintf( __( 'Check your e-mail for the confirmation link.', 'profilebuilder'), $postedData );
182
  $message = apply_filters( 'wppb_recover_password_sent_message1', $message, $postedData );
183
  $messageNo = '1';
184
+
185
  //verify e-mail validity
186
  $query = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE user_email= %s", $postedData ) );
187
  if( !empty( $query[0] ) ){
188
  $requestedUserID = $query[0]->ID;
189
+ $requestedUserLogin = $query[0]->user_login;
190
  $requestedUserEmail = $query[0]->user_email;
191
 
192
  if( $wppb_generalSettings['loginWith'] == 'username' )
193
  $display_username_email = $query[0]->user_login;
194
  else
195
  $display_username_email = $query[0]->user_email;
196
+
197
  //search if there is already an activation key present, if not create one
198
  $key = wppb_retrieve_activation_key( $requestedUserLogin );
199
+
200
  //send primary email message
201
  $recoveruserMailMessage1 = sprintf( __('Someone requested that the password be reset for the following account: <b>%1$s</b><br/>If this was a mistake, just ignore this email and nothing will happen.<br/>To reset your password, visit the following link:%2$s', 'profilebuilder'), $display_username_email, '<a href="'.add_query_arg( array( 'loginName' => $requestedUserLogin, 'key' => $key ), wppb_curpageurl() ).'">'.add_query_arg( array( 'loginName' => $requestedUserLogin, 'key' => $key ), wppb_curpageurl() ).'</a>');
202
+ $recoveruserMailMessage1 = apply_filters( 'wppb_recover_password_message_content_sent_to_user1', $recoveruserMailMessage1, $requestedUserID, $requestedUserLogin, $requestedUserEmail );
203
+
204
  $recoveruserMailMessageTitle1 = sprintf(__('Password Reset from "%1$s"', 'profilebuilder'), $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES));
205
+ $recoveruserMailMessageTitle1 = apply_filters('wppb_recover_password_message_title_sent_to_user1', $recoveruserMailMessageTitle1, $requestedUserLogin);
206
+
207
  //we add this filter to enable html encoding
208
  add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));
209
  //send mail to the user notifying him of the reset request
217
  }
218
  }
219
  }
220
+
221
  }elseif ( !email_exists( $postedData ) ){
222
  $message = __('The email address entered wasn\'t found in the database!', 'profilebuilder').'<br/>'.__('Please check that you entered the correct email address.', 'profilebuilder');
223
  $message = apply_filters('wppb_recover_password_sent_message2', $message);
224
  $messageNo = '2';
225
  }
226
+ }
227
+
228
  }
229
  // If the user used the correct key-code, update his/her password
230
  elseif ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action2'] ) && $_POST['action2'] == 'recover_password2' && wp_verify_nonce( $_POST['password_recovery_nonce_field2'], 'verify_true_password_recovery2_'.$_POST['userData'] ) ) {
264
 
265
  //send secondary mail to the user containing the username and the new password
266
  $recoveruserMailMessage2 = sprintf( __( 'You have successfully reset your password to: %1$s', 'profilebuilder' ), $new_pass );
267
+ $recoveruserMailMessage2 = apply_filters( 'wppb_recover_password_message_content_sent_to_user2', $recoveruserMailMessage2, $display_username_email, $new_pass, $userID );
268
 
269
  $recoveruserMailMessageTitle2 = sprintf( __('Password Successfully Reset for %1$s on "%2$s"', 'profilebuilder' ), $display_username_email, $blogname = wp_specialchars_decode( get_option('blogname'), ENT_QUOTES ) );
270
+ $recoveruserMailMessageTitle2 = apply_filters( 'wppb_recover_password_message_title_sent_to_user2', $recoveruserMailMessageTitle2, $display_username_email );
271
 
272
  //we add this filter to enable html encoding
273
  add_filter( 'wp_mail_content_type',create_function( '', 'return "text/html"; ') );
278
 
279
  //send email to admin
280
  $recoveradminMailMessage = sprintf( __( '%1$s has requested a password change via the password reset feature.<br/>His/her new password is:%2$s', 'profilebuilder' ), $display_username_email, $_POST['passw1'] );
281
+ $recoveradminMailMessage = apply_filters( 'wppb_recover_password_message_content_sent_to_admin', $recoveradminMailMessage, $display_username_email, $_POST['passw1'], $userID );
282
 
283
  $recoveradminMailMessageTitle = sprintf( __( 'Password Successfully Reset for %1$s on "%2$s"', 'profilebuilder' ), $display_username_email, $blogname = wp_specialchars_decode( get_option('blogname'), ENT_QUOTES ) );
284
+ $recoveradminMailMessageTitle = apply_filters( 'wppb_recover_password_message_title_sent_to_admin', $recoveradminMailMessageTitle, $display_username_email );
285
 
286
 
287
  //we disable the feature to send the admin a notification mail but can be still used using filters
288
  $recoveradminMailMessageTitle = '';
289
+ $recoveradminMailMessageTitle = apply_filters( 'wppb_recover_password_message_title_sent_to_admin', $recoveradminMailMessageTitle, $display_username_email );
290
 
291
  //we add this filter to enable html encoding
292
  add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));
299
  $message2 = __( 'The entered passwords don\'t match!', 'profilebuilder' );
300
  $messageNo2 = '2';
301
  }
302
+
303
  }
304
+
305
  ?>
306
 
307
  <div class="wppb_holder" id="wppb-recover-password">
318
  $login = $_GET['loginName'];
319
 
320
  $user = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE user_activation_key = %s AND user_login = %s", $key, $login ) );
321
+
322
  if( !empty( $user ) ){
323
  //check if the "finalAction" variable is not in the address bar, if it is, don't display the form anymore
324
  if( isset( $_GET['finalAction'] ) && ( $_GET['finalAction'] == 'yes' ) ){
325
  if( $messageNo2 == '2' ){
326
  echo apply_filters( 'wppb_recover_password_password_changed_message2', '<p class="wppb-error">'.$message2.'</p>', $message2 );
327
+
328
  wppb_create_recover_password_form( $user, $_POST );
329
 
330
  }elseif( $messageNo2 == '1' )
331
+ echo apply_filters( 'wppb_recover_password_password_changed_message1', '<p class="wppb-success">'.$message2.'</p>', $message2 );
332
+
333
  }else{
334
  wppb_create_recover_password_form( $user, $_POST );
335
  }
336
  }else{
337
  if( $messageNo2 == '1' )
338
+ echo apply_filters( 'wppb_recover_password_password_changed_message1', '<p class="wppb-success">'.$message2.'</p>', $message2 );
339
+
340
  elseif( $messageNo2 == '2' )
341
  echo apply_filters( 'wppb_recover_password_password_changed_message2', '<p class="wppb-error">'.$message2.'</p>', $message2 );
342
+
343
  else
344
  echo apply_filters( 'wppb_recover_password_invalid_key_message', '<p class="wppb-warning"><b>'.__( 'ERROR:', 'profilebuilder' ).'</b>'.__( 'Invalid key!', 'profilebuilder' ).'</p>' );
345
  }
346
+
347
  }else{
348
  //display error message and the form
349
  if (($messageNo == '') || ($messageNo == '2') || ($messageNo == '4')){
350
  echo apply_filters( 'wppb_recover_password_displayed_message1', '<p class="wppb-warning">'.$message.'</p>' );
351
+
352
  wppb_create_generate_password_form( $_POST );
353
+
354
  }elseif (($messageNo == '5') || ($messageNo == '6'))
355
+ echo apply_filters( 'wppb_recover_password_displayed_message1', '<p class="wppb-warning">'.$message.'</p>' );
356
+
357
  else
358
+ echo apply_filters( 'wppb_recover_password_displayed_message2', '<p class="wppb-success">'.$message.'</p>' ); //display success message
359
  }
360
+
361
  // use this action hook to add extra content after the password recovery form.
362
  do_action( 'wppb_after_recover_password_fields' );
363
  ?>
364
  </div>
365
+
366
  <?php
367
  $output = ob_get_contents();
368
+ ob_end_clean();
369
+
370
  return $output;
371
  }
front-end/register.php CHANGED
@@ -116,9 +116,10 @@ function wppb_activate_signup( $key ) {
116
 
117
  //function to display the registration page
118
  function wppb_front_end_register( $atts ){
119
- extract( shortcode_atts( array( 'role' => get_option( 'default_role' ), 'form_name' => 'unspecified' ), $atts, 'wppb-register' ) );
120
  global $$form_name;
121
- $$form_name = new Profile_Builder_Form_Creator( array( 'form_type' => 'register', 'form_name' => $form_name, 'role' => ( is_object( get_role( $role ) ) ? $role : get_option( 'default_role' ) ) ) );
 
122
 
123
  return $$form_name;
124
  }
116
 
117
  //function to display the registration page
118
  function wppb_front_end_register( $atts ){
119
+ extract( shortcode_atts( array( 'role' => get_option( 'default_role' ), 'form_name' => 'unspecified', 'redirect_url' => '' ), $atts, 'wppb-register' ) );
120
  global $$form_name;
121
+
122
+ $$form_name = new Profile_Builder_Form_Creator( array( 'form_type' => 'register', 'form_name' => $form_name, 'role' => ( is_object( get_role( $role ) ) ? $role : get_option( 'default_role' ) ) , 'redirect_url' => $redirect_url ) );
123
 
124
  return $$form_name;
125
  }
index.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Profile Builder
4
  Plugin URI: http://www.cozmoslabs.com/wordpress-profile-builder/
5
  Description: Login, registration and edit profile shortcodes for the front-end. Also you can chose what fields should be displayed or add new (custom) ones both in the front-end and in the dashboard.
6
- Version: 2.1.1
7
  Author: Cozmoslabs, Madalin Ungureanu, Antohe Cristian, Barina Gabriel
8
  Author URI: http://www.cozmoslabs.com/
9
  License: GPL2
@@ -73,7 +73,7 @@ function wppb_free_plugin_init() {
73
  *
74
  *
75
  */
76
- define('PROFILE_BUILDER_VERSION', '2.1.1' );
77
  define('WPPB_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . dirname(plugin_basename(__FILE__)));
78
  define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__));
79
  define('WPPB_SERVER_MAX_UPLOAD_SIZE_BYTE', apply_filters('wppb_server_max_upload_size_byte_constant', wppb_return_bytes(ini_get('upload_max_filesize'))));
@@ -155,6 +155,8 @@ function wppb_free_plugin_init() {
155
  include_once(WPPB_PLUGIN_DIR . '/modules/email-customizer/user-email-customizer.php');
156
  }
157
 
 
 
158
 
159
  /**
160
  * Check for updates
3
  Plugin Name: Profile Builder
4
  Plugin URI: http://www.cozmoslabs.com/wordpress-profile-builder/
5
  Description: Login, registration and edit profile shortcodes for the front-end. Also you can chose what fields should be displayed or add new (custom) ones both in the front-end and in the dashboard.
6
+ Version: 2.1.2
7
  Author: Cozmoslabs, Madalin Ungureanu, Antohe Cristian, Barina Gabriel
8
  Author URI: http://www.cozmoslabs.com/
9
  License: GPL2
73
  *
74
  *
75
  */
76
+ define('PROFILE_BUILDER_VERSION', '2.1.2' );
77
  define('WPPB_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . dirname(plugin_basename(__FILE__)));
78
  define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__));
79
  define('WPPB_SERVER_MAX_UPLOAD_SIZE_BYTE', apply_filters('wppb_server_max_upload_size_byte_constant', wppb_return_bytes(ini_get('upload_max_filesize'))));
155
  include_once(WPPB_PLUGIN_DIR . '/modules/email-customizer/user-email-customizer.php');
156
  }
157
 
158
+ include_once(WPPB_PLUGIN_DIR . '/admin/add-ons.php');
159
+
160
 
161
  /**
162
  * Check for updates
readme.txt CHANGED
@@ -6,7 +6,7 @@ Tags: registration, user profile, user registration, custom field registration,
6
 
7
  Requires at least: 3.1
8
  Tested up to: 4.1
9
- Stable tag: 2.1.1
10
 
11
  Simple to use profile plugin allowing front-end login, user registration and edit profile by using shortcodes.
12
 
@@ -38,18 +38,19 @@ Users with administrator rights have access to the following features:
38
  * allow users to **Log-in with their Username or Email**
39
  * enforce a **minimum password length** and **minimum password strength** (using the default WordPress password strength meter)
40
  * assign users a specific role at registration (using **[wppb-register role="desired_role"]** shortcode argument for the register form)
41
- * redirect users after login (using **[wppb-login redirect="www.example.com"]** shortcode argument)
42
  * add register and lost password links below the login form (using **[wppb-login register_url="www.example.com" lostpassword_url="www.example.com"]** shortcode arguments)
43
  * customizable login widget
44
  * add a custom stylesheet/inherit values from the current theme or use the default one built into this plugin.
45
  * chose which user roles view the admin bar in the front-end of the website (Admin Bar Settings page).
46
  * select which profile fields users can see/modify.
 
47
 
48
  **PROFILE BUILDER PRO**
49
 
50
  The [Pro version](http://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wp.org&utm_medium=plugin-description-page&utm_campaign=PBFree) has the following extra features:
51
 
52
- * Create Extra User Fields (Heading, Input, Hidden-Input, Checkbox, Agree to Terms Checkbox, Radio Buttons, DatePicker, Textareas, reCAPTCHA, Upload fields, Selects, User Role Select, Country Selects, Timezone selects, Avatar Upload)
53
  * Add Avatar Upload for users
54
  * Front-end User Listing (fully customizable, sorting included)
55
  * Create Multiple User Listings
@@ -65,6 +66,11 @@ The [Pro version](http://www.cozmoslabs.com/wordpress-profile-builder/?utm_sourc
65
 
66
  [Find out more about Profile Builder PRO](http://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wp.org&utm_medium=plugin-description-page&utm_campaign=PBFree)
67
 
 
 
 
 
 
68
  = Profile Builder in your Language =
69
  We're focusing on translating Profile Builder in as many languages as we can. So far, the translations for 10 languages are almost complete, but we still need help on a lot of other languages, so please join us at [translate.cozmoslabs.com.](http://translate.cozmoslabs.com/projects/profilebuilder)
70
  You will be able to download all the [available language packs](http://translate.cozmoslabs.com/projects/profilebuilder) as well as help us translate Profile Builder in your language.
@@ -108,6 +114,12 @@ This plugin adds/removes user fields in the front-end. Both default and extra pr
108
  10. Profile Builder Login Widget
109
 
110
  == Changelog ==
 
 
 
 
 
 
111
  = 2.1.1 =
112
  * Added username validation for illegal characters
113
  * Fixed wp_mail() From headers being set sitewide
6
 
7
  Requires at least: 3.1
8
  Tested up to: 4.1
9
+ Stable tag: 2.1.2
10
 
11
  Simple to use profile plugin allowing front-end login, user registration and edit profile by using shortcodes.
12
 
38
  * allow users to **Log-in with their Username or Email**
39
  * enforce a **minimum password length** and **minimum password strength** (using the default WordPress password strength meter)
40
  * assign users a specific role at registration (using **[wppb-register role="desired_role"]** shortcode argument for the register form)
41
+ * redirect users after login, register and edit-profile using redirect_url shortcode argument ( e.g **[wppb-login redirect_url="www.example.com"]** )
42
  * add register and lost password links below the login form (using **[wppb-login register_url="www.example.com" lostpassword_url="www.example.com"]** shortcode arguments)
43
  * customizable login widget
44
  * add a custom stylesheet/inherit values from the current theme or use the default one built into this plugin.
45
  * chose which user roles view the admin bar in the front-end of the website (Admin Bar Settings page).
46
  * select which profile fields users can see/modify.
47
+ * extended functionality available via [Add-ons](http://www.cozmoslabs.com/profile-builder-add-ons/?utm_source=wp.org&utm_medium=plugin-description-page&utm_campaign=PBFree)
48
 
49
  **PROFILE BUILDER PRO**
50
 
51
  The [Pro version](http://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wp.org&utm_medium=plugin-description-page&utm_campaign=PBFree) has the following extra features:
52
 
53
+ * Create Extra User Fields (Heading, Input, Hidden-Input, Checkbox, Agree to Terms Checkbox, Radio Buttons, DatePicker, Textareas, WYSIWYG, reCAPTCHA, Upload fields, Selects, User Role Select, Country Selects, Timezone selects, Avatar Upload)
54
  * Add Avatar Upload for users
55
  * Front-end User Listing (fully customizable, sorting included)
56
  * Create Multiple User Listings
66
 
67
  [Find out more about Profile Builder PRO](http://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wp.org&utm_medium=plugin-description-page&utm_campaign=PBFree)
68
 
69
+
70
+ **Profile Builder Add-ons**
71
+
72
+ For more functionality check out Profile Builder [Add-ons page](http://www.cozmoslabs.com/profile-builder-add-ons/?utm_source=wp.org&utm_medium=plugin-description-page&utm_campaign=PBFree)
73
+
74
  = Profile Builder in your Language =
75
  We're focusing on translating Profile Builder in as many languages as we can. So far, the translations for 10 languages are almost complete, but we still need help on a lot of other languages, so please join us at [translate.cozmoslabs.com.](http://translate.cozmoslabs.com/projects/profilebuilder)
76
  You will be able to download all the [available language packs](http://translate.cozmoslabs.com/projects/profilebuilder) as well as help us translate Profile Builder in your language.
114
  10. Profile Builder Login Widget
115
 
116
  == Changelog ==
117
+ = 2.1.2 =
118
+ * Created Add-On Page in Profile Builder
119
+ * Added support for Twenty Fifteen theme to better target inputs
120
+ * Add support for "redirect_url" parameter to Login shortcode (will do the same thing as "redirect" - for consistency)
121
+ * Added "redirect_url" parameter to Register and Edit-profile shortcodes
122
+
123
  = 2.1.1 =
124
  * Added username validation for illegal characters
125
  * Fixed wp_mail() From headers being set sitewide