Changeset 3035189
- Timestamp:
- 02/13/2024 04:23:41 PM (2 years ago)
- Location:
- eber/trunk
- Files:
-
- 5 edited
-
index.php (modified) (1 diff)
-
init/frontend.php (modified) (5 diffs)
-
init/menu.php (modified) (4 diffs)
-
layout/index.php (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
eber/trunk/index.php
r3033293 r3035189 5 5 Description: Eber is a smart member system comes with comprehensive loyalty & rewards system, marketing and analytic tool. 6 6 Author: Eber 7 Version: 3. 4.17 Version: 3.5 8 8 Author URI: https://eber.co 9 9 License: GPLv2 or later -
eber/trunk/init/frontend.php
r3033290 r3035189 4 4 class Eber_FrontEnd 5 5 { 6 7 8 6 9 public static function get_js() 7 10 { … … 149 152 $user_name = $current_user->first_name . ' ' . $current_user->last_name; 150 153 $digest = md5($user_id.$eber_hash_key); 154 $post_data = ['provider' => 'wordpress', 'provider_identifier' => $eber_hash_key,'hash'=>$digest,'email'=>$user_email,'display_name'=>$user_name,'provider_user_id'=>$user_id,'notify'=>$notify]; 155 $eber_custom_field = get_option('eber_custom_field',false); 156 if($eber_custom_field) 157 { 158 $user_meta = get_user_meta($current_user->ID); 159 $custom_field = get_option('eber_custom_field_data',array()); 160 if(isset($custom_field['phone_number']) && !empty($user_meta[$custom_field['phone_number']])) 161 $post_data['phone'] = $user_meta[$custom_field['phone_number']][0]; 162 if(isset($custom_field['phone_code']) && !empty($user_meta[$custom_field['phone_code']])) 163 $post_data['phone_code'] = $user_meta[$custom_field['phone_code']][0]; 164 if(isset($custom_field['birthday']) && !empty($user_meta[$custom_field['birthday']])) 165 { 166 $birthday = $user_meta[$custom_field['birthday']][0]; 167 $post_data['birth_year'] = substr($birthday,0,4); 168 $post_data['birth_month'] = substr($birthday,4,2); 169 $post_data['birth_day'] = substr($birthday,6,2); 170 } 171 172 } 151 173 // Call API 152 174 require_once(dirname(__FILE__).'/../init/api/API.php'); … … 154 176 $api_key = get_option('eber_api_key',''); 155 177 $api = new API; 156 $result = $api->setData( ['provider' => 'wordpress', 'provider_identifier' => $eber_hash_key,'hash'=>$digest,'email'=>$user_email,'display_name'=>$user_name,'provider_user_id'=>$user_id,'notify'=>$notify])178 $result = $api->setData($post_data) 157 179 ->setQueue() 158 180 ->requireAuth($api_key) … … 203 225 $user_name = $user->data->first_name . ' ' . $user->data->last_name; 204 226 $digest = md5($user_id.$eber_hash_key); 227 $post_data = ['provider' => 'wordpress', 'provider_identifier' => $eber_hash_key,'hash'=>$digest,'email'=>$user_email,'display_name'=>$user_name,'provider_user_id'=>$user_id,'notify'=>$notify]; 228 229 $eber_custom_field = get_option('eber_custom_field',false); 230 if($eber_custom_field) 231 { 232 $user_meta = get_user_meta($user_id); 233 $custom_field = get_option('eber_custom_field_data',array()); 234 if(isset($custom_field['phone_number']) && !empty($user_meta[$custom_field['phone_number']])) 235 $post_data['phone'] = $user_meta[$custom_field['phone_number']][0]; 236 if(isset($custom_field['phone_code']) && !empty($user_meta[$custom_field['phone_code']])) 237 $post_data['phone_code'] = $user_meta[$custom_field['phone_code']][0]; 238 if(isset($custom_field['birthday']) && !empty($user_meta[$custom_field['birthday']])) 239 { 240 $birthday = $user_meta[$custom_field['birthday']][0]; 241 $post_data['birth_year'] = substr($birthday,0,4); 242 $post_data['birth_month'] = substr($birthday,4,2); 243 $post_data['birth_day'] = substr($birthday,6,2); 244 } 245 246 } 205 247 // Call API 206 248 require_once(dirname(__FILE__).'/../init/api/API.php'); … … 208 250 $api_key = get_option('eber_api_key',''); 209 251 $api = new API; 210 $result = $api->setData( ['provider' => 'wordpress', 'provider_identifier' => $eber_hash_key,'hash'=>$digest,'email'=>$user_email,'display_name'=>$user_name,'provider_user_id'=>$user_id,'notify'=>$notify])252 $result = $api->setData($post_data) 211 253 ->setQueue() 212 254 ->requireAuth($api_key) -
eber/trunk/init/menu.php
r3030498 r3035189 17 17 } 18 18 public static function SettingsPage(){ 19 $default_metadata = ['syntax_highlighting','dismissed_wp_pointers','wp_user_level','wp_capabilities','user_pass', 'user_login', 'user_nicename', 'user_url', 'user_email', 'display_name', 'nickname', 'first_name', 'last_name', 'description', 'rich_editing', 'comment_shortcuts', 'admin_color', 'use_ssl', 'user_registered', 'show_admin_bar_front', 'role', 'locale']; 19 20 $success = false; 21 $args = array( 22 'role' => 'subscriber', 23 'orderby' => 'id', 24 'order' => 'ASC' 25 ); 26 $users = get_users( $args ); 27 if(!empty($users)) 28 { 29 $user = $users[0]; 30 $user_metadata = get_user_meta($user->ID); 31 foreach($user_metadata as $key=>$meta) 32 { 33 if(in_array($key,$default_metadata)) 34 unset($user_metadata[$key]); 35 } 36 } 37 else 38 { 39 $user_metadata = array(); 40 } 41 42 20 43 $api_key = get_option('eber_api_key',''); 21 44 $status = get_option('eber_status',false); … … 32 55 $widget_new = get_option('widget_new',false); 33 56 $eber_api_enable = get_option('eber_api_enable',false); 57 $eber_custom_field = get_option('eber_custom_field',false); 58 $custom_field = get_option('eber_custom_field_data',['phone_number'=>0,'birthday'=>0,'phone_code'=>'']); 59 34 60 $sync = get_option('eber_sync',false); 35 61 if($api_key != ''){ … … 49 75 $widget_new = (isset($_POST['widget_new'])); 50 76 $eber_api_enable = (isset($_POST['eber_api_enable'])); 77 $eber_custom_field = (isset($_POST['eber_custom_field'])); 78 $custom_field = $_POST['custom_field']; 79 51 80 if(isset($_POST['eber_custom_login_url'])) 52 81 { … … 190 219 { 191 220 update_option('eber_api_enable',false); 221 } 222 223 if(isset($_POST['eber_custom_field'])) 224 { 225 update_option('eber_custom_field',true); 226 227 } 228 else 229 { 230 update_option('eber_custom_field',false); 231 } 232 if(isset($_POST['custom_field'])) 233 { 234 update_option('eber_custom_field_data',$_POST['custom_field']); 192 235 } 193 236 -
eber/trunk/layout/index.php
r3030498 r3035189 182 182 <?php } 183 183 ?> 184 <tr> 185 <th> 186 187 </th> 188 <td> 189 <fieldset> 190 <legend class="screen-reader-text"><span>Custom Field ?</span></legend><label for="custom_field"> 191 <input name="eber_custom_field" type="checkbox" id="eber_custom_field" value="1" <?php echo ($eber_custom_field)?'checked':'';?>> 192 Custom Field?</label> 193 </fieldset> 194 </td> 195 </tr> 196 <tr class="custom_field" <?php echo (!$eber_custom_field)?'style="display:none;"':''; ?> > 197 <th scope="row"><label for="user_phone_number">Custom Field Phone Code</label></th> 198 <td><select name="custom_field[phone_code]" > 199 <option value="">No Select</option> 200 <?php 201 foreach($user_metadata as $key=>$meta) 202 {?> 203 <option value="<?php echo $key;?>" <?php echo ($custom_field['phone_code'] == $key)?'selected':''; ?> ><?php echo $key.' ( Example : '.$meta[0].' )' ;?></option> 204 <?php } 205 ?> 206 </select> 207 </td> 208 </tr> 209 <tr class="custom_field" <?php echo (!$eber_custom_field)?'style="display:none;"':''; ?> > 210 <th scope="row"><label for="user_phone_number">Custom Field Phone Number</label></th> 211 <td><select name="custom_field[phone_number]" > 212 <option value="">No Select</option> 213 <?php 214 foreach($user_metadata as $key=>$meta) 215 {?> 216 <option value="<?php echo $key;?>" <?php echo ($custom_field['phone_number'] == $key)?'selected':''; ?> ><?php echo $key.' ( Example : '.$meta[0].' )' ;?></option> 217 <?php } 218 ?> 219 </select> 220 </td> 221 </tr> 222 <tr class="custom_field" <?php echo (!$eber_custom_field)?'style="display:none;"':''; ?> > 223 <th scope="row"><label for="user_phone_number">Custom Field Birthday</label></th> 224 <td><select name="custom_field[birthday]" > 225 <option value="">No Select</option> 226 <?php 227 foreach($user_metadata as $key=>$meta) 228 {?> 229 <option value="<?php echo $key;?>" <?php echo ($custom_field['birthday'] == $key)?'selected':''; ?> ><?php echo $key.' ( Example : '.$meta[0].' )' ;?></option> 230 <?php } 231 ?> 232 </select> 233 </td> 234 </tr> 184 235 </tbody> 185 236 </table> … … 216 267 }); 217 268 }); 269 270 function showHideCustomField(){ 271 jQuery("input[name='eber_custom_field']").click(function(){ 272 if(jQuery("input[name='eber_custom_field']").is(':checked')) 273 { 274 jQuery(".custom_field").show(); 275 } 276 else 277 { 278 jQuery(".custom_field").hide(); 279 } 280 }); 281 } 282 showHideCustomField(); 218 283 219 284 </script> -
eber/trunk/readme.txt
r3030498 r3035189 96 96 = 3.4 = 97 97 API enable settings 98 = 3.5 = 99 Custom field for User Syncing 98 100 99 101
Note: See TracChangeset
for help on using the changeset viewer.