本文整理汇总了PHP中delete_user_meta函数的典型用法代码示例。如果您正苦于以下问题:PHP delete_user_meta函数的具体用法?PHP delete_user_meta怎么用?PHP delete_user_meta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delete_user_meta函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: um_user_edit_profile
function um_user_edit_profile($args)
{
global $ultimatemember;
$to_update = null;
$files = null;
if (isset($args['user_id'])) {
if (um_current_user_can('edit', $args['user_id'])) {
$ultimatemember->user->set($args['user_id']);
} else {
wp_die(__('You are not allowed to edit this user.', 'ultimatemember'));
}
} else {
if (isset($args['_user_id'])) {
$ultimatemember->user->set($args['_user_id']);
}
}
$userinfo = $ultimatemember->user->profile;
$fields = unserialize($args['custom_fields']);
do_action('um_user_before_updating_profile', $userinfo);
// loop through fields
foreach ($fields as $key => $array) {
if ($fields[$key]['type'] == 'multiselect' || $fields[$key]['type'] == 'checkbox' && !isset($args['submitted'][$key])) {
delete_user_meta(um_user('ID'), $key);
}
if (isset($args['submitted'][$key])) {
if (isset($fields[$key]['type']) && in_array($fields[$key]['type'], array('image', 'file')) && um_is_temp_upload($args['submitted'][$key])) {
$files[$key] = $args['submitted'][$key];
} else {
if (isset($userinfo[$key]) && $args['submitted'][$key] != $userinfo[$key]) {
$to_update[$key] = $args['submitted'][$key];
} else {
if ($args['submitted'][$key]) {
$to_update[$key] = $args['submitted'][$key];
}
}
}
}
}
if (isset($args['submitted']['description'])) {
$to_update['description'] = $args['submitted']['description'];
}
if (isset($args['submitted']['role']) && !empty($args['submitted']['role'])) {
$to_update['role'] = $args['submitted']['role'];
}
do_action('um_user_pre_updating_profile', $to_update);
$to_update = apply_filters('um_user_pre_updating_profile_array', $to_update);
if (is_array($to_update)) {
$ultimatemember->user->update_profile($to_update);
}
if (is_array($files)) {
$ultimatemember->user->update_files($files);
}
do_action('um_after_user_updated', um_user('ID'));
do_action('um_after_user_upload', um_user('ID'));
do_action('um_user_after_updating_profile', $to_update);
if (!isset($args['is_signup'])) {
exit(wp_redirect(um_edit_my_profile_cancel_uri()));
}
}
示例2: bp_profile_cover_upload
function bp_profile_cover_upload()
{
global $bp;
if (isset($_POST['action']) && $_POST['action'] == 'bp_cover_upload') {
if (!isset($_POST['_wpnonce']) || !wp_verify_nonce($_POST['_wpnonce'], 'bp_cover_upload')) {
$this->message = '<div class="error message">' . __('Security check Failed. Contact Administrator.', 'bp-profile-cover') . '</div>';
} else {
if (!empty($_FILES['profile_cover']['name'])) {
$attachment = new BP_Profile_Cover();
$file = $attachment->upload($_FILES);
if (!empty($file['error'])) {
$this->message = '<div class="error message">' . $file['error'] . '</div>';
} else {
update_user_meta($bp->loggedin_user->id, 'cover', $file['url']);
$this->message = '<div class="success message">' . __('Cover image uploaded successfully', 'bp-profile-cover') . '</div>';
}
} else {
if (isset($_POST['delete_profile_cover'])) {
delete_user_meta($bp->loggedin_user->id, 'cover');
}
}
}
}
add_action('bp_template_content', array($this, 'bp_profile_cover_page_content'));
bp_core_load_template(apply_filters('bp_core_template_plugin', 'members/single/plugins'));
}
示例3: _delete_meta
public function _delete_meta($key)
{
if ($this->use_acf_meta_functions && function_exists('get_field')) {
delete_user_meta($this->get_id(), '_' . $this->meta_prefix . $key);
}
delete_user_meta($this->get_id(), $this->meta_prefix . $key);
}
示例4: __unset
public function __unset($name)
{
if ($this->_show_id && $name === 'id') {
return;
}
delete_user_meta($this->_id, $name);
}
示例5: WP_members_list_meta_actions
function WP_members_list_meta_actions($i)
{
global $getWP, $tern_wp_members_defaults, $current_user, $wpdb, $profileuser, $current_user, $getMap;
$o = $getWP->getOption('tern_wp_members', $tern_wp_members_defaults);
get_currentuserinfo();
if (!current_user_can('edit_users') and ($o['allow_display'] and $current_user->ID != $i or !$o['allow_display'])) {
return;
}
global $getWP, $tern_wp_members_defaults, $current_user, $wpdb, $profileuser;
$o = $getWP->getOption('tern_wp_members', $tern_wp_members_defaults);
delete_user_meta($i, '_tern_wp_member_list');
foreach ((array) $_REQUEST['lists'] as $v) {
add_user_meta($i, '_tern_wp_member_list', $v);
}
$a = array('line1', 'line2', 'city', 'state', 'zip');
foreach ($a as $v) {
delete_user_meta($i, '_' . $v);
add_user_meta($i, '_' . $v, $_POST[$v]);
$address[$v] = $_POST[$v];
}
//delete_user_meta($i,'_address');
//add_user_meta($i,'_address',$address);
$l = $getMap->geoLocate($address);
delete_user_meta($i, '_lat');
delete_user_meta($i, '_lng');
add_user_meta($i, '_lat', $l['lat']);
add_user_meta($i, '_lng', $l['lng']);
}
示例6: activate
/**
* Fired when the plugin is activated.
*
* @since 1.0.0
*
* @param boolean $network_wide True if WPMU superadmin uses
* "Network Activate" action, false if
* WPMU is disabled or plugin is
* activated on an individual blog.
*/
public static function activate($network_wide)
{
//Remove Welcome Message Meta so User Sees it Again
global $current_user;
$user_id = $current_user->ID;
delete_user_meta($user_id, 'gmb_hide_welcome');
//Display Tooltip
$dismissed_pointers = explode(',', get_user_meta($user_id, 'dismissed_wp_pointers', true));
// Check if our pointer is among dismissed ones and delete that mofo
if (in_array('gmb_welcome_pointer', $dismissed_pointers)) {
$key = array_search('gmb_welcome_pointer', $dismissed_pointers);
delete_user_meta($user_id, 'dismissed_wp_pointers', $key['gmb_welcome_pointer']);
}
//Multisite Checks
if (function_exists('is_multisite') && is_multisite()) {
if ($network_wide) {
// Get all blog ids
$blog_ids = self::get_blog_ids();
foreach ($blog_ids as $blog_id) {
switch_to_blog($blog_id);
self::single_activate();
}
restore_current_blog();
} else {
self::single_activate();
}
} else {
self::single_activate();
}
}
示例7: iul_check_last_session
function iul_check_last_session()
{
if (is_user_logged_in()) {
$user = wp_get_current_user();
$roles = $user->roles[0];
$iul_data = get_option('iul_data');
$iul_behavior = get_option('iul_behavior');
$iul_disable_admin = isset($iul_data['iul_disable_admin']) ? $iul_data['iul_disable_admin'] : false;
if (!$iul_disable_admin) {
if (!is_admin()) {
$last_active_time = get_user_meta(get_current_user_id(), 'last_active_time', true);
$current_time = date('H:i:s');
if ($last_active_time) {
$timer = empty($iul_behavior[$roles]['idle_timer']) ? $iul_data['iul_idleTimeDuration'] : $iul_behavior[$roles]['idle_timer'];
$diff = strtotime($current_time) - strtotime($last_active_time);
if ($diff >= $timer) {
/* Execute behavioral actions*/
iul_execute_behavioural_action();
delete_user_meta(get_current_user_id(), 'last_active_time');
do_action('uil_after_logout');
} else {
update_user_meta(get_current_user_id(), 'last_active_time', $current_time);
}
} else {
update_user_meta(get_current_user_id(), 'last_active_time', $current_time);
}
} else {
$current_time = date('H:i:s');
update_user_meta(get_current_user_id(), 'last_active_time', $current_time);
}
}
}
}
示例8: __construct
function __construct($user_id = 0, $blogid = 0)
{
global $blog_id;
$this->user_id = empty($user_id) ? get_current_user_id() : $user_id;
$this->blog_id = empty($blogid) ? $blog_id : $blogid;
//Convert from old style
$dr_order = get_user_meta($this->user_id, 'dr_order', true);
$dr_credits = get_user_meta($this->user_id, 'dr_credits', true);
$dr_credits_log = get_user_meta($this->user_id, 'dr_credits_log', true);
//Blog specfic version
$dr_transactions = get_user_option('dr_transactions', $this->user_id);
// $dr_blog has entire transaction array
if (!empty($dr_order) || !empty($dr_credits) || !empty($dr_credits_log)) {
// Need to convert
$dr_transactions = $this->struc;
$dr_transactions['credits'] = empty($dr_credits) ? 0 : $dr_credits;
$status = empty($dr_order['order_info']['status']) ? '' : $dr_order['order_info']['status'];
$expires = empty($dr_order['time_end_annual']) ? 0 : $dr_order['time_end_annual'];
$billing = empty($dr_order['billing']) ? '' : $dr_order['billing'];
$dr_transactions['order']['status'] = $status;
$dr_transactions['order']['expires'] = $expires;
$dr_transactions['order']['billing_type'] = $billing;
update_user_option($this->user_id, 'dr_transactions', $dr_transactions);
delete_user_meta($this->user_id, 'dr_order');
delete_user_meta($this->user_id, 'dr_credits');
delete_user_meta($this->user_id, 'dr_credits_log');
}
if (!$dr_transactions) {
$dr_transactions = $this->struc;
$options = $this->get_options('payments');
$dr_transactions['credits'] = empty($options['signup_credits']) ? 0 : $options['signup_credits'];
update_user_option($this->user_id, 'dr_transactions', $dr_transactions);
}
}
示例9: get_moodle_user_id
/**
* Get moodle user id. If the user does not exist in moodle then creats an user in moodle.
*
* @access private
* @param bool $create_moodle_user (default: bool)
* @return int
*/
private function get_moodle_user_id($create_moodle_user = false)
{
global $DC_Woodle;
$wc_order = $this->wc_order;
$user_id = $wc_order->get_user_id();
$email = $wc_order->billing_email;
$moodle_user_id = 0;
if ($user_id) {
$moodle_user_id = get_user_meta($user_id, '_moodle_user_id', true);
$moodle_user_id = intval($moodle_user_id);
$moodle_user_id = $this->search_for_moodle_user('id', array($moodle_user_id));
if (!$moodle_user_id) {
delete_user_meta($user_id, '_moodle_user_id');
}
}
if (!$moodle_user_id) {
$moodle_user_id = $this->search_for_moodle_user('email', array($email));
if ($moodle_user_id && $user_id) {
add_user_meta($user_id, '_moodle_user_id', $moodle_user_id);
}
}
if (!$moodle_user_id && $create_moodle_user) {
$moodle_user_id = $this->create_moodle_user();
if ($moodle_user_id && $user_id) {
add_user_meta($user_id, '_moodle_user_id', $moodle_user_id);
}
} else {
if (woodle_get_settings('update_user_info', 'dc_woodle_general') == 'yes') {
$this->update_moodle_user($moodle_user_id);
}
}
return $moodle_user_id;
}
示例10: vaa_uninstall
function vaa_uninstall($blog_id = false)
{
// Delete all View Admin As options
$option_keys = array('vaa_view_admin_as', 'vaa_role_defaults');
if ($blog_id) {
if ($blog_id == 'site') {
foreach ($option_keys as $option_key) {
delete_site_option($option_key);
}
} else {
foreach ($option_keys as $option_key) {
delete_blog_option($blog_id, $option_key);
}
}
} else {
foreach ($option_keys as $option_key) {
delete_option($option_key);
}
// Delete all View Admin As user metadata
$user_meta_keys = array('vaa-view-admin-as');
// Older (not used anymore) keys
$user_meta_keys[] = 'view-admin-as';
global $wpdb;
$all_users = $wpdb->get_results("SELECT ID FROM {$wpdb->users}");
foreach ($all_users as $user) {
foreach ($user_meta_keys as $user_meta_key) {
delete_user_meta($user->ID, $user_meta_key);
}
}
}
}
示例11: save
public function save($userId)
{
if (!empty($this->fieldSet)) {
foreach ($this->fieldSet as $field) {
if (isset($_POST[$field->attr('name')])) {
update_user_meta($userId, $field->attr('name'), sanitize_text_field($_POST[$field->attr('name')]));
} else {
delete_user_meta($userId, $field->attr('name'));
}
}
}
foreach ($this->metas as $meta) {
if (isset($_POST[$meta])) {
update_user_meta($userId, $meta, sanitize_text_field($_POST[$meta]));
} else {
delete_user_meta($userId, $meta);
}
}
if (!empty($this->caps)) {
$user = new \WP_User($userId);
foreach ($this->caps as $cap) {
if (!empty($_POST[$cap])) {
$user->add_cap($cap);
} else {
$user->remove_cap($cap);
}
}
}
}
示例12: clear_agreement
function clear_agreement($user_ID)
{
delete_user_meta($user_ID, 'terms_and_conditions');
delete_user_meta($user_ID, 'tou_initials');
setcookie('terms_user_' . COOKIEHASH, '', time() - 3600, COOKIEPATH, COOKIE_DOMAIN);
setcookie('terms_user_date_' . COOKIEHASH, '', time() - 3600, COOKIEPATH, COOKIE_DOMAIN);
}
示例13: fts_old_extenstions_block
function fts_old_extenstions_block()
{
global $current_user;
$user_id = $current_user->ID;
$list_old_plugins = array('feed-them-premium/feed-them-premium.php', 'fts-bar/fts-bar.php', 'feed-them-social-facebook-reviews/feed-them-social-facebook-reviews.php');
$plugins = get_plugins();
foreach ($list_old_plugins as $single_plugin) {
require_once ABSPATH . '/wp-admin/includes/plugin.php';
if (isset($plugins[$single_plugin])) {
$fts_versions_needed = \fts_versions_needed();
if ($plugins[$single_plugin]['Version'] < $fts_versions_needed[$single_plugin] && is_plugin_active($single_plugin)) {
//Don't Let Old Plugins Activate
deactivate_plugins($single_plugin);
if (isset($_GET['activate'])) {
delete_user_meta($user_id, 'fts_old_plugins_ignore');
unset($_GET['activate']);
}
} elseif ($plugins[$single_plugin]['Version'] >= $fts_versions_needed[$single_plugin] && is_plugin_active($single_plugin)) {
global $current_user;
$is_an_admin = in_array('administrator', $current_user->roles);
$user_id = $current_user->ID;
/* If user clicks to ignore the notice, add that to their user meta */
if (isset($_GET['fts_old_plugins_ignore']) && '0' == $_GET['fts_old_plugins_ignore'] && $is_an_admin == true) {
add_user_meta($user_id, 'fts_old_plugins_ignore', 'true', true);
//delete_user_meta( $user_id, 'das_old_plugins_ignore');
}
}
}
}
}
示例14: delete_extra_social_links
function delete_extra_social_links($user_id)
{
delete_user_meta($user_id, 'wp_corlate_facebook');
delete_user_meta($user_id, 'wp_corlate_twitter');
delete_user_meta($user_id, 'wp_corlate_gplus');
delete_user_meta($user_id, 'wp_corlate_github');
}
示例15: register_config_groups
public function register_config_groups()
{
wp_register_script('peepso-blogposts-config', plugin_dir_url(__FILE__) . '../assets/js/blogposts-config.js', array('jquery'), PeepSo::PLUGIN_VERSION, TRUE);
wp_enqueue_script('peepso-blogposts-config');
if (isset($_GET['admin_tutorial_reset'])) {
delete_user_meta(PeepSo::get_user_id(), 'peepso_blogposts_admin_tutorial_hide');
PeepSo::redirect(admin_url() . 'admin.php?page=peepso_config&tab=blogposts');
}
if (isset($_GET['admin_tutorial_hide'])) {
add_user_meta(PeepSo::get_user_id(), 'peepso_blogposts_admin_tutorial_hide', 1, TRUE);
PeepSo::redirect(admin_url() . 'admin.php?page=peepso_config&tab=blogposts');
}
// display the admin tutorial unless this user has already hidden it
if (1 != get_user_meta(PeepSo::get_user_id(), 'peepso_blogposts_admin_tutorial_hide', TRUE)) {
ob_start();
PeepSoTemplate::exec_template('blogposts', 'admin_tutorial');
$peepso_admin = PeepSoAdmin::get_instance();
$peepso_admin->add_notice(ob_get_clean(), '');
}
$this->context = 'left';
$this->group_profile();
$this->group_acknowledgements();
$this->context = 'right';
$this->group_activity();
$this->group_post_types();
}