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

PHP bp_update_user_meta函数代码示例

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

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



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

示例1: bp_settings_update_notification_settings

/**
 * Update email notification settings for a specific user.
 *
 * @since 2.3.5
 *
 * @param int   $user_id  ID of the user whose settings are being updated.
 * @param array $settings Settings array.
 */
function bp_settings_update_notification_settings($user_id, $settings)
{
    $user_id = (int) $user_id;
    $settings = bp_settings_sanitize_notification_settings($settings);
    foreach ($settings as $setting_key => $setting_value) {
        bp_update_user_meta($user_id, $setting_key, $setting_value);
    }
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:16,代码来源:bp-settings-functions.php


示例2: post_comment

 /**
  * Post a gallery or media Main comment on single page
  * 
  * @return type
  */
 public function post_comment()
 {
     // Bail if not a POST action
     if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
         return;
     }
     // Check the nonce
     check_admin_referer('post_update', '_wpnonce_post_update');
     if (!is_user_logged_in()) {
         exit('-1');
     }
     $mpp_type = $_POST['mpp-type'];
     $mpp_id = $_POST['mpp-id'];
     if (empty($_POST['content'])) {
         exit('-1<div id="message" class="error"><p>' . __('Please enter some content to post.', 'mediapress') . '</p></div>');
     }
     $activity_id = 0;
     if (empty($_POST['object']) && bp_is_active('activity')) {
         //we are preventing this comment to be set as the user's lastes_update
         $user_id = bp_loggedin_user_id();
         $old_latest_update = bp_get_user_meta($user_id, 'bp_latest_update', true);
         $activity_id = bp_activity_post_update(array('content' => $_POST['content']));
         //restore
         if (!empty($old_latest_update)) {
             bp_update_user_meta($user_id, 'bp_latest_update', $old_latest_update);
         }
     } elseif ($_POST['object'] == 'groups') {
         if (!empty($_POST['item_id']) && bp_is_active('groups')) {
             $activity_id = groups_post_update(array('content' => $_POST['content'], 'group_id' => $_POST['item_id']));
         }
     } else {
         $activity_id = apply_filters('bp_activity_custom_update', $_POST['object'], $_POST['item_id'], $_POST['content']);
     }
     if (empty($activity_id)) {
         exit('-1<div id="message" class="error"><p>' . __('There was a problem posting your update, please try again.', 'mediapress') . '</p></div>');
     }
     //if we have got activity id, let us add a meta key
     if ($mpp_type == 'gallery') {
         mpp_activity_update_gallery_id($activity_id, $mpp_id);
     } elseif ($mpp_type == 'media') {
         mpp_activity_update_media_id($activity_id, $mpp_id);
     }
     $activity = new BP_Activity_Activity($activity_id);
     // $activity->component = buddypress()->mediapress->id;
     $activity->type = 'mpp_media_upload';
     $activity->save();
     if (bp_has_activities('include=' . $activity_id)) {
         while (bp_activities()) {
             bp_the_activity();
             mpp_locate_template(array('activity/entry.php'), true);
         }
     }
     exit;
 }
开发者ID:baden03,项目名称:mediapress,代码行数:59,代码来源:class-mpp-ajax-comment-helper.php


示例3: qa_buddypress_activity_post

function qa_buddypress_activity_post($args)
{
    global $bp;
    $defaults = array('content' => false, 'user_id' => $bp->loggedin_user->id);
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    // Record this on the user's profile
    $from_user_link = bp_core_get_userlink($user_id);
    $activity_action = $action;
    $activity_content = $content;
    $primary_link = bp_core_get_userlink($user_id, false, true);
    // Now write the values
    $activity_id = bp_activity_add(array('user_id' => $user_id, 'action' => apply_filters('bp_activity_new_update_action', $activity_action), 'content' => apply_filters('bp_activity_new_update_content', $activity_content), 'primary_link' => apply_filters('bp_activity_new_update_primary_link', $primary_link), 'component' => $bp->activity->id, 'type' => $type));
    // Add this update to the "latest update" usermeta so it can be fetched anywhere.
    bp_update_user_meta($bp->loggedin_user->id, 'bp_latest_update', array('id' => $activity_id, 'content' => wp_filter_kses($content)));
    do_action('bp_activity_posted_update', $content, $user_id, $activity_id);
    return $activity_id;
}
开发者ID:NoahY,项目名称:q2a-buddypress,代码行数:18,代码来源:qa-plugin.php


示例4: total_friend_count

 function total_friend_count($user_id = 0)
 {
     global $nxtdb, $bp;
     if (!$user_id) {
         $user_id = $bp->displayed_user->id ? $bp->displayed_user->id : $bp->loggedin_user->id;
     }
     /* This is stored in 'total_friend_count' usermeta.
        This function will recalculate, update and return. */
     $count = $nxtdb->get_var($nxtdb->prepare("SELECT COUNT(id) FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d OR friend_user_id = %d) AND is_confirmed = 1", $user_id, $user_id));
     // Do not update meta if user has never had friends
     if (!$count && !bp_get_user_meta($user_id, 'total_friend_count', true)) {
         return 0;
     }
     bp_update_user_meta($user_id, 'total_friend_count', (int) $count);
     return (int) $count;
 }
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:16,代码来源:bp-friends-classes.php


示例5: save

 function save()
 {
     global $nxtdb, $bp;
     $this->subject = apply_filters('messages_notice_subject_before_save', $this->subject, $this->id);
     $this->message = apply_filters('messages_notice_message_before_save', $this->message, $this->id);
     do_action_ref_array('messages_notice_before_save', array(&$this));
     if (empty($this->id)) {
         $sql = $nxtdb->prepare("INSERT INTO {$bp->messages->table_name_notices} (subject, message, date_sent, is_active) VALUES (%s, %s, %s, %d)", $this->subject, $this->message, $this->date_sent, $this->is_active);
     } else {
         $sql = $nxtdb->prepare("UPDATE {$bp->messages->table_name_notices} SET subject = %s, message = %s, is_active = %d WHERE id = %d", $this->subject, $this->message, $this->is_active, $this->id);
     }
     if (!$nxtdb->query($sql)) {
         return false;
     }
     if (!($id = $this->id)) {
         $id = $nxtdb->insert_id;
     }
     // Now deactivate all notices apart from the new one.
     $nxtdb->query($nxtdb->prepare("UPDATE {$bp->messages->table_name_notices} SET is_active = 0 WHERE id != %d", $id));
     bp_update_user_meta($bp->loggedin_user->id, 'last_activity', bp_core_current_time());
     do_action_ref_array('messages_notice_after_save', array(&$this));
     return true;
 }
开发者ID:nxtclass,项目名称:NXTClass,代码行数:23,代码来源:bp-messages-classes.php


示例6: remove

 function remove()
 {
     global $wpdb, $bp;
     $sql = $wpdb->prepare("DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id = %d", $this->user_id, $this->group_id);
     if (!($result = $wpdb->query($sql))) {
         return false;
     }
     groups_update_groupmeta($this->group_id, 'total_member_count', (int) groups_get_groupmeta($this->group_id, 'total_member_count') - 1);
     $group_count = bp_get_user_meta($this->user_id, 'total_group_count', true);
     if (!empty($group_count)) {
         bp_update_user_meta($this->user_id, 'total_group_count', (int) $group_count - 1);
     }
     return $result;
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:14,代码来源:bp-groups-classes.php


示例7: bp_checkins_post_update

function bp_checkins_post_update($args = '')
{
    global $bp;
    $defaults = array('content' => false, 'user_id' => $bp->loggedin_user->id, 'type' => 'checkin', 'place_id' => false, 'place_name' => false, 'comment_id' => false, 'recorded_time' => bp_core_current_time());
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    if ($type == "checkin" && (empty($content) || !strlen(trim($content)))) {
        return false;
    }
    if (bp_is_user_spammer($user_id) || bp_is_user_deleted($user_id)) {
        return false;
    }
    // Record this on the user's profile
    $from_user_link = bp_core_get_userlink($user_id);
    $component = 'checkins';
    if ($type == 'checkin') {
        $activity_action = sprintf(__('%s added a checkin', 'bp-checkins'), $from_user_link);
        $activity_content = $content;
        $primary_link = bp_core_get_userlink($user_id, false, true);
        $checkin_type = 'activity_checkin';
        $item_id = false;
        $secondary_item_id = false;
    } else {
        if ($type == 'new_place' && !empty($place_id)) {
            $component = 'places';
            $place_permalink = '<a href="' . bp_get_checkins_places_the_permalink($place_id) . '" title="' . $place_name . '">' . $place_name . '</a>';
            $activity_action = sprintf(__('%s added a new place %s', 'bp-checkins'), $from_user_link, $place_permalink);
            $primary_link = bp_core_get_userlink($user_id, false, true);
            $checkin_type = 'new_place';
            $item_id = $place_id;
            $activity_content = $content;
            $secondary_item_id = false;
        } else {
            if ($type == 'place_checkin' && !empty($place_id)) {
                $place_permalink = '<a href="' . bp_get_checkins_places_the_permalink($place_id) . '" title="' . $place_name . '">' . $place_name . '</a>';
                $activity_action = sprintf(__('%s checked-in %s', 'bp-checkins'), $from_user_link, $place_permalink);
                $primary_link = bp_core_get_userlink($user_id, false, true);
                $checkin_type = 'place_checkin';
                $item_id = $place_id;
                $activity_content = false;
                $secondary_item_id = false;
            } else {
                if ($type == 'place_comment' && !empty($place_id) && !empty($comment_id)) {
                    $component = 'places';
                    $place_permalink = '<a href="' . bp_get_checkins_places_the_permalink($place_id) . '" title="' . $place_name . '">' . $place_name . '</a>';
                    $activity_action = sprintf(__('%s added a comment on %s', 'bp-checkins'), $from_user_link, $place_permalink);
                    $primary_link = bp_core_get_userlink($user_id, false, true);
                    $checkin_type = 'place_comment';
                    $activity_content = $content;
                    $item_id = $place_id;
                    $secondary_item_id = $comment_id;
                } else {
                    if ($type == 'place_checkin_comment' && !empty($place_id) && !empty($comment_id)) {
                        $component = 'places';
                        $place_permalink = '<a href="' . bp_get_checkins_places_the_permalink($place_id) . '" title="' . $place_name . '">' . $place_name . '</a>';
                        $activity_action = sprintf(__('%s checked-in and added a comment on %s', 'bp-checkins'), $from_user_link, $place_permalink);
                        $primary_link = bp_core_get_userlink($user_id, false, true);
                        $checkin_type = 'place_comment';
                        $activity_content = $content;
                        $item_id = $place_id;
                        $secondary_item_id = $comment_id;
                    }
                }
            }
        }
    }
    // Now write the values
    $activity_id = bp_activity_add(array('user_id' => $user_id, 'action' => apply_filters('bp_activity_new_update_action', $activity_action), 'content' => apply_filters('bp_activity_new_update_content', $activity_content), 'primary_link' => apply_filters('bp_activity_new_update_primary_link', $primary_link), 'component' => $component, 'type' => $checkin_type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time));
    if ($type == 'checkin') {
        bp_update_user_meta($bp->loggedin_user->id, 'bp_latest_update', array('id' => $activity_id, 'content' => wp_filter_kses($content)));
    }
    if ($checkin_type == 'place_comment') {
        update_comment_meta($comment_id, 'group_place_activity_id', $activity_id);
    }
    do_action('bp_activity_posted_checkin', $content, $user_id, $activity_id);
    return $activity_id;
}
开发者ID:socialray,项目名称:surfied-2-0,代码行数:77,代码来源:bp-checkins-functions.php


示例8: prepare_buddypress_data

 public static function prepare_buddypress_data($user_id, $config, $entry)
 {
     // required for user to display in the directory
     if (function_exists('bp_update_user_last_activity')) {
         bp_update_user_last_activity($user_id);
     } else {
         bp_update_user_meta($user_id, 'last_activity', true);
     }
     $buddypress_meta = rgars($config, 'meta/buddypress_meta');
     if (empty($buddypress_meta)) {
         return;
     }
     self::log_debug(__METHOD__ . '(): starting.');
     $form = RGFormsModel::get_form_meta($entry['form_id']);
     $buddypress_row = array();
     $i = 0;
     foreach ($buddypress_meta as $meta_item) {
         if (empty($meta_item['meta_name']) || empty($meta_item['meta_value'])) {
             continue;
         }
         $buddypress_row[$i]['field_id'] = $meta_item['meta_name'];
         $buddypress_row[$i]['user_id'] = $user_id;
         // get GF and BP fields
         $gform_field = RGFormsModel::get_field($form, $meta_item['meta_value']);
         if (version_compare(BP_VERSION, '1.6', '<')) {
             $bp_field = new BP_XProfile_Field();
             $bp_field->bp_xprofile_field($meta_item['meta_name']);
         } else {
             require_once WP_PLUGIN_DIR . '/buddypress/bp-xprofile/bp-xprofile-classes.php';
             $bp_field = new BP_XProfile_Field($meta_item['meta_name']);
         }
         // if bp field is a checkbox AND gf field is a checkbox, get array of input values
         $input_type = RGFormsModel::get_input_type($gform_field);
         if (in_array($bp_field->type, array('checkbox', 'multiselectbox')) && in_array($input_type, array('checkbox', 'multiselect'))) {
             $meta_value = RGFormsModel::get_lead_field_value($entry, $gform_field);
             if (!is_array($meta_value)) {
                 $meta_value = explode(',', $meta_value);
             }
             $meta_value = self::maybe_get_category_name($gform_field, $meta_value);
             $meta_value = array_filter($meta_value, 'GFUser::not_empty');
         } else {
             if ($bp_field->type == 'datebox' && $gform_field['type'] == 'date') {
                 if (version_compare(BP_VERSION, '2.1.1', '<')) {
                     $meta_value = strtotime(self::get_prepared_value($gform_field, $meta_item['meta_value'], $entry));
                 } else {
                     $meta_value = self::get_prepared_value($gform_field, $meta_item['meta_value'], $entry) . ' 00:00:00';
                 }
             } else {
                 $meta_value = self::get_prepared_value($gform_field, $meta_item['meta_value'], $entry);
             }
         }
         self::log_debug(__METHOD__ . "(): Meta item: {$meta_item['meta_name']}. Value: {$meta_value}");
         $buddypress_row[$i]['value'] = $meta_value;
         $buddypress_row[$i]['last_update'] = date('Y-m-d H:i:s');
         $buddypress_row[$i]['field'] = $bp_field;
         $i++;
     }
     GFUserData::insert_buddypress_data($buddypress_row);
     self::log_debug(__METHOD__ . '(): finished.');
 }
开发者ID:Inteleck,项目名称:hwc,代码行数:60,代码来源:userregistration.php


示例9: xprofile_sync_wp_profile

/**
 * Syncs Xprofile data to the standard built in WordPress profile data.
 *
 * @package BuddyPress Core
 */
function xprofile_sync_wp_profile($user_id = 0)
{
    // Bail if profile syncing is disabled
    if (bp_disable_profile_sync()) {
        return true;
    }
    if (empty($user_id)) {
        $user_id = bp_loggedin_user_id();
    }
    if (empty($user_id)) {
        return false;
    }
    $fullname = xprofile_get_field_data(bp_xprofile_fullname_field_id(), $user_id);
    $space = strpos($fullname, ' ');
    if (false === $space) {
        $firstname = $fullname;
        $lastname = '';
    } else {
        $firstname = substr($fullname, 0, $space);
        $lastname = trim(substr($fullname, $space, strlen($fullname)));
    }
    bp_update_user_meta($user_id, 'nickname', $fullname);
    bp_update_user_meta($user_id, 'first_name', $firstname);
    bp_update_user_meta($user_id, 'last_name', $lastname);
    global $wpdb;
    $wpdb->query($wpdb->prepare("UPDATE {$wpdb->users} SET display_name = %s WHERE ID = %d", $fullname, $user_id));
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:32,代码来源:bp-xprofile-functions.php


示例10: bp_core_signup_user

/**
 * Process data submitted at user registration and convert to a signup object.
 *
 * @since 1.2.0
 *
 * @todo There appears to be a bug in the return value on success.
 *
 * @param string $user_login    Login name requested by the user.
 * @param string $user_password Password requested by the user.
 * @param string $user_email    Email address entered by the user.
 * @param array  $usermeta      Miscellaneous metadata about the user (blog-specific
 *                              signup data, xprofile data, etc).
 * @return bool|WP_Error True on success, WP_Error on failure.
 */
function bp_core_signup_user($user_login, $user_password, $user_email, $usermeta)
{
    $bp = buddypress();
    // We need to cast $user_id to pass to the filters.
    $user_id = false;
    // Multisite installs have their own install procedure.
    if (is_multisite()) {
        wpmu_signup_user($user_login, $user_email, $usermeta);
    } else {
        // Format data.
        $user_login = preg_replace('/\\s+/', '', sanitize_user($user_login, true));
        $user_email = sanitize_email($user_email);
        $activation_key = wp_generate_password(32, false);
        /**
         * WordPress's default behavior is to create user accounts
         * immediately at registration time. BuddyPress uses a system
         * borrowed from WordPress Multisite, where signups are stored
         * separately and accounts are only created at the time of
         * activation. For backward compatibility with plugins that may
         * be anticipating WP's default behavior, BP silently creates
         * accounts for registrations (though it does not use them). If
         * you know that you are not running any plugins dependent on
         * these pending accounts, you may want to save a little DB
         * clutter by defining setting the BP_SIGNUPS_SKIP_USER_CREATION
         * to true in your wp-config.php file.
         */
        if (!defined('BP_SIGNUPS_SKIP_USER_CREATION') || !BP_SIGNUPS_SKIP_USER_CREATION) {
            $user_id = BP_Signup::add_backcompat($user_login, $user_password, $user_email, $usermeta);
            if (is_wp_error($user_id)) {
                return $user_id;
            }
            bp_update_user_meta($user_id, 'activation_key', $activation_key);
        }
        $args = array('user_login' => $user_login, 'user_email' => $user_email, 'activation_key' => $activation_key, 'meta' => $usermeta);
        BP_Signup::add($args);
        /**
         * Filters if BuddyPress should send an activation key for a new signup.
         *
         * @since 1.2.3
         *
         * @param bool   $value          Whether or not to send the activation key.
         * @param int    $user_id        User ID to send activation key to.
         * @param string $user_email     User email to send activation key to.
         * @param string $activation_key Activation key to be sent.
         * @param array  $usermeta       Miscellaneous metadata about the user (blog-specific
         *                               signup data, xprofile data, etc).
         */
        if (apply_filters('bp_core_signup_send_activation_key', true, $user_id, $user_email, $activation_key, $usermeta)) {
            bp_core_signup_send_validation_email($user_id, $user_email, $activation_key, $user_login);
        }
    }
    $bp->signup->username = $user_login;
    /**
     * Fires at the end of the process to sign up a user.
     *
     * @since 1.2.2
     *
     * @param bool|WP_Error   $user_id       True on success, WP_Error on failure.
     * @param string          $user_login    Login name requested by the user.
     * @param string          $user_password Password requested by the user.
     * @param string          $user_email    Email address requested by the user.
     * @param array           $usermeta      Miscellaneous metadata about the user (blog-specific
     *                                       signup data, xprofile data, etc).
     */
    do_action('bp_core_signup_user', $user_id, $user_login, $user_password, $user_email, $usermeta);
    return $user_id;
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:81,代码来源:bp-members-functions.php


示例11: update_meta

 function update_meta($args = '')
 {
     $defaults = array('id' => 0, 'meta_key' => null, 'meta_value' => null, 'meta_table' => 'usermeta', 'meta_field' => 'user_id', 'cache_group' => 'users');
     $args = wp_parse_args($args, $defaults);
     extract($args, EXTR_SKIP);
     return bp_update_user_meta($id, $meta_key, $meta_value);
 }
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:7,代码来源:bp-forums-bbpress-sa.php


示例12: refresh_total_group_count_for_user

 /**
  * Refresh the total_group_count for a user.
  *
  * @since BuddyPress (1.8.0)
  *
  * @param int $user_id ID of the user.
  *
  * @return bool True on success, false on failure.
  */
 public static function refresh_total_group_count_for_user($user_id)
 {
     return bp_update_user_meta($user_id, 'total_group_count', (int) self::total_group_count($user_id));
 }
开发者ID:AceMedia,项目名称:BuddyPress,代码行数:13,代码来源:class-bp-groups-member.php


示例13: test_bp_user_query_with_user_meta_argument

 /**
  * @group meta
  * @group BP5904
  */
 public function test_bp_user_query_with_user_meta_argument()
 {
     $u1 = $this->factory->user->create();
     $u2 = $this->factory->user->create();
     bp_update_user_meta($u2, 'foo', 'bar');
     $q = new BP_User_Query(array('meta_key' => 'foo', 'meta_value' => 'bar'));
     $found_user_ids = array_values(wp_parse_id_list(wp_list_pluck($q->results, 'ID')));
     // Do a assertNotContains because there are weird issues with user #1 as created by WP
     $this->assertNotContains($u1, $found_user_ids);
     $this->assertEquals(array($u2), $found_user_ids);
 }
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:15,代码来源:class-bp-user-query.php


示例14: bp_activity_post_update

/**
 * Post an activity update
 *
 * @since 1.2.0
 *
 * @param array $args See docs for $defaults for details
 *
 * @global object $bp BuddyPress global settings
 * @uses nxt_parse_args()
 * @uses bp_core_is_user_spammer()
 * @uses bp_core_is_user_deleted()
 * @uses bp_core_get_userlink()
 * @uses bp_activity_add()
 * @uses apply_filters() To call the 'bp_activity_new_update_action' hook
 * @uses apply_filters() To call the 'bp_activity_new_update_content' hook
 * @uses apply_filters() To call the 'bp_activity_new_update_primary_link' hook
 * @uses bp_update_user_meta()
 * @uses nxt_filter_kses()
 * @uses do_action() To call the 'bp_activity_posted_update' hook
 *
 * @return int $activity_id The activity id
 */
function bp_activity_post_update($args = '')
{
    global $bp;
    $defaults = array('content' => false, 'user_id' => $bp->loggedin_user->id);
    $r = nxt_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    if (empty($content) || !strlen(trim($content))) {
        return false;
    }
    if (bp_core_is_user_spammer($user_id) || bp_core_is_user_deleted($user_id)) {
        return false;
    }
    // Record this on the user's profile
    $from_user_link = bp_core_get_userlink($user_id);
    $activity_action = sprintf(__('%s posted an update', 'buddypress'), $from_user_link);
    $activity_content = $content;
    $primary_link = bp_core_get_userlink($user_id, false, true);
    // Now write the values
    $activity_id = bp_activity_add(array('user_id' => $user_id, 'action' => apply_filters('bp_activity_new_update_action', $activity_action), 'content' => apply_filters('bp_activity_new_update_content', $activity_content), 'primary_link' => apply_filters('bp_activity_new_update_primary_link', $primary_link), 'component' => $bp->activity->id, 'type' => 'activity_update'));
    // Add this update to the "latest update" usermeta so it can be fetched anywhere.
    bp_update_user_meta($bp->loggedin_user->id, 'bp_latest_update', array('id' => $activity_id, 'content' => nxt_filter_kses($content)));
    do_action('bp_activity_posted_update', $content, $user_id, $activity_id);
    return $activity_id;
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:46,代码来源:bp-activity-functions.php


示例15: delete_media

	function delete_media(){
		global $bp_media_count;
		bp_media_init_count($this->owner);
		switch ($this->type) {
			case 'image':
				$bp_media_count['images'] = intval($bp_media_count['images']) - 1;
				break;
			case 'video':
				$bp_media_count['videos'] = intval($bp_media_count['videos']) - 1;
				break;
			case 'audio':
				$bp_media_count['audio'] = intval($bp_media_count['audio']) - 1;
				break;
		}
		
		wp_delete_attachment($this->attachment_id);
//		$activity_id = get_post_meta($post_id, 'bp_media_child_activity', true);
//		if($activity_id)
//			bp_activity_delete_by_activity_id($activity_id);
		wp_delete_post($this->id);
		bp_update_user_meta($this->owner, 'bp_media_count', $bp_media_count);
	}
开发者ID:rolandinsh,项目名称:buddypress-media,代码行数:22,代码来源:bp-media-class-wordpress.php


示例16: manage_user_last_activity_update

 /**
  * Update `bp_latest_update` user meta with lasted public update.
  *
  * @param $content
  * @param $user_id
  * @param $activity_id
  */
 function manage_user_last_activity_update($content, $user_id, $activity_id)
 {
     global $wpdb, $bp;
     // do not proceed if not allowed
     if (!apply_filters('rtm_manage_user_last_activity_update', true, $activity_id)) {
         return;
     }
     $rtm_activity_model = new RTMediaActivityModel();
     $rtm_activity_obj = $rtm_activity_model->get(array('activity_id' => $activity_id));
     if (!empty($rtm_activity_obj)) {
         if (isset($rtm_activity_obj[0]->privacy) && $rtm_activity_obj[0]->privacy > 0) {
             $get_columns = array('activity_id' => array('compare' => '<', 'value' => $activity_id), 'user_id' => $user_id, 'privacy' => array('compare' => '<=', 'value' => 0));
             // get user's latest public activity update
             $new_last_activity_obj = $rtm_activity_model->get($get_columns, 0, 1);
             if (!empty($new_last_activity_obj)) {
                 // latest public activity id
                 $public_activity_id = $new_last_activity_obj[0]->activity_id;
                 // latest public activity content
                 $activity_content = bp_activity_get_meta($public_activity_id, 'bp_activity_text');
                 if (empty($activity_content)) {
                     $activity_content = $wpdb->get_var("SELECT content FROM {$bp->activity->table_name} WHERE id = {$public_activity_id}");
                 }
                 $activity_content = apply_filters('bp_activity_latest_update_content', $activity_content, $activity_content);
                 // update user's latest update
                 bp_update_user_meta($user_id, 'bp_latest_update', array('id' => $public_activity_id, 'content' => $activity_content));
             }
         }
     }
 }
开发者ID:fs-contributor,项目名称:rtMedia,代码行数:36,代码来源:RTMediaBuddyPressActivity.php


示例17: bp_dtheme_ajax_close_notice

/**
 * Close and keep closed site wide notices from an admin in the sidebar, via a POST request.
 *
 * @return mixed String on error, void on success
 * @since BuddyPress (1.2)
 */
function bp_dtheme_ajax_close_notice()
{
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    if (!isset($_POST['notice_id'])) {
        echo "-1<div id='message' class='error'><p>" . __('There was a problem closing the notice.', 'logicalboneshug') . '</p></div>';
    } else {
        $user_id = get_current_user_id();
        $notice_ids = bp_get_user_meta($user_id, 'closed_notices', true);
        $notice_ids[] = (int) $_POST['notice_id'];
        bp_update_user_meta($user_id, 'closed_notices', $notice_ids);
    }
    exit;
}
开发者ID:raminjan,项目名称:logicalbones_hug,代码行数:22,代码来源:ajax.php


示例18: bp_dtheme_ajax_close_notice

function bp_dtheme_ajax_close_notice()
{
    global $userdata;
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        return;
    }
    if (!isset($_POST['notice_id'])) {
        echo "-1<div id='message' class='error'><p>" . __('There was a problem closing the notice.', 'buddypress') . '</p></div>';
    } else {
        $notice_ids = bp_get_user_meta($userdata->ID, 'closed_notices', true);
        $notice_ids[] = (int) $_POST['notice_id'];
        bp_update_user_meta($userdata->ID, 'closed_notices', $notice_ids);
    }
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:15,代码来源:ajax.php


示例19: bp_media_init_count

/**
 * Shows the media count of a user in the tabs
 * 
 * @since BP Media 2.0
 */
function bp_media_init_count($user = null)
{
    global $bp_media_count;
    if (!$user) {
        $user = bp_displayed_user_id();
    }
    if ($user < 1) {
        $bp_media_count = null;
        return false;
    }
    $count = bp_get_user_meta($user, 'bp_media_count', true);
    if (!$count) {
        $bp_media_count = array('images' => 0, 'videos' => 0, 'audio' => 0);
        bp_update_user_meta($user, 'bp_media_count', $bp_media_count);
    } else {
        $bp_media_count = $count;
    }
    add_filter('bp_get_displayed_user_nav_' . BP_MEDIA_SLUG, 'bp_media_items_count_filter', 10, 2);
    if (bp_current_component() == BP_MEDIA_SLUG) {
        add_filter('bp_get_options_nav_' . BP_MEDIA_IMAGES_SLUG, 'bp_media_items_count_filter', 10, 2);
        add_filter('bp_get_options_nav_' . BP_MEDIA_VIDEOS_SLUG, 'bp_media_items_count_filter', 10, 2);
        add_filter('bp_get_options_nav_' . BP_MEDIA_AUDIO_SLUG, 'bp_media_items_count_filter', 10, 2);
    }
    return true;
}
开发者ID:rolandinsh,项目名称:buddypress-media,代码行数:30,代码来源:bp-media-actions.php


示例20: bp_activity_post_update

/**
 * Post an activity update.
 *
 * @since 1.2.0
 *
 * @uses wp_parse_args()
 * @uses bp_is_user_inactive()
 * @uses bp_core_get_userlink()
 * @uses bp_activity_add()
 * @uses apply_filters() To call the 'bp_activity_new_update_action' hook.
 * @uses apply_filters() To call the 'bp_activity_new_update_content' hook.
 * @uses apply_filters() To call the 'bp_activity_new_update_primary_link' hook.
 * @uses bp_update_user_meta()
 * @uses wp_filter_kses()
 * @uses do_action() To call the 'bp_activity_posted_update' hook.
 *
 * @param array|string $args {
 *     @type string $content The content of the activity update.
 *     @type int    $user_id Optional. Defaults to the logged-in user.
 * }
 * @return int $activity_id The activity id.
 */
function bp_activity_post_update($args = '')
{
    $r = wp_parse_args($args, array('content' => false, 'user_id' => bp_loggedin_user_id()));
    if (empty($r['content']) || !strlen(trim($r['content']))) {
        return false;
    }
    if (bp_is_user_inactive($r['user_id'])) {
        return false;
    }
    // Record this on the user's profile.
    $activity_content = $r['content'];
    $primary_link = bp_core_get_userlink($r['user_id'], false, true);
    /**
     * Filters the new activity content for current activity item.
     *
     * @since 1.2.0
     *
     * @param string $activity_content Activity content posted by user.
     */
    $add_content = apply_filters('bp_activity_new_update_content', $activity_content);
    /**
     * Filters the activity primary link for current activity item.
     *
     * @since 1.2.0
     *
     * @param string $primary_link Link to the profile for the user who posted the activity.
     */
    $add_primary_link = apply_filters('bp_activity_new_update_primary_link', $primary_link);
    // Now write the values.
    $activity_id = bp_activity_add(array('user_id' => $r['user_id'], 'content' => $add_content, 'primary_link' => $add_primary_link, 'component' => buddypress()->activity->id, 'type' => 'activity_update'));
    /**
     * Filters the latest update content for the activity item.
     *
     * @since 1.6.0
     *
     * @param string $r                Content of the activity update.
     * @param string $activity_content Content of the activity update.
     */
    $activity_content = apply_filters('bp_activity_latest_update_content', $r['content'], $activity_content);
    // Add this update to the "latest update" usermeta so it can be fetched anywhere.
    bp_update_user_meta(bp_loggedin_user_id(), 'bp_latest_update', array('id' => $activity_id, 'content' => $activity_content));
    /**
     * Fires at the end of an activity post update, before returning the updated activity item ID.
     *
     * @since 1.2.0
     *
     * @param string $content     Content of the activity post update.
     * @param int    $user_id     ID of the user posting the activity update.
     * @param int    $activity_id ID of the activity item being updated.
     */
    do_action('bp_activity_posted_update', $r['content'], $r['user_id'], $activity_id);
    return $activity_id;
}
开发者ID:humanmade,项目名称:BuddyPress,代码行数:75,代码来源:bp-activity-functions.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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