Beispiel #1
1
function switch_wpep_hide_notice()
{
    global $current_user;
    $user_id = $current_user->ID;
    if (isset($_GET['switch_wpep_hide_notice']) && $_GET['switch_wpep_hide_notice'] == '0') {
        add_user_meta($user_id, 'switch_utmce_to_wpep', 'true', true);
    }
}
 /**
  * Hide the Settings welcome on click
  *
  * Sets a user meta key that once set
  */
 public function hide_welcome_callback()
 {
     global $current_user;
     $user_id = $current_user->ID;
     add_user_meta($user_id, 'gmb_hide_pro_welcome', 'true', true);
     wp_die();
     // ajax call must die to avoid trailing 0 in your response
 }
Beispiel #3
0
function kt_shop_bookmark_callback()
{
    check_ajax_referer('_kt_ajax_check_nonce', 'nonce_field', TRUE);
    if (isset($_GET['post'])) {
        $post_id = sanitize_text_field($_GET['post']);
        $user_id = get_current_user_id();
        $bookmark = get_user_meta($user_id, '_kt_user_bookmark', FALSE);
        if (in_array($post_id, $bookmark)) {
            // Delete the shop from current user's bookmarks ";
            if (delete_user_meta($user_id, '_kt_user_bookmark', $post_id)) {
                $result = 'deleted';
            } else {
                $result = 'delete goes wrong';
            }
        } else {
            // Add the shop to current user's bookmarks ";
            if (add_user_meta($user_id, '_kt_user_bookmark', $post_id, FALSE)) {
                $result = 'added';
            } else {
                $result = 'add gores wrong';
            }
        }
        echo $result;
    }
    wp_die();
    // this is required to terminate immediately and return a proper response
}
 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();
 }
 public function doSign()
 {
     $offset = get_option('gmt_offset') * HOUR_IN_SECONDS;
     $dayid = floor((time() + $offset) / DAY_IN_SECONDS);
     $uid = get_current_user_id();
     $lastSign = get_user_meta($uid, 'last_sign_at', true);
     if ($lastSign && $lastSign >= $dayid) {
         return new WP_Error('signed', '当日已签到过', array('status' => 403));
     }
     if ($lastSign) {
         $result = update_user_meta($uid, 'last_sign_at', $dayid, $lastSign);
     } else {
         $result = add_user_meta($uid, 'last_sign_at', $dayid, true);
     }
     if (!$result) {
         return new WP_Error('failed', '签到失败', array('status' => 500));
     }
     while (true) {
         $count = get_user_meta($uid, 'signed', true);
         if (!$count) {
             if (add_user_meta($uid, 'signed', 1, true)) {
                 do_action('signed_count_updated', array('uid' => $uid, 'count' => 1));
                 break;
             }
         } else {
             if (update_user_meta($uid, 'signed', $count + 1, $count)) {
                 do_action('signed_count_updated', array('uid' => $uid, 'count' => $count + 1));
                 break;
             }
         }
     }
     return array("ok" => 1);
 }
 /**
  * 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;
 }
Beispiel #7
0
function registerUser()
{
    if (isset($_POST['FullName']) && isset($_POST['InputPasswordSignup']) && isset($_POST['InputEmailSignup'])) {
        /**
         * @var \WegeTech\LottoYard\Service $lottoService
         */
        global $lottoService;
        $user = new User();
        $name = explode(' ', $_POST['FullName']);
        $user->FirstName = htmlspecialchars($name[0]);
        $user->LastName = htmlspecialchars($name[1]);
        $user->Email = $_POST['InputEmailSignup'];
        $user->IP = $_SERVER['REMOTE_ADDR'];
        $response = $lottoService->signUpUser($user);
        if ($response->success) {
            $userResponse = wp_create_user($_POST['InputEmailSignup'], $_POST['InputPasswordSignup'], $_POST['InputEmailSignup']);
            if (is_wp_error($userResponse)) {
                wp_send_json(array('message' => $userResponse->get_error_message()));
            }
            add_user_meta($userResponse, 'lottoPass', $response->data->Password, true);
            loginUser($_POST['InputEmailSignup'], $_POST['InputPasswordSignup']);
            wp_send_json(array('data' => $response->data));
        } else {
            wp_send_json(array('message' => $response->message));
        }
    }
}
Beispiel #8
0
 private function __construct()
 {
     // Determine with the user ID if the user is logged in.
     self::$userID = get_current_user_id();
     // Generate link for mark all forums read.
     self::$markAllReadLink = esc_url(add_query_arg(array('view' => 'markallread'), get_permalink()));
     // Initialize data. For guests we use a cookie as source, otherwise use database.
     if (self::$userID) {
         // Create database entry when it does not exist.
         if (!get_user_meta(self::$userID, 'asgarosforum_unread_cleared', true)) {
             add_user_meta(self::$userID, 'asgarosforum_unread_cleared', '0000-00-00 00:00:00');
         }
         // Get IDs of excluded topics.
         self::$excludedItems = get_user_meta(self::$userID, 'asgarosforum_unread_exclude', true);
     } else {
         // Create a cookie when it does not exist.
         if (!isset($_COOKIE['asgarosforum_unread_cleared'])) {
             // There is no cookie set so basically the forum has never been visited.
             setcookie('asgarosforum_unread_cleared', '0000-00-00 00:00:00', 2147483647);
         }
         // Get IDs of excluded topics.
         if (isset($_COOKIE['asgarosforum_unread_exclude'])) {
             self::$excludedItems = maybe_unserialize($_COOKIE['asgarosforum_unread_exclude']);
         }
     }
 }
 public function add_user_meta()
 {
     if (self::$current == null || $this->name != self::$current) {
         return;
     }
     add_user_meta($this->get_current_user_id(), self::$current, 'seen', true);
 }
Beispiel #10
0
 function wpanswer_user_registration_action_handler($user_id)
 {
     global $wpdb, $wpanswer_user_approve;
     if ($wpanswer_user_approve->configs->get_value('wpanswer_enable_manual_registration_approval') == '1') {
         $res = add_user_meta($user_id, 'wpanswer_account_status', 'pending');
     }
 }
function lhg_set_donation()
{
    $user_id = get_current_user_id();
    //get user locale with user id
    $user_donation_target = get_user_meta($user_id, 'user_donation_target', true);
    //debug:
    //echo "UL1: $user_language";
    if ($user_donation_target == "") {
        //add default locale
        #echo "Unknown donation target ($user_donation_target)";
        add_user_meta($user_id, 'user_donation_target', '1');
        $user_donation_target = 1;
    } else {
        #echo "Found: $user_donation_target";
    }
    ?>
<tr>
 <th scope="row"> Karma points are donated to

 </th>
 <td>
  <select name="lhg_user_donation_target">
<?php 
    lhg_donation_selector($user_donation_target);
    ?>
  </select>
 </td>
</tr>
<?php 
}
Beispiel #12
0
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']);
}
Beispiel #13
0
 public function baseignore()
 {
     $uid = get_current_user_id();
     if (isset($_GET['fileaway_dismiss_config_notice']) && '0' == $_GET['fileaway_dismiss_config_notice']) {
         add_user_meta($uid, 'fileaway_dismiss_config_notice', 'true', true);
     }
 }
Beispiel #14
0
function optionsframework_nag_ignore() {
	global $current_user;
	$user_id = $current_user->ID;
	if ( isset( $_GET['optionsframework_nag_ignore'] ) && '0' == $_GET['optionsframework_nag_ignore'] ) {
		add_user_meta( $user_id, 'optionsframework_ignore_notice', 'true', true );
	}
}
function bogo_update_user_option($user_id)
{
    global $wpdb;
    $meta_key = $wpdb->get_blog_prefix() . 'accessible_locale';
    if (!empty($_POST['setting_bogo_accessible_locales'])) {
        delete_user_meta($user_id, $meta_key);
        if (isset($_POST['bogo_accessible_locales'])) {
            $locales = (array) $_POST['bogo_accessible_locales'];
            $locales = bogo_filter_locales($locales);
            foreach ($locales as $locale) {
                add_user_meta($user_id, $meta_key, $locale);
            }
        }
        if (!metadata_exists('user', $user_id, $meta_key)) {
            add_user_meta($user_id, $meta_key, 'zxx');
            // zxx is a special code in ISO 639-2
        }
    }
    if (isset($_POST['bogo_own_locale'])) {
        $locale = trim($_POST['bogo_own_locale']);
        if (bogo_is_available_locale($locale)) {
            update_user_option($user_id, 'locale', $locale, true);
        }
    }
}
 function updateUser($userObj)
 {
     global $gwpm_activity_model;
     $isGwpmUser = get_user_meta($userObj->userId, 'gwpm_user');
     if (isset($isGwpmUser) && sizeof($isGwpmUser) > 0) {
     } else {
         appendLog(add_user_meta($userObj->userId, 'gwpm_user', true, true));
     }
     $processKeys = array_keys(get_class_vars(get_class($userObj)));
     $dynaKeys = getDynamicFieldKeys();
     foreach ($dynaKeys as $__keys) {
         array_push($processKeys, $__keys);
     }
     foreach ($processKeys as $key) {
         appendLog($key);
         if ($key == "gwpm_profile_photo") {
             $photoObj = $userObj->{$key};
             if ($photoObj["size"] != 0) {
                 $value = savePhotoToUploadFolder($userObj->{$key}, $userObj->userId);
                 $gwpm_activity_model->addActivityLog("profile", "Updated Profile Image", $userObj->userId);
             } else {
                 continue;
             }
         } elseif (!is_array($userObj->{$key})) {
             $value = trim($userObj->{$key});
         } else {
             $value = $userObj->{$key};
         }
         if ($key != 'userId' && $key != 'dynamicFields' && $key != 'dynamicFieldsValidation') {
             update_user_meta($userObj->userId, $key, $value);
         }
     }
     $gwpm_activity_model->addActivityLog("profile", "Updated Profile", $userObj->userId);
 }
Beispiel #17
0
 function userRegister()
 {
     $this->verifyNonce('userRegister');
     $data = $_POST["data"];
     $userID = wp_insert_user(array('first_name' => $data["first_name"], 'last_name' => $data["last_name"], 'nickname' => $data["nickname"], 'user_email' => $data["user_email"], 'user_login' => $data["user_login"], 'user_pass' => $data["user_pass"]));
     /*
     	Add a custom capability to the user
     		$user = new WP_User($userID);
     		$user->add_cap("edit_posts");
     		$user->add_cap("delete_posts");
     */
     if (isset($userID->errors)) {
         echo json_encode($userID);
     } else {
         //Add USER INFO
         add_user_meta($userID, "adress", $data["adress"], true);
         add_user_meta($userID, "localidade", $data["localidade"], true);
         add_user_meta($userID, "codPostal", $data["codPostal"], true);
         add_user_meta($userID, "treinador", "Não atribuido", true);
         //Notify user and admin that a new user arrived
         wp_new_user_notification($userID, '', 'both');
         echo '{"userID": "' . $userID . '"}';
     }
     wp_die();
 }
 public function Complete_new_user_creation($user_id)
 {
     add_user_meta($user_id, 'browserid_registration', $this->user_registering_with_browserid);
     if ($this->user_registering_with_browserid) {
         $this->login->Login_by_id($user_id, false);
     }
 }
Beispiel #19
0
/**
 * Disable a nag message.
 *
 * @since 1.1.0
 */
function themeblvd_sidebars_disable_nag()
{
    global $current_user;
    if (isset($_GET['tb_nag_ignore'])) {
        add_user_meta($current_user->ID, $_GET['tb_nag_ignore'], 'true', true);
    }
}
Beispiel #20
0
function ciUpgradeNagIgnore()
{
    global $current_user;
    /* If user clicks to ignore the notice, add that to their user meta */
    if (isset($_GET[CI_IGNORE_UPGRADE_KEY]) && $_GET[CI_IGNORE_UPGRADE_KEY] == '1') {
        add_user_meta($current_user->ID, CI_IGNORE_UPGRADE_KEY, 'true', true);
    }
}
function setup_user_type($e, $i)
{
    $type = isset($_POST['reg_type']) ? $_POST['reg_type'] : 'buyer';
    add_user_meta($e, 'reg_type', $type);
    $id = rcp_get_subscription_details($type);
    add_user_meta($e, 'eddc_user_rate', $id->commission);
    return $e;
}
Beispiel #22
0
function mtc_ignore_nag_theme_update_notice()
{
    global $current_user;
    $user_id = $current_user->ID;
    if (isset($_GET['mtc_ignore_nag_theme_update_notice']) && '0' == $_GET['mtc_ignore_nag_theme_update_notice']) {
        add_user_meta($user_id, 'mtc_ignore_theme__update_notice', 'true', true);
    }
}
 public static function inbound_notice_ignore()
 {
     global $current_user;
     $user_id = $current_user->ID;
     if (isset($_GET['inbound_translate_ignore']) && '0' == $_GET['inbound_translate_ignore']) {
         add_user_meta($user_id, 'inbound_translate_ignore', 'true', true);
     }
 }
 function tc_plugin_notice_meta()
 {
     global $current_user;
     $user_id = $current_user->ID;
     if (isset($_GET['dismiss_' . $this->plug_prefix . '_notice']) && '0' == $_GET['dismiss_' . $this->plug_prefix . '_notice']) {
         add_user_meta($user_id, 'tc_' . $this->plug_prefix . '_notice', 'true', true);
     }
 }
 public function nag_ignore()
 {
     global $current_user;
     $user_id = $current_user->ID;
     if (isset($_GET['settings-updated']) && 'true' == $_GET['settings-updated']) {
         add_user_meta($user_id, 'rh_ignore_notice', 'true', true);
     }
 }
function dismissNotice()
{
    global $current_user;
    $userID = $current_user->ID;
    if (isset($_GET['dismiss']) && true == $_GET['dismiss']) {
        add_user_meta($userID, 'dismiss-noticee', 'true', true);
    }
}
 function wc_myredsys_payment_gateway_ignore_notice()
 {
     global $current_user;
     $user_id = $current_user->ID;
     if (isset($_GET['ignore_redsys_sha256_notice']) && '0' == $_GET['ignore_redsys_sha256_notice']) {
         add_user_meta($user_id, 'ignore_redsys_sha256_notice', 'true', true);
     }
 }
Beispiel #28
0
function cpw_hide_notice()
{
    global $current_user;
    $user_id = $current_user->ID;
    if (isset($_GET['cpw_hide_notice']) && 'yes' == $_GET['cpw_hide_notice']) {
        add_user_meta($user_id, 'cpw_notice_hidden', 'yes', true);
    }
}
function bean_createaccount_ignore()
{
    global $current_user;
    $user_id = $current_user->ID;
    if (isset($_GET['bean_createaccount_ignore']) && '0' == $_GET['bean_createaccount_ignore']) {
        add_user_meta($user_id, 'bean_createaccount_ignore_notice', 'true', true);
    }
}
Beispiel #30
0
/** Function natural_lite_nag_ignore */
function natural_lite_nag_ignore()
{
    global $current_user;
    $user_id = $current_user->ID;
    if (isset($_GET['natural_lite_nag_ignore']) && '0' == $_GET['natural_lite_nag_ignore']) {
        add_user_meta($user_id, 'natural_lite_ignore_notice', 'true', true);
    }
}