当前位置: 首页>>代码示例>>PHP>>正文


PHP get_usermeta函数代码示例

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


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

示例1: SOF_set_comment_karma

function SOF_set_comment_karma()
{
    global $wpdb, $current_user;
    if (!$_POST || !isset($_POST["commentID"]) || empty($_POST["commentID"])) {
        return;
    }
    $comment_id = $_POST["commentID"];
    // Cogemos datos del usuario
    get_currentuserinfo();
    $user_ID = $current_user->ID;
    if ($user_ID == 0 && get_option('SOF_register') == 'true') {
        die("Debes registrarte para poder votar");
    } else {
        if ($user_ID == 0) {
            $user_ID = str_replace(array('.', ':', ' '), "", SOF_getIp());
        }
    }
    $karma = get_usermeta($user_ID, "karma");
    // No puedes votarte a ti mismo.
    $sql = $wpdb->prepare("SELECT user_id FROM {$wpdb->comments} WHERE comment_ID = %d LIMIT 1", $comment_id);
    $commentUser = $wpdb->get_var($sql);
    if ($user_ID == (int) $commentUser) {
        die("No te puede votar a ti mismo");
    }
    // No puedes votar 2 veces
    if (get_usermeta($user_ID, "vote_" . $comment_id) == true) {
        die("No puedes votar dos veces el mismo comentario");
    }
    // Añadimos voto
    $newKarma = 1;
    // + $karma;
    if ($_POST["vote"] === '+') {
        $query = $wpdb->prepare("UPDATE {$wpdb->comments} SET comment_karma = comment_karma + {$newKarma} WHERE comment_ID = %d LIMIT 1", $comment_id);
    } else {
        if ($_POST["vote"] == '-') {
            $query = $wpdb->prepare("UPDATE {$wpdb->comments} SET comment_karma = comment_karma - {$newKarma} WHERE comment_ID = %d LIMIT 1", $comment_id);
        } else {
            return;
        }
    }
    $wpdb->query($query);
    // KARMA COMMENT
    if ($commentUser) {
        $karmaCommentUser = get_usermeta($commentUser, "karma");
        if ($_POST["vote"] === '+') {
            update_usermeta($commentUser, "karma", $karmaCommentUser + get_option('SOF_bonoOK'));
        } else {
            if ($_POST["vote"] === '-') {
                update_usermeta($commentUser, "karma", $karmaCommentUser + get_option('SOF_bonoKO'));
            }
        }
    }
    // Karma Voto
    if ($user_ID) {
        update_usermeta($user_ID, "karma", $karma + get_option('SOF_bonoVOTE'));
        update_usermeta($user_ID, "vote_" . $comment_id, true);
    }
    wp_redirect('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
    exit;
}
开发者ID:gigikiri,项目名称:bcnAutoWallpaperSite,代码行数:60,代码来源:answers.php

示例2: affiliate_new_subscription

function affiliate_new_subscription($tosub_id, $tolevel_id, $to_order, $user_id)
{
    if (function_exists('get_user_meta')) {
        $aff = get_user_meta($user_id, 'affiliate_referred_by', true);
        $paid = get_user_meta($user_id, 'affiliate_paid', true);
    } else {
        $aff = get_usermeta($user_id, 'affiliate_referred_by');
        $paid = get_usermeta($user_id, 'affiliate_paid');
    }
    if (empty($aff)) {
        $aff = false;
    }
    if ($aff && $paid != 'yes') {
        $whole = get_option("membership_whole_payment_" . $tosub_id, 0);
        $partial = get_option("membership_partial_payment_" . $tosub_id, 0);
        if (!empty($whole) || !empty($partial)) {
            $amount = $whole . '.' . $partial;
        } else {
            $amount = 0;
        }
        do_action('affiliate_purchase', $aff, $amount);
        if (defined('AFFILIATE_PAYONCE') && AFFILIATE_PAYONCE == 'yes') {
            if (function_exists('update_user_meta')) {
                update_user_meta($user_id, 'affiliate_paid', 'yes');
            } else {
                update_usermeta($user_id, 'affiliate_paid', 'yes');
            }
        }
    }
}
开发者ID:hscale,项目名称:webento,代码行数:30,代码来源:membership.php

示例3: id_get_user_meta

function id_get_user_meta($id, $val)
{
    if (function_exists('get_user_meta')) {
        return get_user_meta($id, $val, true);
    }
    return get_usermeta($id, $val);
}
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:7,代码来源:intensedebate.php

示例4: xprofile_record_wire_post_notification

/**
 * xprofile_record_wire_post_notification()
 *
 * Records a notification for a new profile wire post to the database and sends out a notification
 * email if the user has this setting enabled.
 * 
 * @package BuddyPress XProfile
 * @param $wire_post_id The ID of the wire post
 * @param $user_id The id of the user that the wire post was sent to
 * @param $poster_id The id of the user who wrote the wire post
 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
 * @global $current_user WordPress global variable containing current logged in user information
 * @uses bp_is_home() Returns true if the current user being viewed is equal the logged in user
 * @uses get_usermeta() Get a user meta value based on meta key from wp_usermeta
 * @uses BP_Wire_Post Class Creates a new wire post object based on ID.
 * @uses site_url Returns the site URL
 * @uses wp_mail Sends an email
 */
function xprofile_record_wire_post_notification($wire_post_id, $user_id, $poster_id)
{
    global $bp, $current_user;
    if ($bp->current_component == $bp->wire->slug && !bp_is_home()) {
        bp_core_add_notification($poster_id, $user_id, 'xprofile', 'new_wire_post');
        if (!get_usermeta($bp->loggedin_user->id, 'notification_profile_wire_post') || 'yes' == get_usermeta($bp->loggedin_user->id, 'notification_profile_wire_post')) {
            $poster_name = bp_fetch_user_fullname($poster_id, false);
            $wire_post = new BP_Wire_Post($bp->profile->table_name_wire, $wire_post_id, true);
            $ud = get_userdata($user_id);
            $wire_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $ud->user_login . '/wire';
            $settings_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $ud->user_login . '/settings/notifications';
            // Set up and send the message
            $to = $ud->user_email;
            $subject = '[' . get_blog_option(1, 'blogname') . '] ' . sprintf(__('%s posted on your wire.', 'buddypress'), stripslashes($poster_name));
            $message = sprintf(__('%s posted on your wire:

"%s"

To view your wire: %s

---------------------
', 'buddypress'), $poster_name, stripslashes($wire_post->content), $wire_link);
            $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
            // Send it
            wp_mail($to, $subject, $message);
        }
    }
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:46,代码来源:bp-xprofile-notifications.php

示例5: Medieteknik_post_tweet

function Medieteknik_post_tweet($tweet, $hashtag)
{
    //get current user
    global $user_ID;
    get_currentuserinfo();
    //get the saved token for this user
    $token = get_usermeta($user_ID, 'twitter_token');
    $secret = get_usermeta($user_ID, 'twitter_token_secret');
    $oauth = new TwitterOAuth($token, $secret);
    $url = 'http://api.twitter.com/1/statuses/update.xml';
    if ($hashtag && strpos(strtolower($tweet), '#medieteknik') == false) {
        //add the hashtag
        $tweet = rtrim($tweet) . ' #medieteknik';
    }
    $params = array('status' => $tweet);
    $reply = $oauth->oauth_request($url, 'POST', $params);
    //Check our request came out ok
    if ($reply['status'] != 200) {
        if ($reply['status'] == 403) {
            die('Twitter tillåter endast 150 statusuppdateringar i timmen. Försök igen senare');
        } else {
            die('Något är galet med twitter. Försök igen senare eller kontakta sidansvarig');
        }
    }
    header('location: index.php');
}
开发者ID:jakbob,项目名称:medieteknik.org,代码行数:26,代码来源:twitter_post_status.php

示例6: user_columns

 /**
  * This function will add the expiration date to the users table
  * 
  * @return string
  */
 function user_columns($empty, $column, $userid)
 {
     //in case we want to add more columns later
     switch ($column) {
         case 'subscription_expiration':
             return get_usermeta($userid, 'subscription_expiration');
             break;
         case 'subscription_startdate':
             return get_usermeta($userid, 'subscription_startdate');
             break;
         case 'subscription_name':
             return get_usermeta($userid, 'subscription_name');
             break;
         case 'subscription_streetaddress':
             return get_usermeta($userid, 'subscription_streetaddress');
             break;
         case 'subscription_city':
             return get_usermeta($userid, 'subscription_city');
             break;
         case 'subscription_state':
             return get_usermeta($userid, 'subscription_state');
             break;
         case 'subscription_zip':
             return get_usermeta($userid, 'subscription_zip');
             break;
         case 'subscription_country':
             return get_usermeta($userid, 'subscription_country');
             break;
     }
     return '';
 }
开发者ID:Jonathonbyrd,项目名称:Member-Pro,代码行数:36,代码来源:siteclass.php

示例7: action_show_user_profile

    function action_show_user_profile($user)
    {
        if (function_exists('get_user_meta')) {
            $tweetbutton_twitter = get_user_meta($user->ID, 'tweetbutton_twitter', true);
            $tweetbutton_twitter_desc = get_user_meta($user->ID, 'tweetbutton_twitter_desc', true);
        } else {
            $tweetbutton_twitter = get_usermeta($user->ID, 'tweetbutton_twitter');
            $tweetbutton_twitter_desc = get_usermeta($user->ID, 'tweetbutton_twitter_desc');
        }
        ?>
    <h3>Twitter Info (Will be used on WP-TweetButton)</h3>

    <table class="form-table">
    <tr>
        <th><label for="tweetbutton_twitter">Twitter User name</label></th> 
        <td><input type="text" name="tweetbutton_twitter" id="tweetbutton_twitter" value="<?php 
        echo esc_attr($tweetbutton_twitter);
        ?>
" />
        <td><span class="description">Please enter your Twitter username.Don't add a link or @</span></td>
    </tr>
        <tr>
        <th><label for="tweetbutton_twitter_desc">Twitter Bio</label></th>
        <td><input type="text" name="tweetbutton_twitter_desc" id="tweetbutton_twitter_desc" value="<?php 
        echo esc_attr($tweetbutton_twitter_desc);
        ?>
" />
        <td><span class="description">Please enter a small Bio, ideally your Twitter Bio</span></td>
    </tr>
    </table>
    <?php 
    }
开发者ID:nunomorgadinho,项目名称:widgilabs.com,代码行数:32,代码来源:wp-tweetbutton.php

示例8: friends_notification_accepted_request

function friends_notification_accepted_request($friendship_id, $initiator_id, $friend_id)
{
    global $bp;
    $friendship = new BP_Friends_Friendship($friendship_id, false, false);
    $friend_name = bp_fetch_user_fullname($friend_id, false);
    if ('no' == get_usermeta((int) $initiator_id, 'notification_friends_friendship_accepted')) {
        return false;
    }
    $ud = get_userdata($initiator_id);
    $friend_ud = get_userdata($friend_id);
    $friend_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $friend_ud->user_login;
    $settings_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $ud->user_login . '/settings/notifications';
    // Set up and send the message
    $to = $ud->user_email;
    $subject = '[' . get_blog_option(1, 'blogname') . '] ' . sprintf(__('%s accepted your friendship request', 'buddypress'), $friend_name);
    $message = sprintf(__('%s accepted your friend request.

To view %s\'s profile: %s

---------------------
', 'buddypress'), $friend_name, $friend_name, $friend_link);
    $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
    // Send it
    wp_mail($to, $subject, $message);
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:25,代码来源:bp-friends-notifications.php

示例9: get_user_meta

 function get_user_meta($user_ID, $meta_key)
 {
     if (function_exists('get_user_meta')) {
         return get_user_meta($user_ID, $meta_key, true);
     } else {
         return get_usermeta($user_ID, $meta_key);
     }
 }
开发者ID:AhmeddSayed,项目名称:MM_Portal,代码行数:8,代码来源:TouAppHelper.php

示例10: login_site_redirect

function login_site_redirect($redirect_to)
{
    global $user;
    $primary_blog_id = get_usermeta($user->ID, 'primary_blog');
    $blog_details = get_blog_details($primary_blog_id);
    $redirect_url = $blog_details->siteurl;
    return $redirect_url;
}
开发者ID:sburns90,项目名称:WP-MS-Login-Redirector,代码行数:8,代码来源:ms-login-redirector.php

示例11: bp_forums_setup

function bp_forums_setup()
{
    global $bp, $bbpress_live;
    if ('' == get_usermeta($bp->loggedin_user->id, 'bb_capabilities')) {
        bp_forums_make_user_active_member($bp->loggedin_user->id);
    }
    $bp->version_numbers->forums = BP_FORUMS_VERSION;
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:8,代码来源:bp-forums.php

示例12: testUpdateUserPerms

 function testUpdateUserPerms()
 {
     $admin = new WhatDidTheySayAdmin();
     $admin->_set_up_capabilities();
     update_usermeta(1, 'transcript_capabilities', array('submit_transcriptions' => true));
     $admin->_update_user_perms(1, array('approve_transcriptions' => 'yes'));
     $this->assertEquals(array('approve_transcriptions' => true), get_usermeta(1, 'transcript_capabilities'));
 }
开发者ID:johnbintz,项目名称:what-did-they-say,代码行数:8,代码来源:WhatDidTheySayAdminTest.php

示例13: cf_affiliate_new_paid

function cf_affiliate_new_paid($affiliate_settings, $user_id, $billing_type)
{
    global $blog_id, $site_id;
    if (empty($user_id)) {
        $user_id = get_current_user_id();
    }
    //echo 'in '. __FILE__ .': '. __FUNCTION__ .': '. __LINE__ .'<br />';
    //echo "affiliate_settings<pre>"; print_r($affiliate_settings); echo "</pre>";
    //echo "user_id[". $user_id ."]<br />";
    //echo "billing_type[". $billing_type ."<br />";
    //die();
    if (function_exists('get_user_meta')) {
        $aff = get_user_meta($user_id, 'affiliate_referred_by', true);
        $paid = get_user_meta($user_id, 'affiliate_paid', true);
    } else {
        $aff = get_usermeta($user_id, 'affiliate_referred_by');
        $paid = get_usermeta($user_id, 'affiliate_paid');
    }
    //echo "aff[". $aff ."]<br />";
    //echo "paid[". $paid ."]<br />";
    if (empty($aff)) {
        $aff = false;
    }
    if ($aff && $paid != 'yes') {
        if ('recurring' == $billing_type) {
            $whole = isset($affiliate_settings['cf_recurring_whole_payment']) ? $affiliate_settings['cf_recurring_whole_payment'] : '0';
            $partial = isset($affiliate_settings['cf_recurring_partial_payment']) ? $affiliate_settings['cf_recurring_partial_payment'] : '0';
            $note = __('Classifieds recurring', 'affiliate');
        } elseif ('one_time' == $billing_type) {
            $whole = isset($affiliate_settings['cf_one_time_whole_payment']) ? $affiliate_settings['cf_one_time_whole_payment'] : '0';
            $partial = isset($affiliate_settings['cf_one_time_partial_payment']) ? $affiliate_settings['cf_one_time_partial_payment'] : '0';
            $note = __('Classifieds one time', 'affiliate');
        } else {
            $whole = '0';
            $partial = '0';
            $note = __('Classifieds', 'affiliate') . ' ' . $billing_type;
        }
        //echo "whole[". $whole ."]<br />";
        //echo "partial[". $partial ."]<br />";
        if (!empty($whole) || !empty($partial)) {
            $amount = $whole . '.' . $partial;
        } else {
            $amount = 0;
        }
        if ($amount > 0) {
            //echo "amount[". $amount ."]<br />";
            $meta = array('affiliate_settings' => affiliate_settings, 'user_id' => $user_id, 'billing_type' => $billing_type, 'blog_id' => $blog_id, 'site_id' => $site_id, 'current_user_id' => get_current_user_id(), 'LOCAL_URL' => (is_ssl() ? 'https://' : 'http://') . esc_attr($_SERVER['HTTP_HOST']) . esc_attr($_SERVER['REQUEST_URI']), 'IP' => isset($_SERVER['HTTP_X_FORWARD_FOR']) ? esc_attr($_SERVER['HTTP_X_FORWARD_FOR']) : esc_attr($_SERVER['REMOTE_ADDR']));
            do_action('affiliate_purchase', $aff, $amount, 'paid:classifieds', $user_id, $note, $meta);
            if (defined('AFFILIATE_PAYONCE') && AFFILIATE_PAYONCE == 'yes') {
                if (function_exists('update_user_meta')) {
                    update_user_meta($user_id, 'affiliate_paid', 'yes');
                } else {
                    update_usermeta($user_id, 'affiliate_paid', 'yes');
                }
            }
        }
    }
}
开发者ID:vilmark,项目名称:vilmark_main,代码行数:58,代码来源:classifieds.php

示例14: wiziapp_handle_column

function wiziapp_handle_column($curr_val, $column_name, $user_id)
{
    if (strpos($column_name, 'wiziapp_') !== FALSE) {
        $val = get_usermeta($user_id, $column_name);
        return $val != '' ? $val : 'NO';
    }
    // We are here so it wasn't our column, return the current value
    return $curr_val;
}
开发者ID:sajidsan,项目名称:sajidsan.github.io,代码行数:9,代码来源:users_list.php

示例15: pf_get_vars

function pf_get_vars($id)
{
    $uinfo = get_userdata($id);
    foreach ($uinfo as $key => $value) {
        $vars[$key] = $value;
    }
    //let's see if this works any better than strictly using $vars['wp_capabilities']
    $vars['wp_capabilities'] = get_usermeta($id, 'wp_capabilities');
    return $vars;
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:10,代码来源:profiler.php


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