?> </b></text></h5> <div class="progress"> <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="<?php echo get_progress(); ?> " aria-valuemin="0" aria-valuemax="100" style="width: <?php echo get_progress(); ?> %"><span class="sr-only"><?php echo get_progress(); ?> % Complete (success)</span></div> </div> <h5 class=""><b><?php echo get_next_unlock() - get_user_info('loyalty_points'); ?> LP</b> to reach the next level. </h5> <br> <h5>Earning loyalty points is easy! Just keep shopping in our store and inviting your friends to join!</h5> </div> </div> </div> </div> <!-- /points --> <!-- email --> <div class="row"> <div class="col-sm-12"> <div class="panel panel-default"> <div class="panel-heading"><h3>My Referrals</h3></div>
function add_loyalty_points($user_id, $add_points) { $point_balance = get_user_meta($user_id, 'loyalty_points', true) + $add_points; $next_unlock = get_next_unlock($user_id); update_user_meta($user_id, 'loyalty_points', $point_balance); if ($point_balance >= $next_unlock) { global $unlock_points; do { $new_status = array_search($next_unlock, $unlock_points); $next_unlock = get_next_unlock($null, $new_status); } while ($point_balance >= $next_unlock && $new_status != 'Platinum'); update_user_meta($user_id, 'loyalty_status', $new_status); update_user_meta($user_id, 'loyalty_date', date('Y-m-d', strtotime("+30 days"))); } }
function update_user_status() { $points = get_user_info('loyalty_points'); $unlock = get_next_unlock(); if ($points >= $unlock) { global $unlock_points; $new_status = array_search($unlock, $unlock_points); $user_id = get_current_user_id(); update_user_meta($user_id, 'loyalty_status', $new_status); } }