User registration & user profile – Profile Builder - Version 1.1.47

Version Description

Improved the "Email Confirmation" feature and a few other functions. Added new options for the "Userlisting" feature (available in the Pro version of Profile Buildeer). Added translations: persian (thanks to Ali Mirzaei, info@alimir.ir)

Download this release

Release Info

Developer barinagabriel
Plugin Icon 128x128 User registration & user profile – Profile Builder
Version 1.1.47
Comparing to
See all releases

Code changes from version 1.1.46 to 1.1.47

assets/css/back.end.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ .users_page_unconfirmed_emails #separatorID, .users_page_unconfirmed_emails .unconfirmedEmailUsers, .users_page_unconfirmed_emails #unconfirmedEmailNo{
2
+ display:none;
3
+ }
assets/css/style.css CHANGED
@@ -985,4 +985,12 @@ div.file_wrap {
985
  position: relative;
986
  left: -34px;
987
  top:-42px;
 
 
 
 
 
 
 
 
988
  }
985
  position: relative;
986
  left: -34px;
987
  top:-42px;
988
+ }
989
+
990
+ #layoutNotice{
991
+ color:grey;
992
+ }
993
+ #layoutNoticeDiv{
994
+ position: relative;
995
+ bottom: -50px;
996
  }
classes/class.email.confirmation.php ADDED
@@ -0,0 +1,468 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Code taken from: Custom List Table Example (plugin)
4
+ Author: Matt Van Andel
5
+ Author URI: http://www.mattvanandel.com
6
+ */
7
+
8
+ /*************************** LOAD THE BASE CLASS *******************************
9
+ *******************************************************************************
10
+ * The WP_List_Table class isn't automatically available to plugins, so we need
11
+ * to check if it's available and load it if necessary.
12
+ */
13
+ if(!class_exists('WP_List_Table')){
14
+ require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
15
+ }
16
+
17
+
18
+
19
+
20
+ /************************** CREATE A PACKAGE CLASS *****************************
21
+ *******************************************************************************
22
+ * Create a new list table package that extends the core WP_List_Table class.
23
+ * WP_List_Table contains most of the framework for generating the table, but we
24
+ * need to define and override some methods so that our data can be displayed
25
+ * exactly the way we need it to be.
26
+ *
27
+ * To display this example on a page, you will first need to instantiate the class,
28
+ * then call $yourInstance->prepare_items() to handle any data manipulation, then
29
+ * finally call $yourInstance->display() to render the table to the page.
30
+ *
31
+ */
32
+ class wpp_list_unfonfirmed_email_table extends WP_List_Table {
33
+
34
+ /** ************************************************************************
35
+ * REQUIRED. Set up a constructor that references the parent constructor. We
36
+ * use the parent reference to set some default configs.
37
+ ***************************************************************************/
38
+ function __construct(){
39
+ global $status, $page;
40
+ global $wpdb;
41
+
42
+ //Set parent defaults
43
+ parent::__construct( array(
44
+ 'singular' => 'user', //singular name of the listed records
45
+ 'plural' => 'users', //plural name of the listed records
46
+ 'ajax' => false //does this table support ajax?
47
+ ) );
48
+
49
+ }
50
+
51
+
52
+ /** ************************************************************************
53
+ * Recommended. This method is called when the parent class can't find a method
54
+ * specifically build for a given column. Generally, it's recommended to include
55
+ * one method for each column you want to render, keeping your package class
56
+ * neat and organized. For example, if the class needs to process a column
57
+ * named 'username', it would first see if a method named $this->column_title()
58
+ * exists - if it does, that method will be used. If it doesn't, this one will
59
+ * be used. Generally, you should try to use custom column methods as much as
60
+ * possible.
61
+ *
62
+ * Since we have defined a column_title() method later on, this method doesn't
63
+ * need to concern itself with any column with a name of 'username'. Instead, it
64
+ * needs to handle everything else.
65
+ *
66
+ * For more detailed insight into how columns are handled, take a look at
67
+ * WP_List_Table::single_row_columns()
68
+ *
69
+ * @param array $item A singular item (one full row's worth of data)
70
+ * @param array $column_name The name/slug of the column to be processed
71
+ * @return string Text or HTML to be placed inside the column <td>
72
+ **************************************************************************/
73
+ function column_default($item, $column_name){
74
+ switch($column_name){
75
+ case 'email':
76
+ case 'registered':
77
+ return $item[$column_name];
78
+ default:
79
+ return print_r($item,true); //Show the whole array for troubleshooting purposes
80
+ }
81
+ }
82
+
83
+
84
+ /** ************************************************************************
85
+ * Recommended. This is a custom column method and is responsible for what
86
+ * is rendered in any column with a name/slug of 'username'. Every time the class
87
+ * needs to render a column, it first looks for a method named
88
+ * column_{$column_title} - if it exists, that method is run. If it doesn't
89
+ * exist, column_default() is called instead.
90
+ *
91
+ * This example also illustrates how to implement rollover actions. Actions
92
+ * should be an associative array formatted as 'slug'=>'link html' - and you
93
+ * will need to generate the URLs yourself. You could even ensure the links
94
+ *
95
+ *
96
+ * @see WP_List_Table::::single_row_columns()
97
+ * @param array $item A singular item (one full row's worth of data)
98
+ * @return string Text to be placed inside the column <td>
99
+ **************************************************************************/
100
+ function column_username($item){
101
+
102
+ $GRavatar = get_avatar( $item['email'], 32, '' );
103
+
104
+ //Build row actions
105
+ $actions = array(
106
+ 'delete' => sprintf('<a href="javascript:confirmECAction(\'%s\',\'%s\',\'%s\',\''.__('delete this user from the _signups table?', 'profilebuilder').'\')">'. __('Delete', 'profilebuilder') .'</a>',wppb_curpageurl(),'delete',$item['ID']),
107
+ 'confirm' => sprintf('<a href="javascript:confirmECAction(\'%s\',\'%s\',\'%s\',\''.__('confirm this email yourself?', 'profilebuilder').'\')">'. __('Confirm Email', 'profilebuilder') .'</a>',wppb_curpageurl(),'confirm',$item['ID'])/* ,
108
+ 'resend' => sprintf('<a href="javascript:confirmECAction(\'%s\',\'%s\',\'%s\',\''.__('resend the activation link?', 'profilebuilder').'\')">'. __('Resend Activation Email', 'profilebuilder') .'</a>',wppb_curpageurl(),'resend',$item['ID']) */
109
+ );
110
+
111
+ //Return the title contents
112
+ return sprintf('%1$s <strong>%2$s</strong> %3$s',
113
+ /*$1%s*/ $GRavatar,
114
+ /*$2%s*/ $item['username'],
115
+ /*$3%s*/ $this->row_actions($actions)
116
+ );
117
+ }
118
+
119
+ /** ************************************************************************
120
+ * REQUIRED if displaying checkboxes or using bulk actions! The 'cb' column
121
+ * is given special treatment when columns are processed. It ALWAYS needs to
122
+ * have it's own method.
123
+ *
124
+ * @see WP_List_Table::::single_row_columns()
125
+ * @param array $item A singular item (one full row's worth of data)
126
+ * @return string Text to be placed inside the column <td>
127
+ **************************************************************************/
128
+ function column_cb($item){
129
+ return sprintf(
130
+ '<input type="checkbox" name="%1$s[]" value="%2$s" />',
131
+ /*$1%s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label
132
+ /*$2%s*/ $item['ID'] //The value of the checkbox should be the record's id
133
+ );
134
+ }
135
+
136
+
137
+ /** ************************************************************************
138
+ * REQUIRED! This method dictates the table's columns and titles. This should
139
+ * return an array where the key is the column slug (and class) and the value
140
+ * is the column's title text. If you need a checkbox for bulk actions, refer
141
+ * to the $columns array below.
142
+ *
143
+ * The 'cb' column is treated differently than the rest. If including a checkbox
144
+ * column in your table you must create a column_cb() method. If you don't need
145
+ * bulk actions or checkboxes, simply leave the 'cb' entry out of your array.
146
+ *
147
+ * @see WP_List_Table::::single_row_columns()
148
+ * @return array An associative array containing column information: 'slugs'=>'Visible Titles'
149
+ **************************************************************************/
150
+ function get_columns(){
151
+ $columns = array(
152
+ 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
153
+ 'username' => __('Username', 'profilebuilder'),
154
+ 'email' => __('E-mail', 'profilebuilder'),
155
+ 'registered' => __('Registered', 'profilebuilder')
156
+ );
157
+ return $columns;
158
+ }
159
+
160
+ /** ************************************************************************
161
+ * Optional. If you want one or more columns to be sortable (ASC/DESC toggle),
162
+ * you will need to register it here. This should return an array where the
163
+ * key is the column that needs to be sortable, and the value is db column to
164
+ * sort by. Often, the key and value will be the same, but this is not always
165
+ * the case (as the value is a column name from the database, not the list table).
166
+ *
167
+ * This method merely defines which columns should be sortable and makes them
168
+ * clickable - it does not handle the actual sorting. You still need to detect
169
+ * the ORDERBY and ORDER querystring variables within prepare_items() and sort
170
+ * your data accordingly (usually by modifying your query).
171
+ *
172
+ * @return array An associative array containing all the columns that should be sortable: 'slugs'=>array('data_values',bool)
173
+ **************************************************************************/
174
+ function get_sortable_columns() {
175
+ $sortable_columns = array(
176
+ 'username' => array('username',false), //true means it's already sorted
177
+ 'email' => array('email',false),
178
+ 'registered' => array('registered',false)
179
+ );
180
+ return $sortable_columns;
181
+ }
182
+
183
+
184
+ /** ************************************************************************
185
+ * Optional. If you need to include bulk actions in your list table, this is
186
+ * the place to define them. Bulk actions are an associative array in the format
187
+ * 'slug'=>'Visible Title'
188
+ *
189
+ * If this method returns an empty value, no bulk action will be rendered. If
190
+ * you specify any bulk actions, the bulk actions box will be rendered with
191
+ * the table automatically on display().
192
+ *
193
+ * Also note that list tables are not automatically wrapped in <form> elements,
194
+ * so you will need to create those manually in order for bulk actions to function.
195
+ *
196
+ * @return array An associative array containing all the bulk actions: 'slugs'=>'Visible Titles'
197
+ **************************************************************************/
198
+ function get_bulk_actions() {
199
+ $actions = array(
200
+ 'delete' => __('Delete', 'profilebuilder'),
201
+ 'confirm' => __('Confirm Email', 'profilebuilder')
202
+ );
203
+ return $actions;
204
+ }
205
+
206
+
207
+ /** ************************************************************************
208
+ * Optional. You can handle your bulk actions anywhere or anyhow you prefer.
209
+ * For this example package, we will handle it in the class to keep things
210
+ * clean and organized.
211
+ *
212
+ * @see $this->prepare_items()
213
+ **************************************************************************/
214
+ function process_bulk_action() {
215
+ global $current_user;
216
+ global $wpdb;
217
+
218
+ if (current_user_can('delete_users')){
219
+ $iterator = 0;
220
+ $bulkResult = mysql_query("SELECT * FROM ".$wpdb->prefix."signups WHERE active=0");
221
+
222
+ //Detect when a bulk action is being triggered...
223
+ if( 'delete'===$this->current_action() ) {
224
+ while ($bulkRow=mysql_fetch_row($bulkResult)){
225
+ if (in_array((string)$iterator, $_GET['user'])){
226
+ $bulkResult1 = mysql_query("DELETE FROM ".$wpdb->prefix."signups WHERE user_login='".$bulkRow[3]."' AND user_email='".$bulkRow[4]."'");
227
+ if (!$bulkResult1){
228
+ $message = $bulkRow[3] . __("couldn't be deleted.", "profilebuilder");
229
+ ?>
230
+ <script type="text/javascript">
231
+ confirmECActionBulk('<?php echo get_bloginfo('url').'/wp-admin/users.php?page=unconfirmed_emails';?>', '<?php echo $message;?>');
232
+ </script>
233
+ <?php
234
+ }
235
+ }
236
+ $iterator++;
237
+ }
238
+
239
+ $message = __("All users have been successfully deleted.", "profilebuilder");
240
+ ?>
241
+ <script type="text/javascript">
242
+ confirmECActionBulk('<?php echo get_bloginfo('url').'/wp-admin/users.php?page=unconfirmed_emails';?>', '<?php echo $message;?>');
243
+ </script>
244
+ <?php
245
+
246
+ }elseif( 'confirm'===$this->current_action() ) {
247
+ while ($bulkRow=mysql_fetch_row($bulkResult)){
248
+ if (in_array((string)$iterator, $_GET['user'])){
249
+ $ret = wppb_manual_activate_signup($bulkRow[8]);
250
+ }
251
+ $iterator++;
252
+ }
253
+
254
+ $message = __("The selected users have been activated.", "profilebuilder");
255
+ ?>
256
+ <script type="text/javascript">
257
+ confirmECActionBulk('<?php echo get_bloginfo('url').'/wp-admin/users.php?page=unconfirmed_emails';?>', '<?php echo $message;?>');
258
+ </script>
259
+ <?php
260
+ }
261
+
262
+ }else{
263
+ $message = __("Sorry, but you don't have permission to do that!", "profilebuilder");
264
+ ?>
265
+ <script type="text/javascript">
266
+ confirmECActionBulk('<?php echo get_bloginfo('url').'/wp-admin/';?>', '<?php echo $message;?>');
267
+ </script>
268
+ <?php
269
+ }
270
+
271
+ }
272
+
273
+
274
+ /** ************************************************************************
275
+ * REQUIRED! This is where you prepare your data for display. This method will
276
+ * usually be used to query the database, sort and filter the data, and generally
277
+ * get it ready to be displayed. At a minimum, we should set $this->items and
278
+ * $this->set_pagination_args(), although the following properties and methods
279
+ * are frequently interacted with here...
280
+ *
281
+ * @global WPDB $wpdb
282
+ * @uses $this->_column_headers
283
+ * @uses $this->items
284
+ * @uses $this->get_columns()
285
+ * @uses $this->get_sortable_columns()
286
+ * @uses $this->get_pagenum()
287
+ * @uses $this->set_pagination_args()
288
+ **************************************************************************/
289
+ function prepare_items() {
290
+ global $wpdb;
291
+
292
+ $this->dataArray = array();
293
+ $iterator = 0;
294
+
295
+ $result = mysql_query("SELECT * FROM ".$wpdb->prefix."signups WHERE active=0");
296
+ while ($row=mysql_fetch_row($result)){
297
+ $tempArray = array('ID' => $iterator, 'username' => $row[3], 'email' => $row[4], 'registered' => $row[5]);
298
+
299
+ array_push($this->dataArray, $tempArray);
300
+ $iterator++;
301
+ }
302
+
303
+ /**
304
+ * First, lets decide how many records per page to show
305
+ */
306
+ $per_page = 20;
307
+
308
+
309
+ /**
310
+ * REQUIRED. Now we need to define our column headers. This includes a complete
311
+ * array of columns to be displayed (slugs & titles), a list of columns
312
+ * to keep hidden, and a list of columns that are sortable. Each of these
313
+ * can be defined in another method (as we've done here) before being
314
+ * used to build the value for our _column_headers property.
315
+ */
316
+ $columns = $this->get_columns();
317
+ $hidden = array();
318
+ $sortable = $this->get_sortable_columns();
319
+
320
+
321
+ /**
322
+ * REQUIRED. Finally, we build an array to be used by the class for column
323
+ * headers. The $this->_column_headers property takes an array which contains
324
+ * 3 other arrays. One for all columns, one for hidden columns, and one
325
+ * for sortable columns.
326
+ */
327
+ $this->_column_headers = array($columns, $hidden, $sortable);
328
+
329
+
330
+ /**
331
+ * Optional. You can handle your bulk actions however you see fit. In this
332
+ * case, we'll handle them within our package just to keep things clean.
333
+ */
334
+ $this->process_bulk_action();
335
+
336
+
337
+ /**
338
+ * Instead of querying a database, we're going to fetch the example data
339
+ * property we created for use in this plugin. This makes this example
340
+ * package slightly different than one you might build on your own. In
341
+ * this example, we'll be using array manipulation to sort and paginate
342
+ * our data. In a real-world implementation, you will probably want to
343
+ * use sort and pagination data to build a custom query instead, as you'll
344
+ * be able to use your precisely-queried data immediately.
345
+ */
346
+ $data = $this->dataArray;
347
+
348
+
349
+ /**
350
+ * This checks for sorting input and sorts the data in our array accordingly.
351
+ *
352
+ * In a real-world situation involving a database, you would probably want
353
+ * to handle sorting by passing the 'orderby' and 'order' values directly
354
+ * to a custom query. The returned data will be pre-sorted, and this array
355
+ * sorting technique would be unnecessary.
356
+ */
357
+ function usort_reorder($a,$b){
358
+ $orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'username'; //If no sort, default to username
359
+ $order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc'; //If no order, default to asc
360
+ $result = strcmp($a[$orderby], $b[$orderby]); //Determine sort order
361
+ return ($order==='asc') ? $result : -$result; //Send final sort direction to usort
362
+ }
363
+ usort($data, 'usort_reorder');
364
+
365
+ /**
366
+ * REQUIRED for pagination. Let's figure out what page the user is currently
367
+ * looking at. We'll need this later, so you should always include it in
368
+ * your own package classes.
369
+ */
370
+ $current_page = $this->get_pagenum();
371
+
372
+ /**
373
+ * REQUIRED for pagination. Let's check how many items are in our data array.
374
+ * In real-world use, this would be the total number of items in your database,
375
+ * without filtering. We'll need this later, so you should always include it
376
+ * in your own package classes.
377
+ */
378
+ $total_items = count($data);
379
+
380
+
381
+ /**
382
+ * The WP_List_Table class does not handle pagination for us, so we need
383
+ * to ensure that the data is trimmed to only the current page. We can use
384
+ * array_slice() to
385
+ */
386
+ $data = array_slice($data,(($current_page-1)*$per_page),$per_page);
387
+
388
+
389
+
390
+ /**
391
+ * REQUIRED. Now we can add our *sorted* data to the items property, where
392
+ * it can be used by the rest of the class.
393
+ */
394
+ $this->items = $data;
395
+
396
+
397
+ /**
398
+ * REQUIRED. We also have to register our pagination options & calculations.
399
+ */
400
+ $this->set_pagination_args( array(
401
+ 'total_items' => $total_items, //WE have to calculate the total number of items
402
+ 'per_page' => $per_page, //WE have to determine how many items to show on a page
403
+ 'total_pages' => ceil($total_items/$per_page) //WE have to calculate the total number of pages
404
+ ) );
405
+ }
406
+
407
+ }
408
+
409
+
410
+
411
+
412
+
413
+ /** ************************ REGISTER THE PAGE ****************************
414
+ *******************************************************************************
415
+ * Now we just need to define an admin page.
416
+ */
417
+ function wppb_add_ec_submenu_page() {
418
+ if (is_multisite()){
419
+ add_submenu_page( 'users.php', 'Unconfirmed Email Address', 'Unconfirmed Email Address', 'manage_options', 'unconfirmed_emails', 'wppb_unconfirmed_email_address_custom_menu_page' );
420
+ remove_submenu_page( 'users.php', 'unconfirmed_emails' ); //hide the page in the admin menu
421
+
422
+ }else{
423
+ $wppb_generalSettings = get_option('wppb_general_settings', 'not_found');
424
+ if($wppb_generalSettings != 'not_found')
425
+ if(!empty($wppb_generalSettings['emailConfirmation']) && ($wppb_generalSettings['emailConfirmation'] == 'yes'))
426
+ add_submenu_page( 'users.php', 'Unconfirmed Email Address', 'Unconfirmed Email Address', 'manage_options', 'unconfirmed_emails', 'wppb_unconfirmed_email_address_custom_menu_page' );
427
+ remove_submenu_page( 'users.php', 'unconfirmed_emails' ); //hide the page in the admin menu
428
+ }
429
+ }
430
+ add_action('admin_menu', 'wppb_add_ec_submenu_page');
431
+
432
+
433
+
434
+ /***************************** RENDER PAGE ********************************
435
+ *******************************************************************************
436
+ * This function renders the admin page. Although it's
437
+ * possible to call prepare_items() and display() from the constructor, there
438
+ * are often times where you may need to include logic here between those steps,
439
+ * so we've instead called those methods explicitly. It keeps things flexible, and
440
+ * it's the way the list tables are used in the WordPress core.
441
+ */
442
+ function wppb_unconfirmed_email_address_custom_menu_page(){
443
+
444
+ //Create an instance of our package class...
445
+ $listTable = new wpp_list_unfonfirmed_email_table();
446
+ //Fetch, prepare, sort, and filter our data...
447
+ $listTable->prepare_items();
448
+
449
+ ?>
450
+ <div class="wrap">
451
+
452
+ <div class="wrap"><div id="icon-users" class="icon32"></div><h2><?php _e('Users with Unconfirmed Email Address', 'profilebuilder');?></h2></div>
453
+
454
+ <ul class="subsubsub">
455
+ <li class="all"><a href="users.php"><?php _e('All Users', 'profilebuilder');?></a></li>
456
+ </ul>
457
+
458
+ <!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
459
+ <form id="movies-filter" method="get">
460
+ <!-- For plugins, we also need to ensure that the form posts back to our current page -->
461
+ <input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>" />
462
+ <!-- Now we can render the completed list table -->
463
+ <?php $listTable->display() ?>
464
+ </form>
465
+
466
+ </div>
467
+ <?php
468
+ }
front-end/wppb.edit.profile.php CHANGED
@@ -15,8 +15,6 @@ function wppb_save_the_password(){
15
  global $changesSavedNoMatchingPass;
16
  global $changesSavedNoPass;
17
 
18
- /* Load registration file. */
19
- require_once(ABSPATH . WPINC . '/registration.php');
20
  /* Get user info. */
21
  global $current_user;
22
 
@@ -61,10 +59,9 @@ function wppb_front_end_profile_info() {
61
  $uploadExt = array();
62
  $uploadSize = array();
63
  $editFilterArray = array();
 
64
 
65
 
66
- /* Load registration file. */
67
- require_once(ABSPATH . WPINC . '/registration.php');
68
  /* Get user info. */
69
  global $current_user;
70
 
@@ -134,7 +131,7 @@ function wppb_front_end_profile_info() {
134
  if ($wppb_defaultOptions['firstname'] == 'show'){
135
  $_POST['first_name'] = apply_filters('wppb_edit_profile_posted_first_name', $_POST['first_name']);
136
  if ($wppb_defaultOptions['firstnameRequired'] == 'yes'){
137
- if ((trim($_POST['first_name']) != '') && isset($_POST['first_name'])){
138
  wp_update_user( array( 'ID' => $current_user->id, 'first_name' => esc_attr( $_POST['first_name'] )));
139
  $changesSaved = 'yes';
140
  }
@@ -147,7 +144,7 @@ function wppb_front_end_profile_info() {
147
  if ($wppb_defaultOptions['lastname'] == 'show'){
148
  $_POST['last_name'] = apply_filters('wppb_edit_profile_posted_last_name', $_POST['last_name']);
149
  if ($wppb_defaultOptions['lastnameRequired'] == 'yes'){
150
- if ((trim($_POST['last_name']) != '') && isset($_POST['last_name'])){
151
  wp_update_user( array( 'ID' => $current_user->id, 'last_name' => esc_attr( $_POST['last_name'] )));
152
  $changesSaved = 'yes';
153
  }
@@ -160,7 +157,7 @@ function wppb_front_end_profile_info() {
160
  if ($wppb_defaultOptions['nickname'] == 'show'){
161
  $_POST['nickname'] = apply_filters('wppb_edit_profile_posted_nickname', $_POST['nickname']);
162
  if ($wppb_defaultOptions['nicknameRequired'] == 'yes'){
163
- if ((trim($_POST['nickname']) != '') && isset($_POST['nickname'])){
164
  wp_update_user( array( 'ID' => $current_user->id, 'nickname' => esc_attr( $_POST['nickname'] )));
165
  $changesSaved = 'yes';
166
  }
@@ -174,7 +171,7 @@ function wppb_front_end_profile_info() {
174
  if ($wppb_defaultOptions['dispname'] == 'show'){
175
  $_POST['display_name'] = apply_filters('wppb_edit_profile_posted_display_name', $_POST['display_name']);
176
  if ($wppb_defaultOptions['dispnameRequired'] == 'yes'){
177
- if ((trim($_POST['display_name']) != '') && isset($_POST['display_name'])){
178
  wp_update_user( array( 'ID' => $current_user->id, 'display_name' => esc_attr( $_POST['display_name'] )));
179
  $changesSaved = 'yes';
180
  }
@@ -187,7 +184,7 @@ function wppb_front_end_profile_info() {
187
  if ($wppb_defaultOptions['website'] == 'show'){
188
  $_POST['website'] = apply_filters('wppb_edit_profile_posted_website', $_POST['website']);
189
  if ($wppb_defaultOptions['websiteRequired'] == 'yes'){
190
- if ((trim($_POST['website']) != '') && isset($_POST['website'])){
191
  $wppbPos = strpos( (string)$_POST['website'], 'http://' );
192
  if($wppbPos !== FALSE){
193
  wp_update_user( array( 'ID' => $current_user->id, 'user_url' => esc_attr( $_POST['website'] )));
@@ -217,7 +214,7 @@ function wppb_front_end_profile_info() {
217
  if ($wppb_defaultOptions['aim'] == 'show'){
218
  $_POST['aim'] = apply_filters('wppb_edit_profile_posted_aim', $_POST['aim']);
219
  if ($wppb_defaultOptions['aimRequired'] == 'yes'){
220
- if ((trim($_POST['aim']) != '') && isset($_POST['aim'])){
221
  update_user_meta( $current_user->id, 'aim', esc_attr( $_POST['aim'] ) );
222
  $changesSaved = 'yes';
223
  }
@@ -230,7 +227,7 @@ function wppb_front_end_profile_info() {
230
  if ($wppb_defaultOptions['yahoo'] == 'show'){
231
  $_POST['yim'] = apply_filters('wppb_edit_profile_posted_yahoo', $_POST['yim']);
232
  if ($wppb_defaultOptions['yahooRequired'] == 'yes'){
233
- if ((trim($_POST['yim']) != '') && isset($_POST['yim'])){
234
  update_user_meta( $current_user->id, 'yim', esc_attr( $_POST['yim'] ) );
235
  $changesSaved = 'yes';
236
  }
@@ -243,7 +240,7 @@ function wppb_front_end_profile_info() {
243
  if ($wppb_defaultOptions['jabber'] == 'show'){
244
  $_POST['jabber'] = apply_filters('wppb_edit_profile_posted_jabber', $_POST['jabber']);
245
  if ($wppb_defaultOptions['jabberRequired'] == 'yes'){
246
- if ((trim($_POST['jabber']) != '') && isset($_POST['jabber'])){
247
  update_user_meta( $current_user->id, 'jabber', esc_attr( $_POST['jabber'] ) );
248
  $changesSaved = 'yes';
249
  }
@@ -256,7 +253,7 @@ function wppb_front_end_profile_info() {
256
  if ($wppb_defaultOptions['bio'] == 'show'){
257
  $_POST['description'] = apply_filters('wppb_edit_profile_posted_bio', $_POST['description']);
258
  if ($wppb_defaultOptions['bioRequired'] == 'yes'){
259
- if ((trim($_POST['description']) != '') && isset($_POST['description'])){
260
  update_user_meta( $current_user->id, 'description', esc_attr( $_POST['description'] ) );
261
  $changesSaved = 'yes';
262
  }
@@ -815,7 +812,7 @@ function wppb_front_end_profile_info() {
815
  $errorMark = '';
816
  if ($wppb_defaultOptions['websiteRequired'] == 'yes'){
817
  $errorMark = '<font color="red" title="'. __('This field is marked as required by the administrator.', 'profilebuilder') .'">*</font>';
818
- if ((trim($_POST['website']) == '') && isset($_POST['website'])){
819
  $errorMark = '<img src="'.WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="'. __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') .'"/>';
820
  $errorVar = ' errorHolder';
821
  }
@@ -833,7 +830,7 @@ function wppb_front_end_profile_info() {
833
  $errorMark = '';
834
  if ($wppb_defaultOptions['aimRequired'] == 'yes'){
835
  $errorMark = '<font color="red" title="'. __('This field is marked as required by the administrator.', 'profilebuilder') .'">*</font>';
836
- if ((trim($_POST['aim']) == '') && isset($_POST['aim'])){
837
  $errorMark = '<img src="'.WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="'. __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') .'"/>';
838
  $errorVar = ' errorHolder';
839
  }
@@ -851,7 +848,7 @@ function wppb_front_end_profile_info() {
851
  $errorMark = '';
852
  if ($wppb_defaultOptions['yahooRequired'] == 'yes'){
853
  $errorMark = '<font color="red" title="'. __('This field is marked as required by the administrator.', 'profilebuilder') .'">*</font>';
854
- if ((trim($_POST['yim']) == '') && isset($_POST['yim'])){
855
  $errorMark = '<img src="'.WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="'. __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') .'"/>';
856
  $errorVar = ' errorHolder';
857
  }
@@ -869,7 +866,7 @@ function wppb_front_end_profile_info() {
869
  $errorMark = '';
870
  if ($wppb_defaultOptions['jabberRequired'] == 'yes'){
871
  $errorMark = '<font color="red" title="'. __('This field is marked as required by the administrator.', 'profilebuilder') .'">*</font>';
872
- if ((trim($_POST['jabber']) == '') && isset($_POST['jabber'])){
873
  $errorMark = '<img src="'.WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="'. __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') .'"/>';
874
  $errorVar = ' errorHolder';
875
  }
@@ -890,7 +887,7 @@ function wppb_front_end_profile_info() {
890
  $errorMark = '';
891
  if ($wppb_defaultOptions['bioRequired'] == 'yes'){
892
  $errorMark = '<font color="red" title="'. __('This field is marked as required by the administrator.', 'profilebuilder') .'">*</font>';
893
- if ((trim($_POST['description']) == '') && isset($_POST['description'])){
894
  $errorMark = '<img src="'.WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="'. __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') .'"/>';
895
  $errorVar = ' errorHolder';
896
  }
15
  global $changesSavedNoMatchingPass;
16
  global $changesSavedNoPass;
17
 
 
 
18
  /* Get user info. */
19
  global $current_user;
20
 
59
  $uploadExt = array();
60
  $uploadSize = array();
61
  $editFilterArray = array();
62
+ $error = null;
63
 
64
 
 
 
65
  /* Get user info. */
66
  global $current_user;
67
 
131
  if ($wppb_defaultOptions['firstname'] == 'show'){
132
  $_POST['first_name'] = apply_filters('wppb_edit_profile_posted_first_name', $_POST['first_name']);
133
  if ($wppb_defaultOptions['firstnameRequired'] == 'yes'){
134
+ if (isset($_POST['first_name']) && (trim($_POST['first_name']) != '')){
135
  wp_update_user( array( 'ID' => $current_user->id, 'first_name' => esc_attr( $_POST['first_name'] )));
136
  $changesSaved = 'yes';
137
  }
144
  if ($wppb_defaultOptions['lastname'] == 'show'){
145
  $_POST['last_name'] = apply_filters('wppb_edit_profile_posted_last_name', $_POST['last_name']);
146
  if ($wppb_defaultOptions['lastnameRequired'] == 'yes'){
147
+ if (isset($_POST['last_name']) && (trim($_POST['last_name']) != '')){
148
  wp_update_user( array( 'ID' => $current_user->id, 'last_name' => esc_attr( $_POST['last_name'] )));
149
  $changesSaved = 'yes';
150
  }
157
  if ($wppb_defaultOptions['nickname'] == 'show'){
158
  $_POST['nickname'] = apply_filters('wppb_edit_profile_posted_nickname', $_POST['nickname']);
159
  if ($wppb_defaultOptions['nicknameRequired'] == 'yes'){
160
+ if (isset($_POST['nickname']) && (trim($_POST['nickname']) != '')){
161
  wp_update_user( array( 'ID' => $current_user->id, 'nickname' => esc_attr( $_POST['nickname'] )));
162
  $changesSaved = 'yes';
163
  }
171
  if ($wppb_defaultOptions['dispname'] == 'show'){
172
  $_POST['display_name'] = apply_filters('wppb_edit_profile_posted_display_name', $_POST['display_name']);
173
  if ($wppb_defaultOptions['dispnameRequired'] == 'yes'){
174
+ if (isset($_POST['display_name']) && (trim($_POST['display_name']) != '')){
175
  wp_update_user( array( 'ID' => $current_user->id, 'display_name' => esc_attr( $_POST['display_name'] )));
176
  $changesSaved = 'yes';
177
  }
184
  if ($wppb_defaultOptions['website'] == 'show'){
185
  $_POST['website'] = apply_filters('wppb_edit_profile_posted_website', $_POST['website']);
186
  if ($wppb_defaultOptions['websiteRequired'] == 'yes'){
187
+ if (isset($_POST['website']) && (trim($_POST['website']) != '')){
188
  $wppbPos = strpos( (string)$_POST['website'], 'http://' );
189
  if($wppbPos !== FALSE){
190
  wp_update_user( array( 'ID' => $current_user->id, 'user_url' => esc_attr( $_POST['website'] )));
214
  if ($wppb_defaultOptions['aim'] == 'show'){
215
  $_POST['aim'] = apply_filters('wppb_edit_profile_posted_aim', $_POST['aim']);
216
  if ($wppb_defaultOptions['aimRequired'] == 'yes'){
217
+ if (isset($_POST['aim']) && (trim($_POST['aim']) != '')){
218
  update_user_meta( $current_user->id, 'aim', esc_attr( $_POST['aim'] ) );
219
  $changesSaved = 'yes';
220
  }
227
  if ($wppb_defaultOptions['yahoo'] == 'show'){
228
  $_POST['yim'] = apply_filters('wppb_edit_profile_posted_yahoo', $_POST['yim']);
229
  if ($wppb_defaultOptions['yahooRequired'] == 'yes'){
230
+ if (isset($_POST['yim']) && (trim($_POST['yim']) != '')){
231
  update_user_meta( $current_user->id, 'yim', esc_attr( $_POST['yim'] ) );
232
  $changesSaved = 'yes';
233
  }
240
  if ($wppb_defaultOptions['jabber'] == 'show'){
241
  $_POST['jabber'] = apply_filters('wppb_edit_profile_posted_jabber', $_POST['jabber']);
242
  if ($wppb_defaultOptions['jabberRequired'] == 'yes'){
243
+ if (isset($_POST['jabber']) && (trim($_POST['jabber']) != '')){
244
  update_user_meta( $current_user->id, 'jabber', esc_attr( $_POST['jabber'] ) );
245
  $changesSaved = 'yes';
246
  }
253
  if ($wppb_defaultOptions['bio'] == 'show'){
254
  $_POST['description'] = apply_filters('wppb_edit_profile_posted_bio', $_POST['description']);
255
  if ($wppb_defaultOptions['bioRequired'] == 'yes'){
256
+ if (isset($_POST['description']) && (trim($_POST['description']) != '')){
257
  update_user_meta( $current_user->id, 'description', esc_attr( $_POST['description'] ) );
258
  $changesSaved = 'yes';
259
  }
812
  $errorMark = '';
813
  if ($wppb_defaultOptions['websiteRequired'] == 'yes'){
814
  $errorMark = '<font color="red" title="'. __('This field is marked as required by the administrator.', 'profilebuilder') .'">*</font>';
815
+ if (isset($_POST['website']) && (trim($_POST['website']) == '')){
816
  $errorMark = '<img src="'.WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="'. __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') .'"/>';
817
  $errorVar = ' errorHolder';
818
  }
830
  $errorMark = '';
831
  if ($wppb_defaultOptions['aimRequired'] == 'yes'){
832
  $errorMark = '<font color="red" title="'. __('This field is marked as required by the administrator.', 'profilebuilder') .'">*</font>';
833
+ if (isset($_POST['aim']) && (trim($_POST['aim']) == '')){
834
  $errorMark = '<img src="'.WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="'. __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') .'"/>';
835
  $errorVar = ' errorHolder';
836
  }
848
  $errorMark = '';
849
  if ($wppb_defaultOptions['yahooRequired'] == 'yes'){
850
  $errorMark = '<font color="red" title="'. __('This field is marked as required by the administrator.', 'profilebuilder') .'">*</font>';
851
+ if (isset($_POST['yim']) && (trim($_POST['yim']) == '')){
852
  $errorMark = '<img src="'.WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="'. __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') .'"/>';
853
  $errorVar = ' errorHolder';
854
  }
866
  $errorMark = '';
867
  if ($wppb_defaultOptions['jabberRequired'] == 'yes'){
868
  $errorMark = '<font color="red" title="'. __('This field is marked as required by the administrator.', 'profilebuilder') .'">*</font>';
869
+ if (isset($_POST['jabber']) && (trim($_POST['jabber']) == '')){
870
  $errorMark = '<img src="'.WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="'. __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') .'"/>';
871
  $errorVar = ' errorHolder';
872
  }
887
  $errorMark = '';
888
  if ($wppb_defaultOptions['bioRequired'] == 'yes'){
889
  $errorMark = '<font color="red" title="'. __('This field is marked as required by the administrator.', 'profilebuilder') .'">*</font>';
890
+ if (isset($_POST['description']) && (trim($_POST['description']) == '')){
891
  $errorMark = '<img src="'.WPPB_PLUGIN_URL . '/assets/images/pencil_delete.png" title="'. __('This field wasn\'t updated because you entered and empty string (It was marked as required by the administrator.', 'profilebuilder') .'"/>';
892
  $errorVar = ' errorHolder';
893
  }
front-end/wppb.register.php CHANGED
@@ -34,151 +34,6 @@ function signup_password_random_password_filter($password) {
34
  }
35
 
36
 
37
- /* Hook to add AP user meta after signup autentification */
38
- add_action('wpmu_activate_user','wppb_add_meta_to_user_on_activation',10,3);
39
- /**
40
- * Function that adds AP user meta after signup autentification and it is also used when editing the user uprofile
41
- */
42
- function wppb_add_meta_to_user_on_activation($user_id, $password, $meta){
43
-
44
- //copy the data from the meta field (default fields)
45
- if( !empty($meta['first_name'] ) )
46
- update_user_meta( $user_id, 'first_name', $meta['first_name'] );
47
- if( !empty($meta['last_name'] ) )
48
- update_user_meta( $user_id, 'last_name', $meta['last_name'] );
49
- if( !empty($meta['nickname'] ) )
50
- update_user_meta( $user_id, 'nickname', $meta['nickname'] );
51
- if( !empty($meta['user_url'] ) )
52
- update_user_meta( $user_id, 'user_url', $meta['user_url'] );
53
- if( !empty($meta['aim'] ) )
54
- update_user_meta( $user_id, 'aim', $meta['aim'] );
55
- if( !empty($meta['yim'] ) )
56
- update_user_meta( $user_id, 'yim', $meta['yim'] );
57
- if( !empty($meta['jabber'] ) )
58
- update_user_meta( $user_id, 'jabber', $meta['jabber'] );
59
- if( !empty($meta['description'] ) )
60
- update_user_meta( $user_id, 'description', $meta['description'] );
61
-
62
- //update the users role (s)he registered for
63
- if( !empty($meta['role'] ) ){
64
- $user = new WP_User($user_id);
65
- $user->set_role($meta['role']);
66
- }
67
-
68
- //copy the data from the meta fields (custom fields)
69
- $wppb_premium = WPPB_PLUGIN_DIR . '/premium/functions/';
70
- if (file_exists ( $wppb_premium.'extra.fields.php' )){
71
- $wppbFetchArray = get_option('wppb_custom_fields');
72
- foreach ( $wppbFetchArray as $key => $value){
73
- switch ($value['item_type']) {
74
- case "input":{
75
- if( !empty($meta[$value['item_type'].$value['id']] ) )
76
- update_user_meta( $user_id, $value['item_metaName'], $meta[$value['item_type'].$value['id']] );
77
- break;
78
- }
79
- case "hiddenInput":{
80
- if( !empty($meta[$value['item_type'].$value['id']] ) )
81
- update_user_meta( $user_id, $value['item_metaName'], $meta[$value['item_type'].$value['id']] );
82
- break;
83
- }
84
- case "checkbox":{
85
- if( !empty($meta[$value['item_type'].$value['id']] ) )
86
- update_user_meta( $user_id, $value['item_metaName'], $meta[$value['item_type'].$value['id']] );
87
- break;
88
- }
89
- case "radio":{
90
- if( !empty($meta[$value['item_type'].$value['id']] ) )
91
- update_user_meta( $user_id, $value['item_metaName'], $meta[$value['item_type'].$value['id']] );
92
- break;
93
- }
94
- case "select":{
95
- if( !empty($meta[$value['item_type'].$value['id']] ) )
96
- update_user_meta( $user_id, $value['item_metaName'], $meta[$value['item_type'].$value['id']] );
97
- break;
98
- }
99
- case "countrySelect":{
100
- if( !empty($meta[$value['item_type'].$value['id']] ) )
101
- update_user_meta( $user_id, $value['item_metaName'], $meta[$value['item_type'].$value['id']] );
102
- break;
103
- }
104
- case "timeZone":{
105
- if( !empty($meta[$value['item_type'].$value['id']] ) )
106
- update_user_meta( $user_id, $value['item_metaName'], $meta[$value['item_type'].$value['id']] );
107
- break;
108
- }
109
- case "datepicker":{
110
- if( !empty($meta[$value['item_type'].$value['id']] ) )
111
- update_user_meta( $user_id, $value['item_metaName'], $meta[$value['item_type'].$value['id']] );
112
- break;
113
- }
114
- case "textarea":{
115
- if( !empty($meta[$value['item_type'].$value['id']] ) )
116
- update_user_meta( $user_id, $value['item_metaName'], $meta[$value['item_type'].$value['id']] );
117
- break;
118
- }
119
- case "upload":{
120
- if( !empty($meta[$value['item_type'].$value['id']] ) ){
121
- $filename = $meta[$value['item_type'].$value['id']];
122
-
123
- $fileNameStartUpload = strpos ( (string)$filename , '_attachment_' );
124
- $originalUploadFilename = substr($filename, $fileNameStartUpload+12);
125
- $newFileName = 'userID_'.$user_id.'_attachment_'.$originalUploadFilename;
126
-
127
- $wpUploadPath = wp_upload_dir(); // Array of key => value pairs
128
- $target_path_original = $wpUploadPath['baseurl']."/profile_builder/attachments/";
129
- $fileDir = $wpUploadPath['basedir'].'/profile_builder/attachments/';
130
- $target_path = $target_path_original . 'userID_'.$user_id.'_attachment_'. $originalUploadFilename;
131
-
132
- $renamedVar = rename ($fileDir.$meta[$value['item_type'].$value['id']], $fileDir.$newFileName);
133
-
134
- if ($renamedVar)
135
- add_user_meta( $user_id, $value['item_metaName'], $target_path );
136
- }
137
- break;
138
- }
139
- case "avatar":{
140
- if( !empty($meta[$value['item_type'].$value['id']] ) ){
141
- $filename = $meta[$value['item_type'].$value['id']];
142
-
143
- $fileNameStartAvatar = strpos ( (string)$filename , 'originalAvatar_' );
144
- $originalAvatarFilename = substr($filename, $fileNameStartAvatar+15);
145
- $newFileName = 'userID_'.$user_id.'_originalAvatar_'.$originalAvatarFilename;
146
-
147
- $wpUploadPath = wp_upload_dir(); // Array of key => value pairs
148
- $target_path_original = $wpUploadPath['baseurl']."/profile_builder/avatars/";
149
- $fileDir = $wpUploadPath['basedir'].'/profile_builder/avatars/';
150
- $target_path = $target_path_original . 'userID_'.$user_id.'_originalAvatar_'. $originalAvatarFilename;
151
-
152
- $renamedVar = rename ($fileDir.'wpmuRandomID_'.$meta[$value['item_type'].$value['id'].'_radomUserNumber'].'_originalAvatar_'.$originalAvatarFilename, $fileDir.$newFileName);
153
-
154
- if ($renamedVar){
155
- $wp_filetype = wp_check_filetype(basename( $filename ), null );
156
- $attachment = array('post_mime_type' => $wp_filetype['type'],
157
- 'post_title' => $filename, //preg_replace('/\.[^.]+$/', '', basename($_FILES[$uploadedfile]['name'])),
158
- 'post_content' => '',
159
- 'post_status' => 'inherit'
160
- );
161
-
162
-
163
- $attach_id = wp_insert_attachment( $attachment, $target_path);
164
-
165
- $upFile = image_downsize( $attach_id, 'thumbnail' );
166
- $upFile = $upFile[0];
167
-
168
-
169
-
170
- add_user_meta( $user_id, $value['item_metaName'], $upFile );
171
- wppb_resize_avatar($user_id);
172
- }
173
- }
174
- break;
175
- }
176
- }
177
- }
178
- }
179
- }
180
-
181
-
182
  function wppb_add_custom_field_values($POST, $meta){
183
  /* add the extra profile information */
184
  $wppb_premium = WPPB_PLUGIN_DIR . '/premium/functions/';
@@ -322,79 +177,6 @@ function wppb_add_custom_field_values($POST, $meta){
322
 
323
  }
324
 
325
- //function to add new variables in the address. Checks whether the new variable has to start with a ? or an &
326
- function wppb_passed_arguments_check(){
327
-
328
- $verifyLink = get_permalink();
329
- $questionMarkPosition = strpos ( (string)$verifyLink , '?' );
330
- if ($questionMarkPosition !== FALSE ) //we already have 1 "?"
331
- $passedArgument = '&';
332
- else $passedArgument = '?';
333
-
334
- return $passedArgument;
335
- }
336
-
337
-
338
- // function to add the new user to the signup table if email confirmation is selected as active or it is a wpmu installation
339
- function wppb_signup_user($user, $user_email, $meta = '') {
340
- global $wpdb;
341
-
342
- // Format data
343
- $user = preg_replace( '/\s+/', '', sanitize_user( $user, true ) );
344
- $user_email = sanitize_email( $user_email );
345
- $key = substr( md5( time() . rand() . $user_email ), 0, 16 );
346
- $meta = serialize($meta);
347
-
348
- if ( is_multisite() )
349
- $wpdb->insert( $wpdb->signups, array('domain' => '', 'path' => '', 'title' => '', 'user_login' => $user, 'user_email' => $user_email, 'registered' => current_time('mysql', true), 'activation_key' => $key, 'meta' => $meta) );
350
- else
351
- $wpdb->insert( $wpdb->prefix.'signups', array('domain' => '', 'path' => '', 'title' => '', 'user_login' => $user, 'user_email' => $user_email, 'registered' => current_time('mysql', true), 'activation_key' => $key, 'meta' => $meta) );
352
-
353
- wppb_signup_user_notification($user, $user_email, $key, $meta);
354
- }
355
-
356
- /**
357
- * Notify user of signup success.
358
- *
359
- * Filter 'wppb_signup_user_notification' to bypass this function or
360
- * replace it with your own notification behavior.
361
- *
362
- * Filter 'wppb_signup_user_notification' and
363
- * 'wppb_signup_user_notification' to change the content
364
- * and subject line of the email sent to newly registered users.
365
- *
366
- * @param string $user The user's login name.
367
- * @param string $user_email The user's email address.
368
- * @param array $meta By default, an empty array.
369
- * @param string $key The activation key created in wppb_signup_user()
370
- * @return bool
371
- */
372
- function wppb_signup_user_notification($user, $user_email, $key, $meta = '') {
373
- if ( !apply_filters('wppb_signup_user_notification_filter', $user, $user_email, $key, $meta) )
374
- return false;
375
-
376
- // Send email with activation link.
377
- $admin_email = get_site_option( 'admin_email' );
378
- if ( $admin_email == '' )
379
- $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
380
-
381
- $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
382
- $from_name = apply_filters ('wppb_signup_user_notification_email_from_field', $from_name);
383
- $message_headers = apply_filters ("wppb_signup_user_notification_from", "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n");
384
-
385
- $siteURL = wppb_curpageurl().wppb_passed_arguments_check().'key='.$key;
386
-
387
- $subject = sprintf(apply_filters( 'wppb_signup_user_notification_subject', __( '[%1$s] Activate %2$s', 'profilebuilder'), $user, $user_email, $key, $meta ), $from_name, $user);
388
- $message = sprintf(apply_filters( 'wppb_signup_user_notification_email', __( "To activate your user, please click the following link:\n\n%s%s%s\n\nAfter you activate, you will receive *another email* with your login.\n\n", "profilebuilder" ),$user, $user_email, $key, $meta), '<a href="'.$siteURL.'">', $siteURL, '</a>.');
389
-
390
- wppb_mail( $user_email, $subject, $message, $from_name, '', $user, '', $user_email, 'register_w_email_confirmation', $siteURL, $meta );
391
-
392
- return true;
393
- }
394
-
395
-
396
-
397
-
398
  /**
399
  * Activate a signup.
400
  *
@@ -432,101 +214,38 @@ function wppb_activate_signup($key) {
432
 
433
  if ( ! $user_id )
434
  return $activateUserErrorMessage4 = apply_filters('wppb_register_activate_user_error_message4', '<p class="error">'. __('Could not create user!', 'profilebuilder') .'</p>');
435
-
436
- $now = current_time('mysql', true);
437
-
438
- if ( is_multisite() )
439
- $retVal = $wpdb->update( $wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key) );
440
- else
441
- $retVal = $wpdb->update( $wpdb->prefix.'signups', array('active' => 1, 'activated' => $now), array('activation_key' => $key) );
442
-
443
- if ( isset( $user_already_exists ) )
444
  return $activateUserErrorMessage5 = apply_filters('wppb_register_activate_user_error_message5', '<p class="error">'. __('That username is already activated!', 'profilebuilder') .'</p>');
445
-
446
- wppb_add_meta_to_user_on_activation($user_id, '', $meta);
447
-
448
- // if admin approval is activated, then block the user untill he gets approved
449
- $wppb_generalSettings = get_option('wppb_general_settings');
450
- if($wppb_generalSettings['adminApproval'] == 'yes'){
451
- wp_set_object_terms( $user_id, array( 'unapproved' ), 'user_status', false);
452
- clean_object_term_cache( $user_id, 'user_status' );
453
- }
454
-
455
- wppb_notify_user_registration_email($bloginfo, $user_login, $user_email, 'sending', $password, $wppb_generalSettings['adminApproval']);
456
-
457
- do_action('wppb_activate_user', $user_id, $password, $meta);
458
-
459
- if ($retVal)
460
- return $registerFilterArray['successfullUserActivation'] = apply_filters('wppb_register_successfull_user_activation', '<p class="success">'. __('The user was successfully activated.', 'profilebuilder') .'</p><!-- .success -->');
461
- else
462
- return $registerFilterArray['successfullUserActivationFail'] = apply_filters('wppb_register_failed_user_activation', '<p class="error">'. __('There was an error while trying to activate the user.', 'profilebuilder') .'</p><!-- .error -->');
463
- }
464
-
465
- /**
466
- * Create a user.
467
- *
468
- * @param string $user_name The new user's login name.
469
- * @param string $password The new user's password.
470
- * @param string $email The new user's email address.
471
- * @return mixed Returns false on failure, or int $user_id on success
472
- */
473
- function wppb_create_user( $user_name, $password, $email) {
474
- $user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
475
-
476
- $user_id = wp_create_user( $user_name, $password, $email );
477
- if ( is_wp_error($user_id) )
478
- return false;
479
-
480
- // Newly created users have no roles or caps until they are added to a blog.
481
- delete_user_option( $user_id, 'capabilities' );
482
- delete_user_option( $user_id, 'user_level' );
483
-
484
- do_action( 'wppb_new_user', $user_id );
485
-
486
- return $user_id;
487
- }
488
-
489
-
490
-
491
-
492
-
493
- //send an email to the admin regarding each and every new subscriber, and - if selected - to the user himself
494
- function wppb_notify_user_registration_email($bloginfo, $user_name, $email, $send_credentials_via_email, $passw1, $adminApproval){
495
-
496
- $registerFilterArray['adminMessageOnRegistration'] = sprintf(__( 'New subscriber on %1$s.<br/><br/>Username:%2$s<br/>E-mail:%3$s<br/>', 'profilebuilder'), $bloginfo, $user_name, $email);
497
- if ($adminApproval == 'yes')
498
- $registerFilterArray['adminMessageOnRegistration'] .= '<br/>'. __('The "Admin Approval" feature was activated at the time of registration, so please remember that you need to approve this user before he/she can log in!', 'profilebuilder') ."\r\n";
499
- $registerFilterArray['adminMessageOnRegistration'] = apply_filters('wppb_register_admin_message_content', $registerFilterArray['adminMessageOnRegistration'], $bloginfo, $user_name, $email);
500
 
501
- $registerFilterArray['adminMessageOnRegistrationSubject'] = '['. $bloginfo .'] '. __('A new subscriber has (been) registered!', 'profilebuilder');
502
- $registerFilterArray['adminMessageOnRegistrationSubject'] = apply_filters ('wppb_register_admin_message_title', $registerFilterArray['adminMessageOnRegistrationSubject']);
503
-
504
- if (trim($registerFilterArray['adminMessageOnRegistration']) != '')
505
- wppb_mail(get_option('admin_email'), $registerFilterArray['adminMessageOnRegistrationSubject'], $registerFilterArray['adminMessageOnRegistration'], $blogInfo, '', $user_name, $passw1, $email, 'register_w_o_admin_approval_admin_email', $adminApproval, '' );
 
 
506
 
507
-
508
- //send an email to the newly registered user, if this option was selected
509
- if (isset($send_credentials_via_email) && ($send_credentials_via_email == 'sending')){
510
- //change these variables to modify sent email message, destination and source.
511
 
512
- $registerFilterArray['userMessageFrom'] = $bloginfo;
513
- $registerFilterArray['userMessageFrom'] = apply_filters('wppb_register_from_email_content', $registerFilterArray['userMessageFrom']);
514
 
515
- $registerFilterArray['userMessageSubject'] = __('A new account has been created for you.', 'profilebuilder');
516
- $registerFilterArray['userMessageSubject'] = apply_filters('wppb_register_subject_email_content', $registerFilterArray['userMessageSubject']);
 
 
 
 
 
 
517
 
518
- $registerFilterArray['userMessageContent'] = sprintf(__( 'Welcome to %1$s!<br/><br/> Your username is:%2$s and password:%3$s', 'profilebuilder'), $registerFilterArray['userMessageFrom'], $user_name, $passw1);
519
- if ($adminApproval == 'yes')
520
- $registerFilterArray['userMessageContent'] .= '<br/>'. __('Before you can access your account, an administrator needs to approve it. You will be notified via email.', 'profilebuilder');
521
- $registerFilterArray['userMessageContent'] = apply_filters('wppb_register_email_content', $registerFilterArray['userMessageContent'], $registerFilterArray['userMessageFrom'], $user_name, $passw1);
522
 
523
- $messageSent = wppb_mail( $email, $registerFilterArray['userMessageSubject'], $registerFilterArray['userMessageContent'], $registerFilterArray['userMessageFrom'], '', $user_name, $passw1, $email, 'register_w_o_admin_approval', $adminApproval, '' );
524
 
525
- if( $messageSent == TRUE)
526
- return 2;
527
  else
528
- return 1;
529
- }
530
  }
531
 
532
 
@@ -564,8 +283,6 @@ function wppb_front_end_register($atts){
564
  /* END variables used to verify if all required fields were submitted*/
565
 
566
 
567
- /* Load registration file. */
568
- require_once( ABSPATH . WPINC . '/registration.php' );
569
 
570
  /* Check if users can register. */
571
  $registration = get_option( 'users_can_register' );
34
  }
35
 
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  function wppb_add_custom_field_values($POST, $meta){
38
  /* add the extra profile information */
39
  $wppb_premium = WPPB_PLUGIN_DIR . '/premium/functions/';
177
 
178
  }
179
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  /**
181
  * Activate a signup.
182
  *
214
 
215
  if ( ! $user_id )
216
  return $activateUserErrorMessage4 = apply_filters('wppb_register_activate_user_error_message4', '<p class="error">'. __('Could not create user!', 'profilebuilder') .'</p>');
217
+
218
+ elseif ( isset( $user_already_exists ) )
 
 
 
 
 
 
 
219
  return $activateUserErrorMessage5 = apply_filters('wppb_register_activate_user_error_message5', '<p class="error">'. __('That username is already activated!', 'profilebuilder') .'</p>');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
 
221
+ else{
222
+ $now = current_time('mysql', true);
223
+
224
+ if ( is_multisite() )
225
+ $retVal = $wpdb->update( $wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key) );
226
+ else
227
+ $retVal = $wpdb->update( $wpdb->prefix.'signups', array('active' => 1, 'activated' => $now), array('activation_key' => $key) );
228
 
 
 
 
 
229
 
 
 
230
 
231
+ wppb_add_meta_to_user_on_activation($user_id, '', $meta);
232
+
233
+ // if admin approval is activated, then block the user untill he gets approved
234
+ $wppb_generalSettings = get_option('wppb_general_settings');
235
+ if($wppb_generalSettings['adminApproval'] == 'yes'){
236
+ wp_set_object_terms( $user_id, array( 'unapproved' ), 'user_status', false);
237
+ clean_object_term_cache( $user_id, 'user_status' );
238
+ }
239
 
240
+ wppb_notify_user_registration_email($bloginfo, $user_login, $user_email, 'sending', $password, $wppb_generalSettings['adminApproval']);
 
 
 
241
 
242
+ do_action('wppb_activate_user', $user_id, $password, $meta);
243
 
244
+ if ($retVal)
245
+ return $registerFilterArray['successfullUserActivation'] = apply_filters('wppb_register_successfull_user_activation', '<p class="success">'. __('The user was successfully activated.', 'profilebuilder') .'</p><!-- .success -->');
246
  else
247
+ return $registerFilterArray['successfullUserActivationFail'] = apply_filters('wppb_register_failed_user_activation', '<p class="error">'. __('There was an error while trying to activate the user.', 'profilebuilder') .'</p><!-- .error -->');
248
+ }
249
  }
250
 
251
 
283
  /* END variables used to verify if all required fields were submitted*/
284
 
285
 
 
 
286
 
287
  /* Check if users can register. */
288
  $registration = get_option( 'users_can_register' );
functions/email.confirmation.php ADDED
@@ -0,0 +1,511 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //functions needed for the email-confirmation on single-sites (to create the "_signups" table)
3
+ function wppb_signup_schema($oldVal, $newVal){
4
+
5
+ // Declare these as global in case schema.php is included from a function.
6
+ global $wpdb, $wp_queries, $charset_collate;
7
+
8
+ if ($newVal['emailConfirmation'] == 'yes'){
9
+
10
+ //The database character collate.
11
+ $charset_collate = '';
12
+
13
+ if ( ! empty( $wpdb->charset ) )
14
+ $charset_collate = "DEFAULT CHARACTER SET ".$wpdb->charset;
15
+ if ( ! empty( $wpdb->collate ) )
16
+ $charset_collate .= " COLLATE ".$wpdb->collate;
17
+ $tableName = $wpdb->prefix.'signups';
18
+
19
+ $sql = "
20
+ CREATE TABLE $tableName (
21
+ domain varchar(200) NOT NULL default '',
22
+ path varchar(100) NOT NULL default '',
23
+ title longtext NOT NULL,
24
+ user_login varchar(60) NOT NULL default '',
25
+ user_email varchar(100) NOT NULL default '',
26
+ registered datetime NOT NULL default '0000-00-00 00:00:00',
27
+ activated datetime NOT NULL default '0000-00-00 00:00:00',
28
+ active tinyint(1) NOT NULL default '0',
29
+ activation_key varchar(50) NOT NULL default '',
30
+ meta longtext,
31
+ KEY activation_key (activation_key),
32
+ KEY domain (domain)
33
+ ) $charset_collate;";
34
+
35
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
36
+ $res = dbDelta($sql);
37
+ }
38
+ }
39
+ add_action( 'update_option_wppb_general_settings', 'wppb_signup_schema', 10, 2 );
40
+
41
+
42
+ //function to add new tab in the default WP userlisting with all the users who didn't confirm their account yet
43
+ function wppb_add_peding_users_header_script(){
44
+ ?>
45
+ <script type="text/javascript">
46
+ jQuery(document).ready(function() {
47
+ jQuery.post( ajaxurl , { action:"wppb_get_unconfirmed_email_number"}, function(response) {
48
+ jQuery('.wrap ul.subsubsub').append('<span id="separatorID">|</span> <li class="listUsersWithUncofirmedEmail"><a class="unconfirmedEmailUsers" href="?page=unconfirmed_emails"><?php _e('Users with Unconfirmed Email Address', 'profilebuilder');?></a> <font id="unconfirmedEmailNo" color="grey">('+response.number+')</font></li>');
49
+ });
50
+ });
51
+
52
+ function confirmECActionBulk(URL, message) {
53
+ if (confirm(message)) {
54
+ window.location=URL;
55
+ }
56
+ }
57
+
58
+ // script to create a confirmation box for the user upon approving/unapproving a user
59
+ function confirmECAction(URL, todo, userID, actionText) {
60
+ actionText = '<?php _e('Do you want to', 'profilebuilder');?>'+' '+actionText;
61
+
62
+ if (confirm(actionText)) {
63
+ jQuery.post( ajaxurl , { action:"wppb_handle_email_confirmation_cases", URL:URL, todo:todo, userID:userID}, function(response) {
64
+ if (response == 'ok'){
65
+ window.location=URL;
66
+ }else{
67
+ alert(response);
68
+ }
69
+ });
70
+ }
71
+ }
72
+ </script>
73
+ <?php
74
+ }
75
+
76
+ function wppb_get_unconfirmed_email_number(){
77
+ global $wpdb;
78
+
79
+ $result = mysql_query("SELECT * FROM ".$wpdb->prefix."signups AS t1 WHERE t1.active = 0");
80
+ if ($result === false)
81
+ $retVal = 0;
82
+ else
83
+ $retVal = mysql_num_rows($result);
84
+
85
+ header( 'Content-type: application/json' );
86
+ die( json_encode( array( 'number' => $retVal ) ) );
87
+ }
88
+
89
+
90
+ function wppb_handle_email_confirmation_cases() {
91
+ global $current_user;
92
+ global $wpdb;
93
+
94
+ //die($current_user);
95
+ $url = trim($_POST['URL']);
96
+ $todo = trim($_POST['todo']);
97
+ $userID = trim($_POST['userID']);
98
+
99
+ if (current_user_can('delete_users'))
100
+ if (($todo != '') && ($userID != '')){
101
+
102
+ $iterator = 0;
103
+ $result = mysql_query("SELECT * FROM ".$wpdb->prefix."signups WHERE active=0");
104
+
105
+ if ($todo == 'delete'){
106
+ while ($row=mysql_fetch_row($result)){
107
+ if ((string)$iterator === $userID){
108
+ $result2 = mysql_query("DELETE FROM ".$wpdb->prefix."signups WHERE user_login='".$row[3]."' AND user_email='".$row[4]."'");
109
+ if ($result2)
110
+ die('ok');
111
+ else{
112
+ $failed = __("The selected user couldn't be deleted.", "profilebuilder");
113
+ die($failed);
114
+ }
115
+ }
116
+ $iterator++;
117
+ }
118
+ }elseif ($todo == 'confirm'){
119
+ while ($row=mysql_fetch_row($result)){
120
+ if ((string)$iterator === $userID){
121
+ $ret = wppb_manual_activate_signup($row[8]);
122
+ die($ret);
123
+ }
124
+ $iterator++;
125
+ }
126
+ }
127
+ }
128
+
129
+ $failed = __("You either don't have permission for that action or there was an error!", "profilebuilder");
130
+ die($failed);
131
+ }
132
+
133
+
134
+
135
+ // FUNCTIONS USED BOTH ON THE REGISTRATION PAGE AND THE EMAIL CONFIRMATION TABLE
136
+
137
+ //function to add new variables in the address. Checks whether the new variable has to start with a ? or an &
138
+ function wppb_passed_arguments_check(){
139
+
140
+ $verifyLink = get_permalink();
141
+ $questionMarkPosition = strpos ( (string)$verifyLink , '?' );
142
+ if ($questionMarkPosition !== FALSE ) //we already have 1 "?"
143
+ $passedArgument = '&';
144
+ else $passedArgument = '?';
145
+
146
+ return $passedArgument;
147
+ }
148
+
149
+ // Hook to add AP user meta after signup autentification
150
+ add_action('wpmu_activate_user','wppb_add_meta_to_user_on_activation',10,3);
151
+
152
+ //function that adds AP user meta after signup autentification and it is also used when editing the user uprofile
153
+ function wppb_add_meta_to_user_on_activation($user_id, $password, $meta){
154
+
155
+ //copy the data from the meta field (default fields)
156
+ if( !empty($meta['first_name'] ) )
157
+ update_user_meta( $user_id, 'first_name', $meta['first_name'] );
158
+ if( !empty($meta['last_name'] ) )
159
+ update_user_meta( $user_id, 'last_name', $meta['last_name'] );
160
+ if( !empty($meta['nickname'] ) )
161
+ update_user_meta( $user_id, 'nickname', $meta['nickname'] );
162
+ if( !empty($meta['user_url'] ) )
163
+ update_user_meta( $user_id, 'user_url', $meta['user_url'] );
164
+ if( !empty($meta['aim'] ) )
165
+ update_user_meta( $user_id, 'aim', $meta['aim'] );
166
+ if( !empty($meta['yim'] ) )
167
+ update_user_meta( $user_id, 'yim', $meta['yim'] );
168
+ if( !empty($meta['jabber'] ) )
169
+ update_user_meta( $user_id, 'jabber', $meta['jabber'] );
170
+ if( !empty($meta['description'] ) )
171
+ update_user_meta( $user_id, 'description', $meta['description'] );
172
+
173
+ //update the users role (s)he registered for
174
+ if( !empty($meta['role'] ) ){
175
+ $user = new WP_User($user_id);
176
+ $user->set_role($meta['role']);
177
+ }
178
+
179
+ //copy the data from the meta fields (custom fields)
180
+ $wppb_premium = WPPB_PLUGIN_DIR . '/premium/functions/';
181
+ if (file_exists ( $wppb_premium.'extra.fields.php' )){
182
+ $wppbFetchArray = get_option('wppb_custom_fields');
183
+ foreach ( $wppbFetchArray as $key => $value){
184
+ switch ($value['item_type']) {
185
+ case "input":{
186
+ if( !empty($meta[$value['item_type'].$value['id']] ) )
187
+ update_user_meta( $user_id, $value['item_metaName'], $meta[$value['item_type'].$value['id']] );
188
+ break;
189
+ }
190
+ case "hiddenInput":{
191
+ if( !empty($meta[$value['item_type'].$value['id']] ) )
192
+ update_user_meta( $user_id, $value['item_metaName'], $meta[$value['item_type'].$value['id']] );
193
+ break;
194
+ }
195
+ case "checkbox":{
196
+ if( !empty($meta[$value['item_type'].$value['id']] ) )
197
+ update_user_meta( $user_id, $value['item_metaName'], $meta[$value['item_type'].$value['id']] );
198
+ break;
199
+ }
200
+ case "radio":{
201
+ if( !empty($meta[$value['item_type'].$value['id']] ) )
202
+ update_user_meta( $user_id, $value['item_metaName'], $meta[$value['item_type'].$value['id']] );
203
+ break;
204
+ }
205
+ case "select":{
206
+ if( !empty($meta[$value['item_type'].$value['id']] ) )
207
+ update_user_meta( $user_id, $value['item_metaName'], $meta[$value['item_type'].$value['id']] );
208
+ break;
209
+ }
210
+ case "countrySelect":{
211
+ if( !empty($meta[$value['item_type'].$value['id']] ) )
212
+ update_user_meta( $user_id, $value['item_metaName'], $meta[$value['item_type'].$value['id']] );
213
+ break;
214
+ }
215
+ case "timeZone":{
216
+ if( !empty($meta[$value['item_type'].$value['id']] ) )
217
+ update_user_meta( $user_id, $value['item_metaName'], $meta[$value['item_type'].$value['id']] );
218
+ break;
219
+ }
220
+ case "datepicker":{
221
+ if( !empty($meta[$value['item_type'].$value['id']] ) )
222
+ update_user_meta( $user_id, $value['item_metaName'], $meta[$value['item_type'].$value['id']] );
223
+ break;
224
+ }
225
+ case "textarea":{
226
+ if( !empty($meta[$value['item_type'].$value['id']] ) )
227
+ update_user_meta( $user_id, $value['item_metaName'], $meta[$value['item_type'].$value['id']] );
228
+ break;
229
+ }
230
+ case "upload":{
231
+ if( !empty($meta[$value['item_type'].$value['id']] ) ){
232
+ $filename = $meta[$value['item_type'].$value['id']];
233
+
234
+ $fileNameStartUpload = strpos ( (string)$filename , '_attachment_' );
235
+ $originalUploadFilename = substr($filename, $fileNameStartUpload+12);
236
+ $newFileName = 'userID_'.$user_id.'_attachment_'.$originalUploadFilename;
237
+
238
+ $wpUploadPath = wp_upload_dir(); // Array of key => value pairs
239
+ $target_path_original = $wpUploadPath['baseurl']."/profile_builder/attachments/";
240
+ $fileDir = $wpUploadPath['basedir'].'/profile_builder/attachments/';
241
+ $target_path = $target_path_original . 'userID_'.$user_id.'_attachment_'. $originalUploadFilename;
242
+
243
+ $renamedVar = rename ($fileDir.$meta[$value['item_type'].$value['id']], $fileDir.$newFileName);
244
+
245
+ if ($renamedVar)
246
+ add_user_meta( $user_id, $value['item_metaName'], $target_path );
247
+ }
248
+ break;
249
+ }
250
+ case "avatar":{
251
+ if( !empty($meta[$value['item_type'].$value['id']] ) ){
252
+ $filename = $meta[$value['item_type'].$value['id']];
253
+
254
+ $fileNameStartAvatar = strpos ( (string)$filename , 'originalAvatar_' );
255
+ $originalAvatarFilename = substr($filename, $fileNameStartAvatar+15);
256
+ $newFileName = 'userID_'.$user_id.'_originalAvatar_'.$originalAvatarFilename;
257
+
258
+ $wpUploadPath = wp_upload_dir(); // Array of key => value pairs
259
+ $target_path_original = $wpUploadPath['baseurl']."/profile_builder/avatars/";
260
+ $fileDir = $wpUploadPath['basedir'].'/profile_builder/avatars/';
261
+ $target_path = $target_path_original . 'userID_'.$user_id.'_originalAvatar_'. $originalAvatarFilename;
262
+
263
+ $renamedVar = rename ($fileDir.'wpmuRandomID_'.$meta[$value['item_type'].$value['id'].'_radomUserNumber'].'_originalAvatar_'.$originalAvatarFilename, $fileDir.$newFileName);
264
+
265
+ if ($renamedVar){
266
+ $wp_filetype = wp_check_filetype(basename( $filename ), null );
267
+ $attachment = array('post_mime_type' => $wp_filetype['type'],
268
+ 'post_title' => $filename, //preg_replace('/\.[^.]+$/', '', basename($_FILES[$uploadedfile]['name'])),
269
+ 'post_content' => '',
270
+ 'post_status' => 'inherit'
271
+ );
272
+
273
+
274
+ $attach_id = wp_insert_attachment( $attachment, $target_path);
275
+
276
+ $upFile = image_downsize( $attach_id, 'thumbnail' );
277
+ $upFile = $upFile[0];
278
+
279
+
280
+
281
+ add_user_meta( $user_id, $value['item_metaName'], $upFile );
282
+ wppb_resize_avatar($user_id);
283
+ }
284
+ }
285
+ break;
286
+ }
287
+ }
288
+ }
289
+ }
290
+ }
291
+
292
+
293
+ // function to add the new user to the signup table if email confirmation is selected as active or it is a wpmu installation
294
+ function wppb_signup_user($user, $user_email, $meta = '') {
295
+ global $wpdb;
296
+
297
+ // Format data
298
+ $user = preg_replace( '/\s+/', '', sanitize_user( $user, true ) );
299
+ $user_email = sanitize_email( $user_email );
300
+ $key = substr( md5( time() . rand() . $user_email ), 0, 16 );
301
+ $meta = serialize($meta);
302
+
303
+ if ( is_multisite() )
304
+ $wpdb->insert( $wpdb->signups, array('domain' => '', 'path' => '', 'title' => '', 'user_login' => $user, 'user_email' => $user_email, 'registered' => current_time('mysql', true), 'activation_key' => $key, 'meta' => $meta) );
305
+ else
306
+ $wpdb->insert( $wpdb->prefix.'signups', array('domain' => '', 'path' => '', 'title' => '', 'user_login' => $user, 'user_email' => $user_email, 'registered' => current_time('mysql', true), 'activation_key' => $key, 'meta' => $meta) );
307
+
308
+ wppb_signup_user_notification($user, $user_email, $key, $meta);
309
+ }
310
+
311
+ /**
312
+ * Notify user of signup success.
313
+ *
314
+ * Filter 'wppb_signup_user_notification' to bypass this function or
315
+ * replace it with your own notification behavior.
316
+ *
317
+ * Filter 'wppb_signup_user_notification' and
318
+ * 'wppb_signup_user_notification' to change the content
319
+ * and subject line of the email sent to newly registered users.
320
+ *
321
+ * @param string $user The user's login name.
322
+ * @param string $user_email The user's email address.
323
+ * @param array $meta By default, an empty array.
324
+ * @param string $key The activation key created in wppb_signup_user()
325
+ * @return bool
326
+ */
327
+ function wppb_signup_user_notification($user, $user_email, $key, $meta = '') {
328
+ if ( !apply_filters('wppb_signup_user_notification_filter', $user, $user_email, $key, $meta) )
329
+ return false;
330
+
331
+ // Send email with activation link.
332
+ $admin_email = get_site_option( 'admin_email' );
333
+ if ( $admin_email == '' )
334
+ $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
335
+
336
+ $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
337
+ $from_name = apply_filters ('wppb_signup_user_notification_email_from_field', $from_name);
338
+ $message_headers = apply_filters ("wppb_signup_user_notification_from", "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n");
339
+
340
+ $siteURL = wppb_curpageurl().wppb_passed_arguments_check().'key='.$key;
341
+
342
+ $subject = sprintf(apply_filters( 'wppb_signup_user_notification_subject', __( '[%1$s] Activate %2$s', 'profilebuilder'), $user, $user_email, $key, $meta ), $from_name, $user);
343
+ $message = sprintf(apply_filters( 'wppb_signup_user_notification_email', __( "To activate your user, please click the following link:\n\n%s%s%s\n\nAfter you activate, you will receive *another email* with your login.\n\n", "profilebuilder" ),$user, $user_email, $key, $meta), '<a href="'.$siteURL.'">', $siteURL, '</a>.');
344
+
345
+ wppb_mail( $user_email, $subject, $message, $from_name, '', $user, '', $user_email, 'register_w_email_confirmation', $siteURL, $meta );
346
+
347
+ return true;
348
+ }
349
+
350
+
351
+ /**
352
+ * Activate a signup.
353
+ *
354
+ *
355
+ * @param string $key The activation key provided to the user.
356
+ * @return array An array containing information about the activated user and/or blog
357
+ */
358
+ function wppb_manual_activate_signup($key) {
359
+ global $wpdb;
360
+ $bloginfo = get_bloginfo( 'name' );
361
+
362
+ if ( is_multisite() )
363
+ $signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE activation_key = %s", $key) );
364
+ else
365
+ $signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM ".$wpdb->prefix."signups WHERE activation_key = %s", $key) );
366
+
367
+ if ( !empty( $signup ) && !$signup->active ){
368
+ $meta = unserialize($signup->meta);
369
+ $user_login = $wpdb->escape($signup->user_login);
370
+ $user_email = $wpdb->escape($signup->user_email);
371
+ $password = base64_decode($meta['user_pass']);
372
+
373
+ $user_id = username_exists($user_login);
374
+
375
+ if ( ! $user_id )
376
+ $user_id = wppb_create_user($user_login, $password, $user_email);
377
+ else
378
+ $user_already_exists = true;
379
+
380
+ if ( ! $user_id )
381
+ return __('Could not create user!', 'profilebuilder');
382
+
383
+ elseif ( isset( $user_already_exists ) )
384
+ return __('That username is already activated!', 'profilebuilder');
385
+
386
+ else{
387
+ $now = current_time('mysql', true);
388
+
389
+ if ( is_multisite() )
390
+ $retVal = $wpdb->update( $wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key) );
391
+ else
392
+ $retVal = $wpdb->update( $wpdb->prefix.'signups', array('active' => 1, 'activated' => $now), array('activation_key' => $key) );
393
+
394
+ wppb_add_meta_to_user_on_activation($user_id, '', $meta);
395
+
396
+ // if admin approval is activated, then block the user untill he gets approved
397
+ $wppb_generalSettings = get_option('wppb_general_settings');
398
+ if($wppb_generalSettings['adminApproval'] == 'yes'){
399
+ wp_set_object_terms( $user_id, array( 'unapproved' ), 'user_status', false);
400
+ clean_object_term_cache( $user_id, 'user_status' );
401
+ }
402
+
403
+ wppb_notify_user_registration_email($bloginfo, $user_login, $user_email, 'sending', $password, $wppb_generalSettings['adminApproval']);
404
+
405
+ do_action('wppb_activate_user', $user_id, $password, $meta);
406
+
407
+ if ($retVal)
408
+ return 'ok';
409
+ else
410
+ return __('There was an error while trying to activate the user.', 'profilebuilder');
411
+
412
+ }
413
+ }
414
+ }
415
+
416
+ /**
417
+ * Create a user.
418
+ *
419
+ * @param string $user_name The new user's login name.
420
+ * @param string $password The new user's password.
421
+ * @param string $email The new user's email address.
422
+ * @return mixed Returns false on failure, or int $user_id on success
423
+ */
424
+ function wppb_create_user( $user_name, $password, $email) {
425
+ $user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
426
+
427
+ $user_id = wp_create_user( $user_name, $password, $email );
428
+ if ( is_wp_error($user_id) )
429
+ return false;
430
+
431
+ // Newly created users have no roles or caps until they are added to a blog.
432
+ delete_user_option( $user_id, 'capabilities' );
433
+ delete_user_option( $user_id, 'user_level' );
434
+
435
+ do_action( 'wppb_new_user', $user_id );
436
+
437
+ return $user_id;
438
+ }
439
+
440
+ //send an email to the admin regarding each and every new subscriber, and - if selected - to the user himself
441
+ function wppb_notify_user_registration_email($bloginfo, $user_name, $email, $send_credentials_via_email, $passw1, $adminApproval){
442
+
443
+ $registerFilterArray['adminMessageOnRegistration'] = sprintf(__( 'New subscriber on %1$s.<br/><br/>Username:%2$s<br/>E-mail:%3$s<br/>', 'profilebuilder'), $bloginfo, $user_name, $email);
444
+ if ($adminApproval == 'yes')
445
+ $registerFilterArray['adminMessageOnRegistration'] .= '<br/>'. __('The "Admin Approval" feature was activated at the time of registration, so please remember that you need to approve this user before he/she can log in!', 'profilebuilder') ."\r\n";
446
+ $registerFilterArray['adminMessageOnRegistration'] = apply_filters('wppb_register_admin_message_content', $registerFilterArray['adminMessageOnRegistration'], $bloginfo, $user_name, $email);
447
+
448
+ $registerFilterArray['adminMessageOnRegistrationSubject'] = '['. $bloginfo .'] '. __('A new subscriber has (been) registered!', 'profilebuilder');
449
+ $registerFilterArray['adminMessageOnRegistrationSubject'] = apply_filters ('wppb_register_admin_message_title', $registerFilterArray['adminMessageOnRegistrationSubject']);
450
+
451
+ if (trim($registerFilterArray['adminMessageOnRegistration']) != '')
452
+ wppb_mail(get_option('admin_email'), $registerFilterArray['adminMessageOnRegistrationSubject'], $registerFilterArray['adminMessageOnRegistration'], $blogInfo, '', $user_name, $passw1, $email, 'register_w_o_admin_approval_admin_email', $adminApproval, '' );
453
+
454
+
455
+ //send an email to the newly registered user, if this option was selected
456
+ if (isset($send_credentials_via_email) && ($send_credentials_via_email == 'sending')){
457
+ //change these variables to modify sent email message, destination and source.
458
+
459
+ $registerFilterArray['userMessageFrom'] = $bloginfo;
460
+ $registerFilterArray['userMessageFrom'] = apply_filters('wppb_register_from_email_content', $registerFilterArray['userMessageFrom']);
461
+
462
+ $registerFilterArray['userMessageSubject'] = __('A new account has been created for you.', 'profilebuilder');
463
+ $registerFilterArray['userMessageSubject'] = apply_filters('wppb_register_subject_email_content', $registerFilterArray['userMessageSubject']);
464
+
465
+ $registerFilterArray['userMessageContent'] = sprintf(__( 'Welcome to %1$s!<br/><br/> Your username is:%2$s and password:%3$s', 'profilebuilder'), $registerFilterArray['userMessageFrom'], $user_name, $passw1);
466
+ if ($adminApproval == 'yes')
467
+ $registerFilterArray['userMessageContent'] .= '<br/>'. __('Before you can access your account, an administrator needs to approve it. You will be notified via email.', 'profilebuilder');
468
+ $registerFilterArray['userMessageContent'] = apply_filters('wppb_register_email_content', $registerFilterArray['userMessageContent'], $registerFilterArray['userMessageFrom'], $user_name, $passw1);
469
+
470
+ $messageSent = wppb_mail( $email, $registerFilterArray['userMessageSubject'], $registerFilterArray['userMessageContent'], $registerFilterArray['userMessageFrom'], '', $user_name, $passw1, $email, 'register_w_o_admin_approval', $adminApproval, '' );
471
+
472
+ if( $messageSent == TRUE)
473
+ return 2;
474
+ else
475
+ return 1;
476
+ }
477
+ }
478
+
479
+ // END FUNCTIONS USED BOTH ON THE REGISTRATION PAGE AND THE EMAIL CONFIRMATION TABLE
480
+
481
+
482
+
483
+
484
+
485
+ // Set up the AJAX hooks
486
+ add_action( 'wp_ajax_wppb_get_unconfirmed_email_number', 'wppb_get_unconfirmed_email_number' );
487
+ add_action( 'wp_ajax_wppb_handle_email_confirmation_cases', 'wppb_handle_email_confirmation_cases' );
488
+
489
+ if (is_multisite()){
490
+
491
+ if (strpos($_SERVER['SCRIPT_NAME'], 'users.php')){ //global $pagenow doesn't seem to work
492
+ add_action( 'admin_head', 'wppb_add_peding_users_header_script' );
493
+
494
+ }
495
+ add_action( 'user_register', 'wppb_update_user_status_on_admin_registration' );
496
+
497
+ }else{
498
+ $wppb_generalSettings = get_option('wppb_general_settings', 'not_found');
499
+ if($wppb_generalSettings != 'not_found')
500
+ if(!empty($wppb_generalSettings['emailConfirmation']) && ($wppb_generalSettings['emailConfirmation'] == 'yes')){
501
+ global $pagenow;
502
+
503
+ if ($pagenow == 'users.php'){
504
+ add_action( 'admin_head', 'wppb_add_peding_users_header_script' );
505
+
506
+ }
507
+ add_action( 'user_register', 'wppb_update_user_status_on_admin_registration' );
508
+ }
509
+ }
510
+
511
+
functions/functions.load.php CHANGED
@@ -71,6 +71,8 @@ if (file_exists ( $wppb_premiumAdmin.'register.version.php' ))
71
  require_once(WPPB_PLUGIN_DIR.'/functions/basic.info.php');
72
  require_once(WPPB_PLUGIN_DIR.'/functions/general.settings.php');
73
  require_once(WPPB_PLUGIN_DIR.'/functions/admin.bar.php');
 
 
74
  require_once(WPPB_PLUGIN_DIR.'/functions/default.settings.php');
75
 
76
 
@@ -141,48 +143,12 @@ if(!function_exists('wppb_curpageurl')){
141
  }
142
 
143
 
144
- //functions needed for the email-confirmation on single-sites
145
- function wppb_signup_schema($oldVal, $newVal){
146
-
147
- // Declare these as global in case schema.php is included from a function.
148
- global $wpdb, $wp_queries, $charset_collate;
149
-
150
- if ($newVal['emailConfirmation'] == 'yes'){
151
-
152
- //The database character collate.
153
- $charset_collate = '';
154
-
155
- if ( ! empty( $wpdb->charset ) )
156
- $charset_collate = "DEFAULT CHARACTER SET ".$wpdb->charset;
157
- if ( ! empty( $wpdb->collate ) )
158
- $charset_collate .= " COLLATE ".$wpdb->collate;
159
- $tableName = $wpdb->prefix.'signups';
160
-
161
- $sql = "
162
- CREATE TABLE $tableName (
163
- domain varchar(200) NOT NULL default '',
164
- path varchar(100) NOT NULL default '',
165
- title longtext NOT NULL,
166
- user_login varchar(60) NOT NULL default '',
167
- user_email varchar(100) NOT NULL default '',
168
- registered datetime NOT NULL default '0000-00-00 00:00:00',
169
- activated datetime NOT NULL default '0000-00-00 00:00:00',
170
- active tinyint(1) NOT NULL default '0',
171
- activation_key varchar(50) NOT NULL default '',
172
- meta longtext,
173
- KEY activation_key (activation_key),
174
- KEY domain (domain)
175
- ) $charset_collate;";
176
-
177
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
178
- $res = dbDelta($sql);
179
  }
180
- }
181
- add_action( 'update_option_wppb_general_settings', 'wppb_signup_schema', 10, 2 );
182
-
183
-
184
 
185
- if ( is_admin() ){
186
  // include the css for the datepicker
187
  $wppb_premiumDatepicker = WPPB_PLUGIN_DIR . '/premium/assets/css/';
188
  if (file_exists ( $wppb_premiumDatepicker.'datepicker.style.css' )){
@@ -212,22 +178,20 @@ if ( is_admin() ){
212
  // include the stylesheet
213
  add_action('wp_print_styles', 'wppb_add_plugin_stylesheet');
214
 
215
- $wppb_plugin = WPPB_PLUGIN_DIR . '/';
216
-
217
  // include the menu file for the profile informations
218
- include_once($wppb_plugin.'front-end/wppb.edit.profile.php');
219
  add_shortcode('wppb-edit-profile', 'wppb_front_end_profile_info');
220
 
221
  // include the menu file for the login screen
222
- include_once($wppb_plugin.'front-end/wppb.login.php');
223
  add_shortcode('wppb-login', 'wppb_front_end_login');
224
 
225
  // include the menu file for the register screen
226
- include_once($wppb_plugin.'front-end/wppb.register.php');
227
  add_shortcode('wppb-register', 'wppb_front_end_register_handler');
228
 
229
  // include the menu file for the recover password screen
230
- include_once($wppb_plugin.'front-end/wppb.recover.password.php');
231
  add_shortcode('wppb-recover-password', 'wppb_front_end_password_recovery');
232
 
233
  // set the front-end admin bar to show/hide
71
  require_once(WPPB_PLUGIN_DIR.'/functions/basic.info.php');
72
  require_once(WPPB_PLUGIN_DIR.'/functions/general.settings.php');
73
  require_once(WPPB_PLUGIN_DIR.'/functions/admin.bar.php');
74
+ require_once(WPPB_PLUGIN_DIR.'/classes/class.email.confirmation.php');
75
+ require_once(WPPB_PLUGIN_DIR.'/functions/email.confirmation.php');
76
  require_once(WPPB_PLUGIN_DIR.'/functions/default.settings.php');
77
 
78
 
143
  }
144
 
145
 
146
+ if ( is_admin() ){
147
+ add_action('admin_enqueue_scripts', 'wppb_add_backend_style');
148
+ function wppb_add_backend_style(){
149
+ wp_enqueue_style( 'profile-builder-back-end-style', WPPB_PLUGIN_URL.'/assets/css/back.end.css', false, PROFILE_BUILDER_VERSION);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  }
 
 
 
 
151
 
 
152
  // include the css for the datepicker
153
  $wppb_premiumDatepicker = WPPB_PLUGIN_DIR . '/premium/assets/css/';
154
  if (file_exists ( $wppb_premiumDatepicker.'datepicker.style.css' )){
178
  // include the stylesheet
179
  add_action('wp_print_styles', 'wppb_add_plugin_stylesheet');
180
 
 
 
181
  // include the menu file for the profile informations
182
+ include_once(WPPB_PLUGIN_DIR.'/front-end/wppb.edit.profile.php');
183
  add_shortcode('wppb-edit-profile', 'wppb_front_end_profile_info');
184
 
185
  // include the menu file for the login screen
186
+ include_once(WPPB_PLUGIN_DIR.'/front-end/wppb.login.php');
187
  add_shortcode('wppb-login', 'wppb_front_end_login');
188
 
189
  // include the menu file for the register screen
190
+ include_once(WPPB_PLUGIN_DIR.'/front-end/wppb.register.php');
191
  add_shortcode('wppb-register', 'wppb_front_end_register_handler');
192
 
193
  // include the menu file for the recover password screen
194
+ include_once(WPPB_PLUGIN_DIR.'/front-end/wppb.recover.password.php');
195
  add_shortcode('wppb-recover-password', 'wppb_front_end_password_recovery');
196
 
197
  // set the front-end admin bar to show/hide
functions/general.settings.php CHANGED
@@ -42,15 +42,36 @@ function wppb_general_settings(){
42
  <option value="no" <?php if ($wppb_generalSettings['adminApproval'] == 'no') echo 'selected';?>><?php _e('No', 'profilebuilder');?></option>
43
  </select>
44
  <?php
45
- echo '<div id="layoutNoticeDiv">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  <font size="1" id="layoutNotice">
47
  <b>'. __('NOTE:', 'profilebuilder') .'</b><br/>
48
- &rarr; '. __('The black stylesheet is intended for sites/blogs with a dark background.', 'profilebuilder') .'<br/>
49
- &rarr; '. __('The white stylesheet is intended for a sites/blogs with a light background color.', 'profilebuilder') .'<br/>
50
- &rarr; '. __('On single-site installations the "Email Confirmation" feature only works in the front-end, so make sure you also use the "Custom Redirects" feature.', 'profilebuilder') .'
51
- </font>
 
 
52
  </div>';
53
  }
 
 
54
  ?>
55
  <div align="right">
56
  <input type="hidden" name="action" value="update" />
42
  <option value="no" <?php if ($wppb_generalSettings['adminApproval'] == 'no') echo 'selected';?>><?php _e('No', 'profilebuilder');?></option>
43
  </select>
44
  <?php
45
+ $generalInfoNotes =
46
+ '<div id="layoutNoticeDiv">
47
+ <font size="1" id="layoutNotice">
48
+ <b>'. __('NOTE:', 'profilebuilder') .'</b><br/>
49
+ &rarr; '. __('The black stylesheet is intended for sites/blogs with a dark background.', 'profilebuilder') .'<br/>
50
+ &rarr; '. __('The white stylesheet is intended for a sites/blogs with a light background color.', 'profilebuilder') .'<br/>
51
+ &rarr; '. __('On single-site installations the "Email Confirmation" feature only works in the front-end, so make sure you also use the "Custom Redirects" feature.', 'profilebuilder') .'<br/>
52
+ &rarr; '. __('The "Email Confirmation" feature is active (by default) on WPMU installations.', 'profilebuilder');
53
+ if (is_multisite() || ($wppb_generalSettings['emailConfirmation'] == 'yes'))
54
+ $generalInfoNotes .= '<br/>&rarr; '.sprintf(__( 'You can find a list of unconfirmed email addresses %1$shere%2$s.', 'profilebuilder'), '<a href="'.get_bloginfo('url').'/wp-admin/users.php?page=unconfirmed_emails">', '</a>');
55
+ $generalInfoNotes .=
56
+ '</font>
57
+ </div>';
58
+
59
+
60
+ }else{
61
+ $generalInfoNotes =
62
+ '<div id="layoutNoticeDiv">
63
  <font size="1" id="layoutNotice">
64
  <b>'. __('NOTE:', 'profilebuilder') .'</b><br/>
65
+ &rarr; '. __('On single-site installations the "Email Confirmation" feature only works in the front-end.', 'profilebuilder') .'<br/>
66
+ &rarr; '. __('The "Email Confirmation" feature is active (by default) on WPMU installations.', 'profilebuilder');
67
+ if (is_multisite() || ($wppb_generalSettings['emailConfirmation'] == 'yes'))
68
+ $generalInfoNotes .= '<br/>&rarr; '.sprintf(__( 'You can find a list of unconfirmed email addresses %1$shere%2$s.', 'profilebuilder'), '<a href="'.get_bloginfo('url').'/wp-admin/users.php?page=unconfirmed_emails">', '</a>');
69
+ $generalInfoNotes .=
70
+ '</font>
71
  </div>';
72
  }
73
+
74
+ echo $generalInfoNotes;
75
  ?>
76
  <div align="right">
77
  <input type="hidden" name="action" value="update" />
index.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Profile Builder
4
  Plugin URI: http://www.cozmoslabs.com/2011/04/12/wordpress-profile-builder-a-front-end-user-registration-login-and-edit-profile-plugin/
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: 1.1.46
7
  Author: Reflection Media, Barina Gabriel
8
  Author URI: http://www.reflectionmedia.ro
9
  License: GPL2
@@ -54,7 +54,7 @@ function wppb_return_bytes($val) {
54
  }
55
 
56
 
57
- define( 'PROFILE_BUILDER_VERSION', '1.1.46' );
58
  define( 'WPPB_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . dirname( plugin_basename( __FILE__ ) ) );
59
 
60
  if (file_exists ( WPPB_PLUGIN_DIR . '/premium/addons/addon.php' ))
3
  Plugin Name: Profile Builder
4
  Plugin URI: http://www.cozmoslabs.com/2011/04/12/wordpress-profile-builder-a-front-end-user-registration-login-and-edit-profile-plugin/
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: 1.1.47
7
  Author: Reflection Media, Barina Gabriel
8
  Author URI: http://www.reflectionmedia.ro
9
  License: GPL2
54
  }
55
 
56
 
57
+ define( 'PROFILE_BUILDER_VERSION', '1.1.47' );
58
  define( 'WPPB_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . dirname( plugin_basename( __FILE__ ) ) );
59
 
60
  if (file_exists ( WPPB_PLUGIN_DIR . '/premium/addons/addon.php' ))
readme.txt CHANGED
@@ -7,7 +7,7 @@ custom registration, custom registration form, custom registration page, extra u
7
  front-end register, front-end registration, frontend edit profile, edit profile
8
  Requires at least: 3.1
9
  Tested up to: 3.5
10
- Stable tag: 1.1.46
11
 
12
  Simple to use profile plugin allowing front-end login, registration and edit profile by using shortcodes.
13
 
@@ -89,10 +89,15 @@ This plugin only adds/removes fields in the front-end. The default information-f
89
  1. General Settings
90
  2. Show/Hide Admin Bar
91
  3. Select Default User Fields
92
- 4. Logged in Page
93
- 5. Register Page
94
 
95
  == Changelog ==
 
 
 
 
 
96
  = 1.1.46 =
97
  Improved a few existing functions.
98
 
7
  front-end register, front-end registration, frontend edit profile, edit profile
8
  Requires at least: 3.1
9
  Tested up to: 3.5
10
+ Stable tag: 1.1.47
11
 
12
  Simple to use profile plugin allowing front-end login, registration and edit profile by using shortcodes.
13
 
89
  1. General Settings
90
  2. Show/Hide Admin Bar
91
  3. Select Default User Fields
92
+ 4. Register Page
93
+ 5. Logged in Page
94
 
95
  == Changelog ==
96
+ = 1.1.47 =
97
+ Improved the "Email Confirmation" feature and a few other functions.
98
+ Added new options for the "Userlisting" feature (available in the Pro version of Profile Buildeer).
99
+ Added translations: persian (thanks to Ali Mirzaei, info@alimir.ir)
100
+
101
  = 1.1.46 =
102
  Improved a few existing functions.
103