PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 1.1.9
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v1.1.9
4.0.3 4.0.2 4.0.1 4.0.0 3.16.6 3.16.5 3.16.4 3.16.3 3.16.2 3.16.1 3.16.0 3.15.9 3.9.9 3.9.5 3.9.6 3.9.7 3.9.8 1.1.7 1.1.8 1.1.9 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 341 releases
profile-builder / functions / functions.load.php

functions.load.php in User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor 1.1.9, at functions/functions.load.php

185 lines 7.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if (!defined('ProfileBuilderVersion')) exit('No direct script access allowed');
2 /*
3 Original Plugin Name: OptionTree
4 Original Plugin URI: http://wp.envato.com
5 Original Author: Derek Herman
6 Original Author URI: http://valendesigns.com
7 */
8
9 /**
10 * Functions Load
11 *
12 */
13 /* whitelist options, you can add more register_settings changing the second parameter */
14
15 function wppb_register_settings() {
16 $premiumPresent = wppb_plugin_dir . '/premium/premium.php';
17 $addonPresent = wppb_plugin_dir . '/premium/addon/addon.php';
18
19 register_setting( 'wppb_option_group', 'wppb_default_settings' );
20 register_setting( 'wppb_default_style', 'wppb_default_style' );
21 register_setting( 'wppb_display_admin_settings', 'wppb_display_admin_settings' );
22 if (file_exists($premiumPresent)){
23 register_setting( 'wppb_profile_builder_pro_serial', 'wppb_profile_builder_pro_serial' );
24 }
25 if (file_exists($addonPresent)){
26 register_setting( 'wppb_premium_addon_settings', 'wppb_premium_addon_settings' );
27 register_setting( 'customRedirectSettings', 'customRedirectSettings' );
28 register_setting( 'userListingSettings', 'userListingSettings' );
29 }
30
31
32 }
33
34
35 function wppb_add_plugin_stylesheet() {
36 $wppb_showDefaultCss = get_option('wppb_default_style');
37 $styleUrl_default = wppb_plugin_url . '/assets/css/front.end.css';
38 $styleUrl_white = wppb_plugin_url . '/premium/assets/css/front.end.white.css';
39 $styleUrl_black = wppb_plugin_url . '/premium/assets/css/front.end.black.css';
40 $styleFile_default = wppb_plugin_dir . '/assets/css/front.end.css';
41 $styleFile_white = wppb_plugin_dir . '/premium/assets/css/front.end.white.css';
42 $styleFile_black = wppb_plugin_dir . '/premium/assets/css/front.end.black.css';
43 if ( (file_exists($styleFile_default)) && ($wppb_showDefaultCss == 'yes') ) {
44 wp_register_style('wppb_stylesheet', $styleUrl_default);
45 wp_enqueue_style( 'wppb_stylesheet');
46 }elseif ( (file_exists($styleFile_white)) && ($wppb_showDefaultCss == 'white') ) {
47 wp_register_style('wppb_stylesheet', $styleUrl_white);
48 wp_enqueue_style( 'wppb_stylesheet');
49 }elseif ( (file_exists($styleFile_black)) && ($wppb_showDefaultCss == 'black') ) {
50 wp_register_style('wppb_stylesheet', $styleUrl_black);
51 wp_enqueue_style( 'wppb_stylesheet');
52 }
53 }
54
55
56 function wppb_show_admin_bar($content){
57 global $current_user;
58 $admintSettingsPresent = get_option('wppb_display_admin_settings','not_found');
59 if ($admintSettingsPresent != 'not_found'){
60 $wppb_showAdminBar = get_option('wppb_display_admin_settings');
61 if ($current_user->ID != 0){
62 $userRole = ($current_user->data->wp_capabilities);
63 if ($userRole != NULL){
64 $currentRole = key($userRole);
65 $getSettings = $wppb_showAdminBar[$currentRole];
66 if ($getSettings == 'show')
67 return true;
68 elseif ($getSettings == 'hide')
69 return false;
70 }
71 }
72 }
73 else
74 return true;
75 }
76
77 if(!function_exists('wppb_curpageurl')){
78 function wppb_curpageurl() {
79 $pageURL = 'http';
80 if ((isset($_SERVER["HTTPS"])) && ($_SERVER["HTTPS"] == "on")) {
81 $pageURL .= "s";
82 }
83 $pageURL .= "://";
84 if ($_SERVER["SERVER_PORT"] != "80") {
85 $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
86 } else {
87 $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
88 }
89 return $pageURL;
90 }
91 }
92
93
94
95 if ( is_admin() ){
96 /* include the css for the datepicker */
97 $wppb_premiumDatepicker = wppb_plugin_dir . '/premium/assets/css/';
98 if (file_exists ( $wppb_premiumDatepicker.'datepicker.style.css' ))
99 wp_enqueue_style( 'profile-builder-admin-datepicker-style', wppb_plugin_url.'/premium/assets/css/datepicker.style.css', false, ProfileBuilderVersion);
100
101
102
103 /* register the settings for the menu only display sidebar menu for a user with a certain capability, in this case only the "admin" */
104 add_action('admin_init', 'wppb_register_settings');
105
106 $wppb_premiumAdmin = wppb_plugin_dir . '/premium/functions/';
107 if (file_exists ( $wppb_premiumAdmin.'premium.functions.load.php' )){
108 include_once($wppb_premiumAdmin.'premium.functions.load.php');
109
110 /* check whether a delete attachment has been requested */
111 add_action('admin_init', 'wppb_deleteAttachment');
112
113 /* check whether a delete avatar has been requested */
114 add_action('admin_init', 'wppb_deleteAvatar');
115
116 }
117
118
119 /* display the same extra profile fields in the admin panel also */
120 $wppb_premium = wppb_plugin_dir . '/premium/functions/';
121 if (file_exists ( $wppb_premium.'extra.fields.php' )){
122 include( $wppb_premium.'extra.fields.php' );
123 add_action( 'show_user_profile', 'display_profile_extra_fields', 10 );
124 add_action( 'edit_user_profile', 'display_profile_extra_fields', 10 );
125 add_action( 'personal_options_update', 'save_extra_profile_fields', 10 );
126 add_action( 'edit_user_profile_update', 'save_extra_profile_fields', 10 );
127
128 /* check to see if the inserted serial number is valid or not; purely for visual needs */
129 add_action('admin_init', 'wppb_check_serial_number');
130 }
131
132 }
133 else if ( !is_admin() ){
134 /* include the stylesheet */
135 add_action('wp_print_styles', 'wppb_add_plugin_stylesheet');
136
137 $wppb_plugin = wppb_plugin_dir . '/';
138
139 /* include the menu file for the profile informations */
140 include_once($wppb_plugin.'front-end/wppb.edit.profile.php');
141 add_shortcode('wppb-edit-profile', 'wppb_front_end_profile_info');
142
143 /*include the menu file for the login screen */
144 include_once($wppb_plugin.'front-end/wppb.login.php');
145 add_shortcode('wppb-login', 'wppb_front_end_login');
146
147 /* include the menu file for the register screen */
148 include_once($wppb_plugin.'front-end/wppb.register.php');
149 add_shortcode('wppb-register', 'wppb_front_end_register');
150
151 /* include the menu file for the recover password screen */
152 include_once($wppb_plugin.'front-end/wppb.recover.password.php');
153 add_shortcode('wppb-recover-password', 'wppb_front_end_password_recovery');
154
155 /* set the front-end admin bar to show/hide */
156 add_filter( 'show_admin_bar' , 'wppb_show_admin_bar');
157
158 /* Shortcodes used for the widget area. Just uncomment whichever you need */
159 add_filter('widget_text', 'do_shortcode', 11);
160
161 /* check to see if the premium functions are present */
162 $wppb_premiumAdmin = wppb_plugin_dir . '/premium/functions/';
163 if (file_exists ( $wppb_premiumAdmin.'premium.functions.load.php' )){
164
165 include_once($wppb_premiumAdmin.'premium.functions.load.php');
166
167 /* filter to set current users custom avatar */
168 add_filter('get_avatar', 'wppb_changeDefaultAvatar', 21, 5);
169
170 /* check if there is a need to resize the current avatar image for all the users*/
171 add_action('init', 'wppb_resize_avatar');
172 }
173
174 $wppb_premiumAddon = wppb_plugin_dir . '/premium/addon/';
175 if (file_exists ( $wppb_premiumAddon.'addon.functions.php' )){
176 //include the file containing the addon functions
177 include_once($wppb_premiumAddon.'addon.functions.php');
178
179 $wppb_addonOptions = get_option('wppb_premium_addon_settings');
180 if ($wppb_addonOptions['userListing'] == 'show'){
181 //add shortcode for the user-listing functionality
182 add_shortcode('wppb-list-users', 'wppb_list_all_users');
183 }
184 }
185 }