PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 1.1.21
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v1.1.21
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 2.0.7 2.0.8 All 339 releases
profile-builder / classes / class.admin.php

class.admin.php in User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor 1.1.21, at classes/class.admin.php

175 lines 4.7 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 * Profile Builder Admin
11 *
12 */
13
14 class PB_Admin{
15 private $version = NULL;
16
17 function __construct(){
18 $this->version = ProfileBuilderVersion;
19 }
20
21 /**
22 * Initiate Plugin & setup main options
23 *
24 * @uses get_option()
25 * @uses add_option()
26 * @uses profile_builder_activate()
27 * @uses wp_redirect()
28 * @uses admin_url()
29 *
30 * @access public
31 *
32 *
33 * @return bool
34 */
35 function profile_builder_initialize(){
36 // check for activation
37 $check = get_option( 'profile_builder_activation' );
38
39 // redirect on activation
40 if ($check != "set") {
41 // add theme options
42 add_option( 'profile_builder_activation', 'set');
43
44 // load DB activation function if updating plugin
45 $this->profile_builder_activate();
46
47 // Redirect
48 wp_redirect( admin_url().'users.php?page=ProfileBuilderOptionsAndSettings' );
49 }
50 return false;
51 }
52
53
54 /**
55 * Plugin Activation
56 *
57 *
58 *
59 * @return void
60 */
61 function profile_builder_activate(){
62 global $wp_roles;
63
64 // check for installed version
65 $installed_ver = get_option( 'profile_builder_version' );
66
67 // New Version Update
68 if ( $installed_ver != $this->version ){
69 update_option( 'profile_builder_version', $this->version );
70 }
71 else if ( !$installed_ver ) {
72 add_option( 'profile_builder_version', $this->version );
73 }
74
75
76 $wppb_default_settings = array(
77 'username' => 'show',
78 'usernameRequired' => 'no',
79 'firstname' => 'show',
80 'firstnameRequired' => 'no',
81 'lastname' => 'show',
82 'lastnameRequired' => 'no',
83 'nickname' => 'show',
84 'nicknameRequired' => 'no',
85 'dispname' => 'show',
86 'dispnameRequired' => 'no',
87 'email' => 'show',
88 'emailRequired' => 'no',
89 'website' => 'show',
90 'websiteRequired' => 'no',
91 'aim' => 'show',
92 'aimRequired' => 'no',
93 'yahoo' => 'show',
94 'yahooRequired' => 'no',
95 'jabber' => 'show',
96 'jabberRequired' => 'no',
97 'bio' => 'show',
98 'bioRequired' => 'no',
99 'password' => 'show',
100 'passwordRequired' => 'no'
101 );
102 add_option( 'wppb_default_settings', $wppb_default_settings ); //set all fields visible on first activation of the plugin
103 add_option( 'wppb_default_style', 'yes');
104 $all_roles = $wp_roles->roles;
105 $editable_roles = apply_filters('editable_roles', $all_roles);
106
107 $admintSettingsPresent = get_option('wppb_display_admin_settings','not_found');
108
109 if ($admintSettingsPresent == 'not_found'){ // if the field doesn't exists, then create it
110 $rolesArray = array();
111 foreach ( $editable_roles as $key => $data )
112 $rolesArray = array( $key => 'show' ) + $rolesArray;
113 $rolesArray = array_reverse($rolesArray,true);
114 add_option( 'wppb_display_admin_settings', $rolesArray);
115 }
116
117 }
118
119 /**
120 * Plugin Deactivation delete options
121 *
122 * @uses delete_option()
123 *
124 * @access public
125 *
126 *
127 * @return void
128 */
129 function profile_builder_deactivate() {
130 // remove activation check & version
131 delete_option( 'profile_builder_activation' );
132 delete_option( 'profile_builder_version' );
133 }
134
135 /**
136 * Add Admin Menu Items & Test Actions
137 *
138 *
139 * @return void
140 */
141 function profile_builder_admin(){
142 // create menu item
143 $profile_builder_options = add_submenu_page( 'users.php', 'Profile Builder', 'Profile Builder', 'delete_users', 'ProfileBuilderOptionsAndSettings', array( $this, 'profile_builder_options_page' ) );
144
145 // add menu item
146 add_action( "admin_print_styles-$profile_builder_options", array( $this, 'profile_builder_load' ) );
147 }
148
149 /**
150 * Load Scripts & Styles
151 *
152 * @uses wp_enqueue_style()
153 *
154 *
155 * @return void
156 */
157 function profile_builder_load(){
158 // enqueue styles
159 wp_enqueue_style( 'profile-builder-style', WPPB_PLUGIN_URL.'/assets/css/style.css', false, $this->version, 'screen');
160
161 // enqueue scripts
162 add_thickbox();
163 wp_enqueue_script( 'jquery-extra-profile-fields', WPPB_PLUGIN_URL.'/assets/js/jquery.extra.fields.js', array('jquery','media-upload','thickbox','jquery-ui-core','jquery-ui-tabs', 'jquery-ui-sortable'), $this->version );
164
165 // remove GD star rating conflicts
166 wp_deregister_style( 'gdsr-jquery-ui-core' );
167 wp_deregister_style( 'gdsr-jquery-ui-theme' );
168 }
169
170 function profile_builder_options_page() {
171 // Grab Options Page
172 include( WPPB_PLUGIN_DIR.'/front-end/options.php' );
173 }
174
175 }