User registration & user profile – Profile Builder - Version 1.0.7

Version Description

Download this release

Release Info

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

Code changes from version 1.0.1 to 1.0.7

Files changed (3) hide show
  1. profile-builder.php +117 -130
  2. readme.txt +17 -2
  3. uninstall.php +7 -10
profile-builder.php CHANGED
@@ -1,130 +1,117 @@
1
- <?php
2
- /*
3
- Plugin Name: Profile Builder
4
- Plugin URI:
5
- Description: Profile Builder lets you create, edit and delete custom user information-fields from the frontend, and also lets you add new, custom fields. You can use the following shortcodes: [wppb-edit-profile] for the front-end profile information, [wppb-login] for a log-in menu or [wppb-register] to register a new user.
6
- Version: v1.0
7
- Author: Reflection Media
8
- Author URI: http://reflectionmedia.ro
9
- License: GPL2
10
- */
11
-
12
-
13
- /* Copyright 2011 Reflection Media (wwww.reflectionmedia.ro)
14
- This program is free software; you can redistribute it and/or modify
15
- it under the terms of the GNU General Public License as published by
16
- the Free Software Foundation; either version 2 of the License, or
17
- (at your option) any later version.
18
- This program is distributed in the hope that it will be useful,
19
- but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- GNU General Public License for more details.
22
- You should have received a copy of the GNU General Public License
23
- along with this program; if not, write to the Free Software
24
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
- */
26
-
27
-
28
- register_activation_hook( __FILE__ , 'wppb_initialize_variables' ); //initialize some values upon plug-in activation
29
- function wppb_initialize_variables(){
30
- $wppb_default_settings = array( 'username' => 'show',
31
- 'firstname'=> 'show',
32
- 'lastname' => 'show',
33
- 'nickname' => 'show',
34
- 'dispname' => 'show',
35
- 'email' => 'show',
36
- 'website' => 'show',
37
- 'aim' => 'show',
38
- 'yahoo' => 'show',
39
- 'jabber' => 'show',
40
- 'bio' => 'show',
41
- 'password' => 'show' );
42
- add_option( 'wppb_default_settings', $wppb_default_settings ); //set all fields visible on first activation of the plugin
43
- add_option( 'wppb_default_style', 'yes');
44
-
45
-
46
-
47
- global $wp_roles;
48
-
49
- $all_roles = $wp_roles->roles;
50
- $editable_roles = apply_filters('editable_roles', $all_roles);
51
-
52
-
53
- $admintSettingsPresent = get_option('wppb_display_admin_settings','not_found');
54
- if ($admintSettingsPresent == 'not_found'){ // if the field doesn't exists, then create it
55
- $rolesArray = array();
56
- foreach ( $editable_roles as $key => $data )
57
- $rolesArray = array( $key => 'show' ) + $rolesArray;
58
- $rolesArray = array_reverse($rolesArray,true);
59
- add_option( 'wppb_display_admin_settings', $rolesArray);
60
- }
61
-
62
- }
63
-
64
-
65
-
66
- function wppb_create_menu(){
67
- add_submenu_page('users.php', 'Profile Builder', 'Profile Builder', 'delete_users', 'ProfileBuilderSettings', 'wppb_display_menu');
68
- }
69
-
70
-
71
- function wppb_register_settings() { // whitelist options, you can add more register_settings changing the second parameter
72
- register_setting( 'wppb-option-group', 'wppb_default_settings' );
73
- register_setting( 'wppb_default_style', 'wppb_default_style' );
74
- register_setting( 'wppb_display_admin_settings', 'wppb_display_admin_settings' );
75
- }
76
-
77
-
78
- function wppb_add_plugin_stylesheet() {
79
- $wppb_showDefaultCss = get_option('wppb_default_style');
80
- $styleUrl = WP_PLUGIN_URL . '/profile-builder/css/style.css';
81
- $styleFile = WP_PLUGIN_DIR . '/profile-builder/css/style.css';
82
- if ( file_exists($styleFile) && $wppb_showDefaultCss == 'yes') {
83
- wp_register_style('wppb_stylesheet', $styleUrl);
84
- wp_enqueue_style( 'wppb_stylesheet');
85
- }
86
- }
87
-
88
-
89
-
90
-
91
- function wppb_show_admin_bar($content){
92
- global $current_user;
93
-
94
- $admintSettingsPresent = get_option('wppb_display_admin_settings','not_found');
95
-
96
- if ($admintSettingsPresent != 'not_found'){
97
- $wppb_showAdminBar = get_option('wppb_display_admin_settings');
98
- $userRole = ($current_user->data->wp_capabilities);
99
- if ($userRole != NULL){
100
- $currentRole = key($userRole);
101
- $getSettings = $wppb_showAdminBar[$currentRole];
102
- if ($getSettings == 'show')
103
- return true;
104
- elseif ($getSettings == 'hide')
105
- return false;
106
- }
107
- }
108
- else
109
- return true;
110
- }
111
-
112
-
113
-
114
-
115
-
116
-
117
- if (is_admin() ){ // if we are in the admin menu
118
- include_once('includes/wppb-menu-file.php'); // include the menu file
119
- add_action('admin_init', 'wppb_register_settings'); // register the settings for the menu only display sidebar menu for a user with a certain capability, in this case only the "admin"
120
- add_action('admin_menu','wppb_create_menu'); // call the wppb_create_menu function
121
- }else{ // if we aren't in the admin back-end menu, aka we are in the front-end view
122
- add_action('wp_print_styles', 'wppb_add_plugin_stylesheet'); // include the standard style-sheet or specify the path to a new one
123
- include_once('includes/wppb-front-end-profile.php'); // include the menu file for the profile informations
124
- add_shortcode('wppb-edit-profile', 'wppb_front_end_profile_info');
125
- include_once('includes/wppb-front-end-login.php'); // include the menu file for the login screen
126
- add_shortcode('wppb-login', 'wppb_front_end_login');
127
- include_once('includes/wppb-front-end-register.php'); // include the menu file for the register screen
128
- add_shortcode('wppb-register', 'wppb_front_end_register');
129
- add_filter( 'show_admin_bar' , 'wppb_show_admin_bar'); // set the front-end admin bar to show/hide
130
- }
1
+ <?php
2
+ /*
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.
6
+ Version: 1.0.6
7
+ Author: Reflection Media
8
+ Author URI: http://reflectionmedia.ro
9
+ License: GPL2
10
+
11
+ == Copyright ==
12
+ Copyright 2011 Reflection Media (wwww.reflectionmedia.ro)
13
+
14
+ This program is free software; you can redistribute it and/or modify
15
+ it under the terms of the GNU General Public License as published by
16
+ the Free Software Foundation; either version 2 of the License, or
17
+ (at your option) any later version.
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+ You should have received a copy of the GNU General Public License
23
+ along with this program; if not, write to the Free Software
24
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
+ */
26
+
27
+ register_activation_hook( __FILE__ , 'wppb_initialize_variables' ); //initialize some values upon plug-in activation
28
+
29
+ function wppb_initialize_variables(){
30
+ $wppb_default_settings = array( 'username' => 'show',
31
+ 'firstname'=> 'show',
32
+ 'lastname' => 'show',
33
+ 'nickname' => 'show',
34
+ 'dispname' => 'show',
35
+ 'email' => 'show',
36
+ 'website' => 'show',
37
+ 'aim' => 'show',
38
+ 'yahoo' => 'show',
39
+ 'jabber' => 'show',
40
+ 'bio' => 'show',
41
+ 'password' => 'show' );
42
+ add_option( 'wppb_default_settings', $wppb_default_settings ); //set all fields visible on first activation of the plugin
43
+ add_option( 'wppb_default_style', 'yes');
44
+
45
+ global $wp_roles;
46
+ $all_roles = $wp_roles->roles;
47
+ $editable_roles = apply_filters('editable_roles', $all_roles);
48
+
49
+ $admintSettingsPresent = get_option('wppb_display_admin_settings','not_found');
50
+
51
+ if ($admintSettingsPresent == 'not_found'){ // if the field doesn't exists, then create it
52
+ $rolesArray = array();
53
+ foreach ( $editable_roles as $key => $data )
54
+ $rolesArray = array( $key => 'show' ) + $rolesArray;
55
+ $rolesArray = array_reverse($rolesArray,true);
56
+ add_option( 'wppb_display_admin_settings', $rolesArray);
57
+ }
58
+ }
59
+
60
+
61
+ function wppb_create_menu(){
62
+ add_submenu_page('users.php', 'Profile Builder', 'Profile Builder', 'delete_users', 'ProfileBuilderSettings', 'wppb_display_menu');
63
+ }
64
+
65
+
66
+ function wppb_register_settings() { // whitelist options, you can add more register_settings changing the second parameter
67
+ register_setting( 'wppb-option-group', 'wppb_default_settings' );
68
+ register_setting( 'wppb_default_style', 'wppb_default_style' );
69
+ register_setting( 'wppb_display_admin_settings', 'wppb_display_admin_settings' );
70
+ }
71
+
72
+
73
+ function wppb_add_plugin_stylesheet() {
74
+ $wppb_showDefaultCss = get_option('wppb_default_style');
75
+ $styleUrl = WP_PLUGIN_URL . '/profile-builder/css/style.css';
76
+ $styleFile = WP_PLUGIN_DIR . '/profile-builder/css/style.css';
77
+ if ( file_exists($styleFile) && $wppb_showDefaultCss == 'yes') {
78
+ wp_register_style('wppb_stylesheet', $styleUrl);
79
+ wp_enqueue_style( 'wppb_stylesheet');
80
+ }
81
+ }
82
+
83
+
84
+ function wppb_show_admin_bar($content){
85
+ global $current_user;
86
+ $admintSettingsPresent = get_option('wppb_display_admin_settings','not_found');
87
+ if ($admintSettingsPresent != 'not_found'){
88
+ $wppb_showAdminBar = get_option('wppb_display_admin_settings');
89
+ $userRole = ($current_user->data->wp_capabilities);
90
+ if ($userRole != NULL){
91
+ $currentRole = key($userRole);
92
+ $getSettings = $wppb_showAdminBar[$currentRole];
93
+ if ($getSettings == 'show')
94
+ return true;
95
+ elseif ($getSettings == 'hide')
96
+ return false;
97
+ }
98
+ }
99
+ else
100
+ return true;
101
+ }
102
+
103
+
104
+ if (is_admin() ){ // if we are in the admin menu
105
+ include_once('includes/wppb-menu-file.php'); // include the menu file
106
+ add_action('admin_init', 'wppb_register_settings'); // register the settings for the menu only display sidebar menu for a user with a certain capability, in this case only the "admin"
107
+ add_action('admin_menu','wppb_create_menu'); // call the wppb_create_menu function
108
+ }else{ // if we aren't in the admin back-end menu, aka we are in the front-end view
109
+ add_action('wp_print_styles', 'wppb_add_plugin_stylesheet'); // include the standard style-sheet or specify the path to a new one
110
+ include_once('includes/wppb-front-end-profile.php'); // include the menu file for the profile informations
111
+ add_shortcode('wppb-edit-profile', 'wppb_front_end_profile_info');
112
+ include_once('includes/wppb-front-end-login.php'); // include the menu file for the login screen
113
+ add_shortcode('wppb-login', 'wppb_front_end_login');
114
+ include_once('includes/wppb-front-end-register.php'); // include the menu file for the register screen
115
+ add_shortcode('wppb-register', 'wppb_front_end_register');
116
+ add_filter( 'show_admin_bar' , 'wppb_show_admin_bar'); // set the front-end admin bar to show/hide
117
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -2,10 +2,10 @@
2
 
3
  Contributors: reflectionmedia, barinagabriel
4
  Donate link: http://www.cozmoslabs.com/2011/04/12/wordpress-profile-builder-a-front-end-user-registration-login-and-edit-profile-plugin
5
- Tags: user registration, custom field registration, customize profile, user fields, builder, profile builder
6
  Requires at least: 3.1
7
  Tested up to: 3.1
8
- Stable tag: 1.0.1
9
 
10
 
11
  Login, registration and edit profile shortcodes for the front-end. Also you can chose what fields should be displayed.
@@ -64,6 +64,21 @@ No, only fields visible to the users will/can be modified/updated.
64
 
65
  == Changelog ==
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  = 1.0.1 =
68
  Changes to the ReadMe File
69
 
2
 
3
  Contributors: reflectionmedia, barinagabriel
4
  Donate link: http://www.cozmoslabs.com/2011/04/12/wordpress-profile-builder-a-front-end-user-registration-login-and-edit-profile-plugin
5
+ Tags: user registration, custom field registration, customize profile, user fields, builder, profile builder
6
  Requires at least: 3.1
7
  Tested up to: 3.1
8
+ Stable tag: 1.0
9
 
10
 
11
  Login, registration and edit profile shortcodes for the front-end. Also you can chose what fields should be displayed.
64
 
65
  == Changelog ==
66
 
67
+ = 1.0.6 =
68
+ Apparently the WordPress.org svn converts my EOL from Windows to Mac and because of that you get "The plugin does not have a valid header."
69
+
70
+ = 1.0.5 =
71
+ You can now actualy install the plugin. All because of a silly line break.
72
+
73
+ = 1.0.4 =
74
+ Still no Change.
75
+
76
+ = 1.0.3 =
77
+ No Change.
78
+
79
+ = 1.0.2 =
80
+ Small changes.
81
+
82
  = 1.0.1 =
83
  Changes to the ReadMe File
84
 
uninstall.php CHANGED
@@ -1,10 +1,7 @@
1
- <?php
2
-
3
- if( !defined( 'WP_UNINSTALL_PLUGIN' ) )
4
- exit (); // If uninstall not called from WordPress exit
5
-
6
- delete_option( 'wppb_default_settings' ); // Delete default settings from options table
7
- delete_option( 'wppb_default_style' ); // Delete "use default css or not" settings
8
- delete_option( 'wppb_display_admin_settings' ); // Delete display admin bar option
9
-
10
- ?>
1
+ <?php
2
+ if( !defined( 'WP_UNINSTALL_PLUGIN' ) )
3
+ exit (); // If uninstall not called from WordPress exit
4
+
5
+ delete_option( 'wppb_default_settings' ); // Delete default settings from options table
6
+ delete_option( 'wppb_default_style' ); // Delete "use default css or not" settings
7
+ delete_option( 'wppb_display_admin_settings' ); // Delete display admin bar option