Plugin Directory

Changeset 3035189


Ignore:
Timestamp:
02/13/2024 04:23:41 PM (2 years ago)
Author:
eberwp
Message:

update version 3.5

Location:
eber/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • eber/trunk/index.php

    r3033293 r3035189  
    55Description: Eber is a smart member system comes with comprehensive loyalty & rewards system, marketing and analytic tool.
    66Author: Eber
    7 Version: 3.4.1
     7Version: 3.5
    88Author URI: https://eber.co
    99License: GPLv2 or later
  • eber/trunk/init/frontend.php

    r3033290 r3035189  
    44class Eber_FrontEnd
    55{
     6
     7 
     8
    69    public static function get_js()
    710    {
     
    149152                $user_name = $current_user->first_name . ' ' . $current_user->last_name;
    150153            $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            }
    151173            // Call API
    152174            require_once(dirname(__FILE__).'/../init/api/API.php');
     
    154176            $api_key = get_option('eber_api_key','');
    155177            $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)
    157179                ->setQueue()
    158180                ->requireAuth($api_key)
     
    203225                $user_name = $user->data->first_name . ' ' . $user->data->last_name;
    204226            $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            }
    205247            // Call API
    206248            require_once(dirname(__FILE__).'/../init/api/API.php');
     
    208250            $api_key = get_option('eber_api_key','');
    209251            $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)
    211253                ->setQueue()
    212254                ->requireAuth($api_key)
  • eber/trunk/init/menu.php

    r3030498 r3035189  
    1717        }
    1818        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'];
    1920            $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
    2043            $api_key = get_option('eber_api_key','');
    2144            $status = get_option('eber_status',false);
     
    3255            $widget_new = get_option('widget_new',false);
    3356            $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
    3460            $sync = get_option('eber_sync',false);
    3561            if($api_key != ''){
     
    4975                $widget_new = (isset($_POST['widget_new']));
    5076                $eber_api_enable = (isset($_POST['eber_api_enable']));
     77                $eber_custom_field = (isset($_POST['eber_custom_field']));
     78                $custom_field = $_POST['custom_field'];
     79               
    5180                if(isset($_POST['eber_custom_login_url']))
    5281                {
     
    190219                                {
    191220                                    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']);
    192235                                }
    193236
  • eber/trunk/layout/index.php

    r3030498 r3035189  
    182182<?php }
    183183?>
     184    <tr>
     185        <th>
     186            &nbsp;
     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>
    184235    </tbody>
    185236</table>
     
    216267       });
    217268    });
     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();
    218283   
    219284</script>
  • eber/trunk/readme.txt

    r3030498 r3035189  
    9696= 3.4 =
    9797API enable settings
     98= 3.5 =
     99Custom field for User Syncing
    98100
    99101
Note: See TracChangeset for help on using the changeset viewer.