• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP mycred_get_user_meta函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中mycred_get_user_meta函数的典型用法代码示例。如果您正苦于以下问题:PHP mycred_get_user_meta函数的具体用法?PHP mycred_get_user_meta怎么用?PHP mycred_get_user_meta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了mycred_get_user_meta函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: do_interest_batch

 /**
  * Do Payout
  * Runs though all user compounded interest and pays.
  * @since 1.2
  * @version 1.2.1
  */
 public function do_interest_batch($batch)
 {
     if (!empty($batch) && is_array($batch)) {
         set_time_limit($this->prefs['run_time']);
         foreach ($batch as $user_id) {
             $user_id = intval($user_id);
             // Get past interest
             $past_interest = mycred_get_user_meta($user_id, $this->core->get_cred_id() . '_comp', '', true);
             if (empty($past_interest) || $past_interest == 0) {
                 continue;
             }
             // Pay / Charge
             $this->core->add_creds('payout', $user_id, $past_interest, $this->prefs['log']);
             // Reset past interest
             mycred_update_user_meta($user_id, $this->core->get_cred_id() . '_comp', '', 0);
         }
     }
 }
开发者ID:nfer,项目名称:mycred,代码行数:24,代码来源:mycred-bank-service-interest.php


示例2: my_history_page

        /**
         * My History Page
         * @since 0.1
         * @version 1.2.1
         */
        public function my_history_page()
        {
            // Security
            if (!is_user_logged_in()) {
                wp_die(__('Access Denied', 'mycred'));
            }
            $settings_key = 'mycred_epp_' . $_GET['page'];
            if (!$this->is_main_type) {
                $settings_key .= '_' . $this->mycred_type;
            }
            $per_page = mycred_get_user_meta($this->current_user_id, $settings_key, '', true);
            if ($per_page == '') {
                $per_page = 10;
            }
            $args = array('user_id' => $this->current_user_id, 'number' => $per_page);
            if (isset($_GET['type']) && !empty($_GET['type'])) {
                $args['ctype'] = $_GET['type'];
            } else {
                $args['ctype'] = $this->mycred_type;
            }
            if (isset($_GET['s']) && !empty($_GET['s'])) {
                $args['s'] = sanitize_text_field($_GET['s']);
            }
            if (isset($_GET['ref']) && !empty($_GET['ref'])) {
                $args['ref'] = sanitize_text_field($_GET['ref']);
            }
            if (isset($_GET['show']) && !empty($_GET['show'])) {
                $args['time'] = absint($_GET['show']);
            }
            if (isset($_GET['order']) && !empty($_GET['order'])) {
                $args['order'] = sanitize_text_field($_GET['order']);
            }
            if (isset($_GET['start']) && isset($_GET['end'])) {
                $args['amount'] = array('start' => sanitize_text_field($_GET['start']), 'end' => sanitize_text_field($_GET['end']));
            } elseif (isset($_GET['num']) && isset($_GET['compare'])) {
                $args['amount'] = array('num' => sanitize_text_field($_GET['num']), 'compare' => $_GET['compare']);
            } elseif (isset($_GET['amount'])) {
                $args['amount'] = sanitize_text_field($_GET['amount']);
            }
            if (isset($_GET['paged']) && !empty($_GET['paged'])) {
                $args['paged'] = absint($_GET['paged']);
            }
            $log = new myCRED_Query_Log($args);
            unset($log->headers['column-username']);
            ?>
<div class="wrap" id="myCRED-wrap">
	<h2><?php 
            $this->page_title(sprintf(__('My %s History', 'mycred'), $this->core->plural()));
            ?>
</h2>

	<?php 
            $log->filter_dates(admin_url('users.php?page=' . $_GET['page']));
            ?>

	<?php 
            do_action('mycred_top_my_log_page', $this);
            ?>

	<?php 
            $log->exporter(__('Export', 'mycred'), true);
            ?>

	<form method="get" action="" name="mycred-mylog-form" novalidate>
<?php 
            if (isset($_GET['s']) && !empty($_GET['s'])) {
                echo '<input type="hidden" name="s" value="' . $_GET['s'] . '" />';
            }
            if (isset($_GET['ref']) && !empty($_GET['ref'])) {
                echo '<input type="hidden" name="ref" value="' . $_GET['ref'] . '" />';
            }
            if (isset($_GET['show']) && !empty($_GET['show'])) {
                echo '<input type="hidden" name="show" value="' . $_GET['show'] . '" />';
            }
            if (isset($_GET['order']) && !empty($_GET['order'])) {
                echo '<input type="hidden" name="order" value="' . $_GET['order'] . '" />';
            }
            if (isset($_GET['paged']) && !empty($_GET['paged'])) {
                echo '<input type="hidden" name="paged" value="' . $_GET['paged'] . '" />';
            }
            $log->search();
            ?>
		<input type="hidden" name="page" value="<?php 
            echo $_GET['page'];
            ?>
" />

		<?php 
            do_action('mycred_above_my_log_table', $this);
            ?>

		<div class="tablenav top">

			<?php 
            $log->table_nav('top', true);
//.........这里部分代码省略.........
开发者ID:kfwebdev,项目名称:wp-atd,代码行数:101,代码来源:mycred-module-log.php


示例3: accept_invite

 /**
  * Accepting Invites
  * @since 0.1
  * @version 1.2
  */
 public function accept_invite($invited_user_id, $inviters = array())
 {
     if (empty($inviters)) {
         return;
     }
     // Invite Anyone will pass on an array of user IDs of those who have invited this user which we need to loop though
     foreach ((array) $inviters as $inviter_id) {
         // Limit Check
         if ($this->prefs['accept_invite']['limit'] != 0) {
             $key = 'mycred_invite_anyone';
             if (!$this->is_main_type) {
                 $key .= '_' . $this->mycred_type;
             }
             $user_log = mycred_get_user_meta($inviter_id, $key, '', true);
             if (empty($user_log['accepted'])) {
                 $user_log['accepted'] = 0;
             }
             // Continue to next inviter if limit is reached
             if ($user_log['accepted'] >= $this->prefs['accept_invite']['limit']) {
                 continue;
             }
         }
         // Award Points
         $run = true;
         if (function_exists('buddypress') && apply_filters('bp_core_signup_send_activation_key', true)) {
             $run = false;
             // Get pending list
             $pending = get_transient('mycred-pending-bp-signups');
             if ($pending === false) {
                 $pending = array();
             }
             // Add to pending list if not there already
             if (!isset($pending[$invited_user_id])) {
                 $pending[$invited_user_id] = $inviter_id;
                 delete_transient('mycred-pending-bp-signups');
                 set_transient('mycred-pending-bp-signups', $pending, 7 * DAY_IN_SECONDS);
             }
         }
         if ($run) {
             $this->core->add_creds('accepting_an_invite', $inviter_id, $this->prefs['accept_invite']['creds'], $this->prefs['accept_invite']['log'], $invited_user_id, array('ref_type' => 'user'), $this->mycred_type);
         }
         // Update Limit
         if ($this->prefs['accept_invite']['limit'] != 0) {
             $user_log['accepted'] = $user_log['accepted'] + 1;
             mycred_update_user_meta($inviter_id, $key, '', $user_log);
         }
     }
 }
开发者ID:nfer,项目名称:mycred,代码行数:53,代码来源:mycred-hook-invite-anyone.php


示例4: purchase_log_page

        /**
         * Custom Log Page
         * @since 1.4
         * @version 1.3.1
         */
        public function purchase_log_page()
        {
            $type = substr($_GET['page'], 25);
            if ($type == 'mycred_default') {
                $mycred = $this->core;
            } else {
                $mycred = mycred($type);
            }
            // Security
            if (!$mycred->can_edit_creds()) {
                wp_die(__('Access Denied', 'mycred'));
            }
            $per_page = mycred_get_user_meta(get_current_user_id(), 'mycred_payments_' . $type, '', true);
            if (empty($per_page) || $per_page < 1) {
                $per_page = 10;
            }
            // Get references
            $references = apply_filters('mycred_buycred_log_refs', array('buy_creds_with_paypal_standard', 'buy_creds_with_skrill', 'buy_creds_with_zombaio', 'buy_creds_with_netbilling', 'buy_creds_with_bitpay'), $this, $type);
            // Prep
            $args = array('number' => $per_page, 'ctype' => $type, 'ref' => implode(',', $references));
            if (isset($_GET['user_id']) && !empty($_GET['user_id'])) {
                $args['user_id'] = $_GET['user_id'];
            }
            if (isset($_GET['s']) && !empty($_GET['s'])) {
                $args['s'] = $_GET['s'];
            }
            if (isset($_GET['ref']) && !empty($_GET['ref'])) {
                $args['ref'] = $_GET['ref'];
            }
            if (isset($_GET['show']) && !empty($_GET['show'])) {
                $args['time'] = $_GET['show'];
            }
            if (isset($_GET['order']) && !empty($_GET['order'])) {
                $args['order'] = $_GET['order'];
            }
            if (isset($_GET['paged']) && !empty($_GET['paged'])) {
                $args['paged'] = $_GET['paged'];
            }
            if (isset($_GET['start']) && isset($_GET['end'])) {
                $args['amount'] = array('start' => $_GET['start'], 'end' => $_GET['end']);
            } elseif (isset($_GET['num']) && isset($_GET['compare'])) {
                $args['amount'] = array('num' => $_GET['num'], 'compare' => $_GET['compare']);
            } elseif (isset($_GET['amount'])) {
                $args['amount'] = $_GET['amount'];
            }
            $log = new myCRED_Query_Log($args);
            $log->headers = apply_filters('mycred_buycred_log_columns', array('column-gateway' => __('Gateway', 'mycred'), 'column-username' => __('Buyer', 'mycred'), 'column-date' => __('Date', 'mycred'), 'column-amount' => $mycred->plural(), 'column-payed' => __('Payed', 'mycred'), 'column-tranid' => __('Transaction ID', 'mycred')));
            $filter_url = admin_url('admin.php?page=myCRED_page_gateways_log_' . $type);
            ?>
<div class="wrap list" id="myCRED-wrap">
	<h2><?php 
            _e('<strong>buy</strong>CRED Purchase Log', 'mycred');
            ?>
 <a href="<?php 
            echo admin_url('admin.php?page=myCRED_page_gateways');
            ?>
" class="click-to-toggle add-new-h2"><?php 
            _e('Gateway Settings', 'mycred');
            ?>
</a> <a href="<?php 
            echo $this->get_settings_url('buycred_module');
            ?>
" class="click-to-toggle add-new-h2"><?php 
            _e('buyCRED Settings', 'mycred');
            ?>
</a></h2>
	<?php 
            $log->filter_dates(esc_url($filter_url));
            ?>

	<div class="clear"></div>
	<form method="get" action="">
<?php 
            if (isset($_GET['user_id']) && !empty($_GET['user_id'])) {
                echo '<input type="hidden" name="user_id" value="' . esc_attr($_GET['user_id']) . '" />';
            }
            if (isset($_GET['s']) && !empty($_GET['s'])) {
                echo '<input type="hidden" name="s" value="' . esc_attr($_GET['s']) . '" />';
            }
            if (isset($_GET['ref']) && !empty($_GET['ref'])) {
                echo '<input type="hidden" name="ref" value="' . esc_attr($_GET['ref']) . '" />';
            }
            if (isset($_GET['show']) && !empty($_GET['show'])) {
                echo '<input type="hidden" name="show" value="' . esc_attr($_GET['show']) . '" />';
            }
            if (isset($_GET['order']) && !empty($_GET['order'])) {
                echo '<input type="hidden" name="order" value="' . esc_attr($_GET['order']) . '" />';
            }
            if (isset($_GET['paged']) && !empty($_GET['paged'])) {
                echo '<input type="hidden" name="paged" value="' . esc_attr($_GET['paged']) . '" />';
            }
            $log->search();
            ?>

		<input type="hidden" name="page" value="<?php 
//.........这里部分代码省略.........
开发者ID:sebastianringel,项目名称:stammtisch,代码行数:101,代码来源:myCRED-addon-buy-creds.php


示例5: render_subscription_shortcode

        /**
         * Subscription Shortcode
         * @since 1.4.6
         * @version 1.0
         */
        public function render_subscription_shortcode($attr, $content = NULL)
        {
            extract(shortcode_atts(array('success' => __('Settings saved.', 'mycred')), $attr));
            if (!is_user_logged_in()) {
                return $content;
            }
            $user_id = get_current_user_id();
            $unsubscriptions = mycred_get_user_meta($user_id, 'mycred_email_unsubscriptions', '', true);
            if ($unsubscriptions == '') {
                $unsubscriptions = array();
            }
            // Save
            $saved = false;
            if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'mycred-unsubscribe' && wp_verify_nonce($_REQUEST['token'], 'update-mycred-email-subscriptions')) {
                if (isset($_POST['mycred_email_unsubscribe']) && !empty($_POST['mycred_email_unsubscribe'])) {
                    $new_selection = $_POST['mycred_email_unsubscribe'];
                } else {
                    $new_selection = array();
                }
                mycred_update_user_meta($user_id, 'mycred_email_unsubscriptions', '', $new_selection);
                $unsubscriptions = $new_selection;
                $saved = true;
            }
            global $wpdb;
            $email_notices = $wpdb->get_results($wpdb->prepare("\n\t\t\t\tSELECT * \n\t\t\t\tFROM {$wpdb->posts} notices\n\n\t\t\t\tLEFT JOIN {$wpdb->postmeta} prefs \n\t\t\t\t\tON ( notices.ID = prefs.post_id AND prefs.meta_key = 'mycred_email_settings' )\n\n\t\t\t\tWHERE notices.post_type = 'mycred_email_notice' \n\t\t\t\t\tAND notices.post_status = 'publish'\n\t\t\t\t\tAND ( prefs.meta_value LIKE %s OR prefs.meta_value LIKE %s );", '%s:9:"recipient";s:4:"user";%', '%s:9:"recipient";s:4:"both";%'));
            ob_start();
            if ($saved) {
                echo '<p class="updated-email-subscriptions">' . $success . '</p>';
            }
            $url = add_query_arg(array('do' => 'mycred-unsubscribe', 'user' => get_current_user_id(), 'token' => wp_create_nonce('update-mycred-email-subscriptions')));
            ?>
<form action="<?php 
            echo esc_url($url);
            ?>
" id="mycred-email-subscriptions" method="post">
	<table class="table">
		<thead>
			<tr>
				<th class="check"><?php 
            _e('Unsubscribe', 'mycred');
            ?>
</th>
				<th class="notice-title"><?php 
            _e('Email Notice', 'mycred');
            ?>
</th>
			</tr>
		</thead>
		<tbody>

		<?php 
            if (!empty($email_notices)) {
                ?>
		
			<?php 
                foreach ($email_notices as $notice) {
                    $settings = $this->get_email_settings($notice->ID);
                    ?>

			<?php 
                    if ($settings['label'] == '') {
                        continue;
                    }
                    ?>

			<tr>
				<td class="check"><input type="checkbox" name="mycred_email_unsubscribe[]"<?php 
                    if (in_array($notice->ID, $unsubscriptions)) {
                        echo ' checked="checked"';
                    }
                    ?>
 value="<?php 
                    echo $notice->ID;
                    ?>
" /></td>
				<td class="notice-title"><?php 
                    echo $settings['label'];
                    ?>
</td>
			</tr>

			<?php 
                }
                ?>
		
		<?php 
            } else {
                ?>

			<tr>
				<td colspan="2"><?php 
                _e('There are no email notifications yet.', 'mycred');
                ?>
</td>
			</tr>
//.........这里部分代码省略.........
开发者ID:kfwebdev,项目名称:wp-atd,代码行数:101,代码来源:myCRED-addon-email-notices.php


示例6: get_users_limit

 /**
  * Get Users Limit
  * @since 1.4
  * @version 1.0
  */
 public function get_users_limit($user_id, $limit)
 {
     $key = 'mycred_bbp_limits_' . $limit;
     if (!$this->is_main_type) {
         $key .= '_' . $this->mycred_type;
     }
     return (array) mycred_get_user_meta($user_id, $key, '', true);
 }
开发者ID:nfer,项目名称:mycred,代码行数:13,代码来源:mycred-hook-bbPress.php


示例7: mycred_user_got_promoted

 function mycred_user_got_promoted($user_id = NULL, $rank_id = NULL)
 {
     $type = get_post_meta($rank_id, 'ctype', true);
     if ($type == '') {
         $type = 'mycred_default';
         update_post_meta($rank_id, 'ctype', $type);
     }
     $end = '';
     if ($type != 'mycred_default') {
         $end = $type;
     }
     $current_rank_id = mycred_get_user_meta($user_id, 'mycred_rank', $end, true);
     // No promotion
     if ($current_rank_id == $rank_id) {
         return false;
     }
     // User did not have a rank before but will have now, that is assumed to be a promotion
     if (empty($current_rank_id) && !empty($rank_id)) {
         return true;
     }
     // Get minimums
     if (!mycred_override_settings()) {
         $current_min = get_post_meta($current_rank_id, 'mycred_rank_min', true);
         $new_min = get_post_meta($rank_id, 'mycred_rank_min', true);
     } else {
         $original_blog_id = get_current_blog_id();
         switch_to_blog(1);
         $current_min = get_post_meta($current_rank_id, 'mycred_rank_min', true);
         $new_min = get_post_meta($rank_id, 'mycred_rank_min', true);
         switch_to_blog($original_blog_id);
     }
     // Compare
     if ($new_min > $current_min) {
         return true;
     }
     return false;
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:37,代码来源:mycred-rank-functions.php


示例8: mycred_check_if_user_gets_badge

 function mycred_check_if_user_gets_badge($user_id = NULL, $request = array(), $badge_ids = array())
 {
     if ($user_id === NULL || empty($badge_ids)) {
         return;
     }
     global $wpdb;
     foreach ($badge_ids as $badge_id) {
         // See if user already has badge
         if (mycred_get_user_meta($user_id, 'mycred_badge' . $badge_id, '', true) != '') {
             continue;
         }
         $requirements = mycred_get_badge_requirements($badge_id);
         $needs = $requirements[0];
         $mycred = mycred($needs['type']);
         $mycred_log = $mycred->log_table;
         if ($needs['by'] == 'count') {
             $select = 'COUNT( * )';
             $amount = $needs['amount'];
         } else {
             $select = 'SUM( creds )';
             $amount = $mycred->number($needs['amount']);
         }
         $result = $wpdb->get_var($wpdb->prepare("\n\t\t\tSELECT {$select} \n\t\t\tFROM {$mycred_log} \n\t\t\tWHERE user_id = %d \n\t\t\t\tAND ctype = %s \n\t\t\t\tAND ref = %s;", $user_id, $needs['type'], $needs['reference']));
         // If this function is used by the mycred_add filter, we need to take into
         // account the instance that we are currently being hooked into as the log entry
         // will be added after this code has executed.
         // In case we sum up, add the points the user will gain to the result
         if (!isset($request['done']) && $needs['by'] == 'sum') {
             $result = $result + $request['amount'];
         } elseif (!isset($request['done']) && $needs['by'] == 'count') {
             $result = $result + 1;
         }
         if ($needs['by'] != 'count') {
             $result = $mycred->number($result);
         }
         // Got it!
         if ($result >= $amount) {
             mycred_update_user_meta($user_id, 'mycred_badge' . $badge_id, '', apply_filters('mycred_badge_user_value', 1, $user_id, $badge_id));
         }
     }
 }
开发者ID:rafasashi,项目名称:mycred,代码行数:41,代码来源:mycred-badge-functions.php


示例9: get_cost

 /**
  * Get Cost
  * @since 1.3.2
  * @version 1.1
  */
 function get_cost($amount = 0, $type = 'mycred_default', $raw = false)
 {
     // Apply minimum
     if ($amount < $this->core->buy_creds['minimum']) {
         $amount = $this->core->buy_creds['minimum'];
     }
     // Calculate cost here so we can use any exchange rate
     if (isset($this->prefs['exchange'][$type])) {
         // Check for user override
         $override = mycred_get_user_meta($this->current_user_id, 'mycred_buycred_rates_' . $type, '', true);
         if (isset($override[$this->id]) && $override[$this->id] != '') {
             $rate = $override[$this->id];
         } else {
             $rate = $this->prefs['exchange'][$type];
         }
         if (isfloat($rate)) {
             $rate = (double) $rate;
         } else {
             $rate = (int) $rate;
         }
         $mycred = mycred($type);
         $cost = $mycred->number($amount) * $rate;
     } else {
         $cost = $amount;
     }
     // Return a properly formated cost so PayPal is happy
     if (!$raw) {
         $cost = number_format($cost, 2, '.', '');
     }
     return apply_filters('mycred_buycred_get_cost', $cost, $amount, $type, $this->prefs, $this->core->buy_creds);
 }
开发者ID:sebastianringel,项目名称:stammtisch,代码行数:36,代码来源:mycred-abstract-payment-gateway.php


示例10: make_purchase_ajax

 /**
  * Make Purchase AJAX
  * @since 1.1
  * @version 1.3
  */
 public function make_purchase_ajax()
 {
     // We must be logged in
     if (!is_user_logged_in()) {
         die;
     }
     // Security
     check_ajax_referer('mycred-buy-content-ajax', 'token');
     // Prep
     $post_id = $_POST['postid'];
     $user_id = get_current_user_id();
     $action = 'buy-content-ajax';
     $sell_content = $this->sell_content;
     $prefs = $this->get_sale_prefs($post_id);
     if (!$this->user_paid($user_id, $post_id) && $this->user_can_buy($user_id, $prefs['price'])) {
         $post = get_post($post_id);
         // Charge
         $this->core->add_creds('buy_content', $user_id, 0 - $prefs['price'], $sell_content['logs']['buy'], $post_id, array('ref_type' => 'post', 'purchase_id' => 'TXID' . date_i18n('U'), 'seller' => $post->post_author), $this->mycred_type);
         $request = compact('action', 'post_id', 'user_id', 'author', 'post_type', 'sell_content', 'prefs');
         do_action('mycred_sell_content_purchase_ready', $request);
         // Pay
         if ($sell_content['pay'] == 'author') {
             // Check if author has a custom share
             $users_share = mycred_get_user_meta($post->post_author, 'mycred_sell_content_share_' . $this->mycred_type, '', true);
             if ($users_share == '') {
                 $users_share = $sell_content['pay_percent'];
             }
             if (isfloat($users_share)) {
                 $users_share = (double) $users_share;
             } else {
                 $users_share = (int) $users_share;
             }
             $payout = $users_share / 100 * $prefs['price'];
             $this->core->add_creds('buy_content', $post->post_author, $payout, $sell_content['logs']['sell'], $post_id, array('ref_type' => 'post', 'purchase_id' => 'TXID' . date_i18n('U'), 'buyer' => $user_id), $this->mycred_type);
         }
         // $match[1] = start tag, $match[2] = settings, $match[3] = content, $match[4] = end tag
         preg_match("'(\\[mycred_sell_this_ajax(.{1,})\\])(.*?)(\\[\\/mycred_sell_this_ajax\\])'si", $post->post_content, $match);
         // Filter content before returning
         $content = apply_filters('the_content', $match[3]);
         $content = str_replace(']]>', ']]&gt;', $content);
         $content = do_shortcode($content);
     } else {
         $content = '<p>' . __('You can not buy this content.', 'mycred') . '</p>';
     }
     die($content);
 }
开发者ID:suifengtec,项目名称:mycred,代码行数:51,代码来源:myCRED-addon-sell-content.php


示例11: mycred_get_users_transfer_history

 function mycred_get_users_transfer_history($user_id, $type = 'mycred_default', $key = NULL)
 {
     if ($key === NULL) {
         $key = 'mycred_transactions';
     }
     if ($type != 'mycred_default' && $type != '') {
         $key .= '_' . $type;
     }
     $default = array('frame' => '', 'amount' => 0);
     return mycred_apply_defaults($default, mycred_get_user_meta($user_id, $key, '', true));
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:11,代码来源:mycred-transfer-functions.php


示例12: user_override

        /**
         * User Override
         * @since 1.5.2
         * @version 1.0
         */
        function user_override($user = NULL, $type = 'mycred_default')
        {
            $users_rate = mycred_get_user_meta($user->ID, 'mycred_banking_rate_' . $type);
            $excluded = $this->exclude_user($user->ID);
            ?>

<h3><?php 
            _e('Compound Interest', 'mycred');
            ?>
</h3>

<?php 
            if ($excluded == 'list') {
                ?>

<table class="form-table">
	<tr>
		<td colspan="2"><?php 
                _e('This user is excluded from receiving interest on this balance.', 'mycred');
                ?>
</td>
	</tr>
	<tr>
		<td colspan="2"><?php 
                submit_button(__('Remove from Excluded List', 'mycred'), 'primary medium', 'mycred_include_users_interest_rate', false);
                ?>
</td>
	</tr>
</table>

<?php 
            } elseif ($excluded == 'role') {
                ?>

<table class="form-table">
	<tr>
		<td colspan="2"><?php 
                _e('This user role is excluded from receiving interest on this balance.', 'mycred');
                ?>
</td>
	</tr>
</table>

<?php 
            } else {
                ?>

<table class="form-table">
	<tr>
		<th scope="row"><?php 
                _e('Interest Rate', 'mycred');
                ?>
</th>
		<td>
			<input type="text" name="mycred_adjust_users_interest_rate" id="mycred-adjust-users-interest-rate" value="<?php 
                echo $users_rate;
                ?>
" placeholder="<?php 
                echo $this->prefs['rate']['amount'];
                ?>
" size="8" /> %<br />
			<span class="description"><?php 
                _e('Leave empty to use the default value.', 'mycred');
                ?>
</span>
		</td>
	</tr>
	<tr>
		<th scope="row"></th>
		<td>
			<?php 
                submit_button(__('Save Interest Rate', 'mycred'), 'primary medium', 'mycred_adjust_users_interest_rate_run', false);
                ?>
 
			<?php 
                submit_button(__('Exclude from receiving interest', 'mycred'), 'primary medium', 'mycred_exclude_users_interest_rate', false);
                ?>
		</td>
	</tr>
</table>
<?php 
            }
        }
开发者ID:suifengtec,项目名称:mycred,代码行数:88,代码来源:mycred-bank-service-interest.php


示例13: import

        /**
         * import function.
         */
        function import($file)
        {
            global $wpdb, $mycred;
            $this->imported = $this->skipped = 0;
            if (!is_file($file)) {
                echo '<p><strong>' . __('Sorry, there has been an error.', 'mycred') . '</strong><br />';
                echo __('The file does not exist, please try again.', 'mycred') . '</p>';
                $this->footer();
                die;
            }
            ini_set('auto_detect_line_endings', '1');
            if (($handle = fopen($file, "r")) !== FALSE) {
                $header = fgetcsv($handle, 0, $this->delimiter);
                $no_of_columns = sizeof($header);
                if ($no_of_columns == 3 || $no_of_columns == 4) {
                    $loop = 0;
                    $mycred_types = mycred_get_types();
                    while (($row = fgetcsv($handle, 0, $this->delimiter)) !== FALSE) {
                        $log_entry = '';
                        if ($no_of_columns == 3) {
                            list($id, $balance, $point_type) = $row;
                        } else {
                            list($id, $balance, $point_type, $log_entry) = $row;
                        }
                        $user = false;
                        if (is_numeric($id)) {
                            $user = get_userdata($id);
                        }
                        if ($user === false) {
                            $user = get_user_by('email', $id);
                        }
                        if ($user === false) {
                            $user = get_user_by('login', $id);
                        }
                        if ($user === false) {
                            $this->skipped++;
                            continue;
                        }
                        if (!isset($mycred_types[$point_type])) {
                            if ($point_type != '') {
                                $log_entry = $point_type;
                            }
                        }
                        if ($point_type == '') {
                            $point_type = 'mycred_default';
                        }
                        $method = trim($_POST['method']);
                        if ($method == 'add') {
                            $current_balance = mycred_get_user_meta($user->ID, $point_type, '', true);
                            $balance = $current_balance + $balance;
                        }
                        mycred_update_user_meta($user->ID, $point_type, '', $balance);
                        if (!empty($log_entry)) {
                            $wpdb->insert($mycred->log_table, array('ref' => 'import', 'ref_id' => NULL, 'user_id' => $user->ID, 'creds' => $mycred->number($balance), 'ctype' => $point_type, 'time' => date_i18n('U'), 'entry' => sanitize_text_field($log_entry), 'data' => ''));
                        }
                        $loop++;
                        $this->imported++;
                    }
                } else {
                    echo '<p><strong>' . __('Sorry, there has been an error.', 'mycred') . '</strong><br />';
                    echo __('The CSV is invalid.', 'mycred') . '</p>';
                    $this->footer();
                    die;
                }
                fclose($handle);
            }
            // Show Result
            echo '<div class="updated settings-error below-h2"><p>
				' . sprintf(__('Import complete - A total of <strong>%d</strong> balances were successfully imported. <strong>%d</strong> was skipped.', 'mycred'), $this->imported, $this->skipped) . '
			</p></div>';
            $this->import_end();
        }
开发者ID:kfwebdev,项目名称:wp-atd,代码行数:75,代码来源:mycred-balances.php


示例14: update_daily_limit

 /**
  * Update Daily Limit
  * Updates a given users daily limit.
  * @since 1.3.3
  * @version 1.1
  */
 public function update_daily_limit($user_id, $id)
 {
     // No limit used
     if ($this->prefs[$id]['limit'] == 0) {
         return;
     }
     $today = date_i18n('Y-m-d');
     $key = 'mycred_simplepress_limits_' . $id;
     if (!$this->is_main_type) {
         $key .= '_' . $this->mycred_type;
     }
     $current = mycred_get_user_meta($user_id, $key, '', true);
     if (empty($current) || !array_key_exists($today, (array) $current)) {
         $current[$today] = 0;
     }
     $current[$today] = $current[$today] + 1;
     mycred_update_user_meta($user_id, $key, '', $current);
 }
开发者ID:nfer,项目名称:mycred,代码行数:24,代码来源:mycred-hook-simplepress.php


示例15: get_users_balance

 /**
  * Get users balance
  * Returns the users balance unformated.
  *
  * @param $user_id (int), required user id
  * @param $type (string), optional cred type to check for
  * @returns zero if user id is not set or if no creds were found, else returns amount
  * @since 0.1
  * @version 1.4
  */
 public function get_users_balance($user_id = NULL, $type = NULL)
 {
     if ($user_id === NULL) {
         return $this->zero();
     }
     $types = mycred_get_types();
     if ($type === NULL || !array_key_exists($type, $types)) {
         $type = $this->get_cred_id();
     }
     $balance = mycred_get_user_meta($user_id, $type, '', true);
     if ($balance == '') {
         $balance = $this->zero();
     }
     // Let others play
     $balance = apply_filters('mycred_get_users_cred', $balance, $this, $user_id, $type);
     return $this->number($balance);
 }
开发者ID:suifengtec,项目名称:mycred,代码行数:27,代码来源:mycred-functions.php


示例16: mycred_check_if_user_gets_badge

 function mycred_check_if_user_gets_badge($user_id = NULL, $badge_ids = array(), $save = true)
 {
     if ($user_id === NULL || empty($badge_ids)) {
         return;
     }
     global $wpdb;
     $ids = array();
     foreach ($badge_ids as $badge_id) {
         $level = false;
         $requirements = mycred_get_badge_requirements($badge_id);
         foreach ($requirements as $req_level => $needs) {
             if ($needs['type'] == '') {
                 $needs['type'] = 'mycred_default';
             }
             $mycred = mycred($needs['type']);
             // Count occurences
             if ($needs['by'] == 'count') {
                 $select = 'COUNT( * )';
                 $amount = absint($needs['amount']);
             } else {
                 $select = 'SUM( creds )';
                 $amount = $mycred->number($needs['amount']);
             }
             $result = $wpdb->get_var(apply_filters('mycred_if_user_gets_badge_sql', $wpdb->prepare("\n\t\t\t\t\tSELECT {$select} \n\t\t\t\t\tFROM {$mycred->log_table} \n\t\t\t\t\tWHERE user_id = %d \n\t\t\t\t\t\tAND ctype = %s \n\t\t\t\t\t\tAND ref = %s;", $user_id, $needs['type'], $needs['reference']), $user_id, $badge_id, $req_level, $needs));
             if ($result === NULL) {
                 $result = 0;
             }
             if ($needs['by'] != 'count') {
                 $result = $mycred->number($result);
             } else {
                 $result = absint($result);
             }
             $level = NULL;
             if ($result >= $amount) {
                 $level = absint($req_level);
             }
             $current = mycred_get_user_meta($user_id, 'mycred_badge' . $badge_id, '', true);
             if ($current == '') {
                 $current = -1;
             }
             // If a level has been reached assign it now unless the user has this level already
             if ($level !== NULL && $current < $level) {
                 if ($save) {
                     mycred_update_user_meta($user_id, 'mycred_badge' . $badge_id, '', apply_filters('mycred_badge_user_value', $level, $user_id, $badge_id));
                 }
                 $ids[$badge_id] = $level;
             }
         }
     }
     return $ids;
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:51,代码来源:mycred-badge-functions.php


示例17: get_ref_id

 /**
  * Get Ref ID
  * Returns a given users referral ID.
  * @since 1.4
  * @version 1.0
  */
 public function get_ref_id($user_id)
 {
     // Link format
     switch ($this->prefs['setup']['links']) {
         case 'username':
             $user = get_userdata($user_id);
             if ($user === false) {
                 $ref_id = 0;
             } else {
                 $ref_id = urlencode($user->user_login);
             }
             break;
         case 'numeric':
             $ref_id = mycred_get_user_meta($user_id, 'mycred_affiliate_link', '', true);
             if (empty($ref_id)) {
                 $counter = absint(get_option('mycred_affiliate_counter', 0));
                 $number = $counter + 1;
                 update_option('mycred_affiliate_counter', $number);
                 mycred_update_user_meta($user_id, 'mycred_affiliate_link', '', $number);
                 $ref_id = $number;
             }
             break;
     }
     return apply_filters('mycred_affiliate_get_ref_id', $ref_id, $user_id, $this);
 }
开发者ID:sebastianringel,项目名称:stammtisch,代码行数:31,代码来源:mycred-module-hooks.php


示例18: mycred_user_got_promoted

 function mycred_user_got_promoted($user_id = NULL, $rank_id = NULL)
 {
     $current_rank_id = mycred_get_user_meta($user_id, 'mycred_rank', '', true);
     if ($current_rank_id == $rank_id) {
         return false;
     }
     if (empty($current_rank_id) && !empty($rank_id)) {
         return true;
     }
     if (!mycred_override_settings()) {
         $current_min = get_post_meta($current_rank_id, 'mycred_rank_min', true);
         $new_min = get_post_meta($rank_id, 'mycred_rank_min', true);
     } else {
         $original_blog_id = get_current_blog_id();
         switch_to_blog(1);
         $current_min = get_post_meta($current_rank_id, 'mycred_rank_min', true);
         $new_min = get_post_meta($rank_id, 'mycred_rank_min', true);
         switch_to_blog($original_blog_id);
     }
     if ($new_min > $current_min) {
         return true;
     }
     return false;
 }
开发者ID:rafasashi,项目名称:mycred,代码行数:24,代码来源:mycred-rank-functions.php



注:本文中的mycred_get_user_meta函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP mycred_label函数代码示例发布时间:2022-05-15
下一篇:
PHP mycred_get_types函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap