public function saveNotificationsOnProfile($user_id) { if (!current_user_can("edit_user", $user_id)) { return false; } update_usermeta($user_id, "notify_jhufos", $_POST["notify_jhufos"]); }
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'); } } } }
function track_user_comment_posting() { global $current_blog; global $comment; global $post; global $current_user; global $comment_post_ID; $thisnewcomment = array($current_blog->blog_id, $comment_post_ID); $addcomment = implode(", ", $thisnewcomment); $LatestCommentsList = $current_user->LatestComments; if (!$LatestCommentsList) { $LatestCommentsList = array(); } else { $array = explode(", ", $current_user->LatestComments); } if (!in_array($addcomment, $LatestCommentsList)) { array_push($LatestCommentsList, $addcomment); if (count($LatestCommentsList) > 30) { unset($LatestCommentsList[0]); array_unshift($LatestCommentsList, array_shift($LatestCommentsList)); if (!isset($LatestCommentsList[0])) { $LatestCommentsList = array(); } } } update_usermeta($current_user->ID, 'LatestComments', $LatestCommentsList); }
function Medieteknik_Save_Token() { //assume we have been authorized and returned //first check if we have a logged in user //äckliga wordpress vill att man gör såhär global $user_ID; get_currentuserinfo(); if (!$user_ID) { die('Du är inte inloggad i wordpress. LOGGA IN FFS!!!!'); } //get our temporary token $token = $_SESSION['oauth_token']; $secret = $_SESSION['oauth_token_secret']; //kolla att vi faktiskt har en token if (!$token || !$secret) { die('Kunde inte hitta en sparad token. Gör om gör rätt!'); } //request a permanent token $oauth = new TwitterOAuth($token, $secret); $new_token = $oauth->access_token(); //check our reply if (!$new_token['oauth_token'] || !$new_token['oauth_token_secret']) { die('Du blev inte autoriserad. Prova igen?'); } //insert token and secret into the usermeta database update_usermeta($user_ID, 'twitter_token', $new_token['oauth_token']); update_usermeta($user_ID, 'twitter_token_secret', $new_token['oauth_token_secret']); //echo 'Välkommen ' . $new_token['screen_name']; //istället redirecta till index header('location: index.php'); }
function save_extra_profile_fields($user_id) { if (!current_user_can('edit_user', $user_id)) { return false; } update_usermeta($user_id, 'wsi_profile_image', $_POST['wsi_profile_image']); }
function frankly_save_custom_user_profile_fields($user_id) { if (!current_user_can('edit_user', $user_id)) { return FALSE; } update_usermeta($user_id, 'frankly', $_POST['frankly']); }
function casestudy_save_extra_profile_fields($user_id) { if (!current_user_can('edit_user', $user_id)) { return false; } update_usermeta($user_id, 'jobtitle', $_POST['jobtitle']); }
function pmpromd_save_extra_profile_fields($user_id) { if (!current_user_can('edit_user', $user_id)) { return false; } update_usermeta($user_id, 'pmpromd_hide_directory', $_POST['hide_directory']); }
/** * Handles sending password retrieval email to user. * * @uses $wpdb WordPress Database object * * @return bool|WP_Error True: when finish. WP_Error on error */ function retrieve_password() { global $wpdb; $errors = new WP_Error(); if (empty($_POST['user_login']) && empty($_POST['user_email'])) { $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.')); } if (strpos($_POST['user_login'], '@')) { $user_data = get_user_by_email(trim($_POST['user_login'])); if (empty($user_data)) { $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.')); } } else { $login = trim($_POST['user_login']); $user_data = get_userdatabylogin($login); } do_action('lostpassword_post'); if ($errors->get_error_code()) { return $errors; } if (!$user_data) { $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.')); return $errors; } // redefining user_login ensures we return the right case in the email $user_login = $user_data->user_login; $user_email = $user_data->user_email; do_action('retreive_password', $user_login); // Misspelled and deprecated do_action('retrieve_password', $user_login); $allow = apply_filters('allow_password_reset', true, $user_data->ID); if (!$allow) { return new WP_Error('no_password_reset', __('Password reset is not allowed for this user')); } else { if (is_wp_error($allow)) { return $allow; } } $user_email = $_POST['user_email']; $user_login = $_POST['user_login']; $user = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->users} WHERE user_login = %s", $user_login)); if (empty($user)) { return new WP_Error('invalid_key', __('Invalid key')); } $new_pass = wp_generate_password(12, false); do_action('password_reset', $user, $new_pass); wp_set_password($new_pass, $user->ID); update_usermeta($user->ID, 'default_password_nag', true); //Set up the Password change nag. $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n"; $message .= sprintf(__('Password: %s'), $new_pass) . "\r\n"; $message .= site_url() . '/?ptype=affiliate' . "\r\n"; $title = sprintf(__('[%s] Your new password'), get_option('blogname')); $title = apply_filters('password_reset_title', $title); $message = apply_filters('password_reset_message', $message, $new_pass); if ($message && !wp_mail($user_email, $title, $message)) { die('<p>' . __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') . '</p>'); } return true; }
/** * Plugin activation * * @access public * @return void * @author Ralf Hortt **/ public function activation() { // First time installation if ($this->is_first_time()) { $users = get_users(); if ($users) { foreach ($users as $user) { update_usermeta($user->ID, 'authentication', '1'); } } add_option('confirm-user-registration', array('administrator' => get_bloginfo('admin_email'), 'error' => __('<strong>ERROR:</strong> Your account has to be confirmed by an administrator before you can login', 'confirm-user-registration'), 'from' => get_bloginfo('name') . ' <' . get_bloginfo('admin_email') . ">\n", 'subject' => __('Account Confirmation: ' . get_bloginfo('name'), 'confirm-user-registration'), 'message' => __("You account has been approved by an administrator!\nLogin @ " . get_bloginfo('url') . "/wp-login.php\n\nThis message is auto generated\n", 'confirm-user-registration'))); // Upgrade } else { if ($this->is_upgrade()) { // Create new option array add_option('confirm-user-registration', array('administrator' => get_option('cur_administrator'), 'error' => get_option('cur_error'), 'from' => get_option('cur_from'), 'subject' => get_option('cur_subject'), 'message' => get_option('cur_message'))); // Cleanup delete_option('cur_administrator'); delete_option('cur_error'); delete_option('cur_from'); delete_option('cur_subject'); delete_option('cur_message'); } } }
function wp_insert_user($userdata) { global $wpdb; extract($userdata); // Are we updating or creating? if (!empty($ID)) { $update = true; } else { $update = false; // Password is not hashed when creating new user. $user_pass = md5($user_pass); } if (empty($user_nicename)) { $user_nicename = sanitize_title($user_login); } if (empty($display_name)) { $display_name = $user_login; } if (empty($nickname)) { $nickname = $user_login; } if (empty($user_registered)) { $user_registered = gmdate('Y-m-d H:i:s'); } if ($update) { $query = "UPDATE {$wpdb->users} SET user_pass='******', user_email='{$user_email}', user_url='{$user_url}', user_nicename = '{$user_nicename}', display_name = '{$display_name}' WHERE ID = '{$ID}'"; $query = apply_filters('update_user_query', $query); $wpdb->query($query); $user_id = $ID; } else { $query = "INSERT INTO {$wpdb->users} \n\t\t(user_login, user_pass, user_email, user_url, user_registered, user_nicename, display_name)\n\tVALUES \n\t\t('{$user_login}', '{$user_pass}', '{$user_email}', '{$user_url}', '{$user_registered}', '{$user_nicename}', '{$display_name}')"; $query = apply_filters('create_user_query', $query); $wpdb->query($query); $user_id = $wpdb->insert_id; } update_usermeta($user_id, 'first_name', $first_name); update_usermeta($user_id, 'last_name', $last_name); update_usermeta($user_id, 'nickname', $nickname); update_usermeta($user_id, 'description', $description); update_usermeta($user_id, 'jabber', $jabber); update_usermeta($user_id, 'aim', $aim); update_usermeta($user_id, 'yim', $yim); if ($update && !empty($role)) { $user = new WP_User($user_id); $user->set_role($role); } if (!$update) { $user = new WP_User($user_id); $user->set_role(get_settings('default_role')); } wp_cache_delete($user_id, 'users'); wp_cache_delete($user_login, 'userlogins'); if ($update) { do_action('profile_update', $user_id); } else { do_action('user_register', $user_id); } return $user_id; }
function save_admin_check_off($user_id) { if (!current_user_can('edit_user', $user_id)) { return false; } /* Copy and paste this line for additional fields. Make sure to change 'twitter' to the field ID. */ update_usermeta($user_id, '_super_user', $_POST['_super_user']); }
function update_user_meta($uid, $key, $val) { if (function_exists('update_usermeta')) { return update_usermeta($uid, $key, $val); } else { return update_user_meta($uid, $key, $val); } }
function update_user_option($user_id, $option_name, $newvalue, $global = false) { global $wpdb; if (!$global) { $option_name = $wpdb->prefix . $option_name; } return update_usermeta($user_id, $option_name, $newvalue); }
function fb_save_custom_user_profile_fields($user_id) { if (!current_user_can('edit_user', $user_id)) { return FALSE; } update_usermeta($user_id, 'flattr-id', $_POST['flattr-id']); update_usermeta($user_id, 'paypal', $_POST['paypal']); }
function my_save_extra_profile_fields($user_id) { if (!current_user_can('edit_user', $user_id)) { return false; } /* Copy and paste this line for additional fields. Make sure to change 'customercode' to the field ID. */ update_usermeta($user_id, 'customercode', $_POST['customercode']); }
function update_user_meta($user_ID, $meta_key, $value) { if (function_exists('update_user_meta')) { update_user_meta($user_ID, $meta_key, $value); } else { update_usermeta($user_ID, $meta_key, $value); } }
function my_save_extra_profile_fields($user_id) { if (!current_user_can('edit_user', $user_id)) { return false; } update_usermeta($user_id, 'university', isset($_POST['university']) ? $_POST['university'] : ''); update_usermeta($user_id, 'user_title', isset($_POST['user_title']) ? $_POST['user_title'] : ''); }
function sw_save_user_profile_fields($user_id) { if (!current_user_can('edit_user', $user_id)) { return false; } /* Copy and paste this line for additional fields. Make sure to change 'twitter' to the field ID. */ update_usermeta($user_id, 'sw_twitter', $_POST['sw_twitter']); }
function save_extra_profile_fields($user_id) { if (!current_user_can('edit_user', $user_id)) { return false; } /* Edit the following lines according to your set fields */ update_usermeta($user_id, 'uk_personal_bests', $_POST['uk_personal_bests']); }
function jumpoff_save_avatar_profile_field($user_id) { if (!current_user_can('edit_user', $user_id)) { return false; } /* Copy and paste this line for additional fields. */ update_usermeta($user_id, 'profilepic', $_POST['profilepic']); }
function argo_update_staff_fields($user_id) { if (!current_user_can('edit_user', $user_id)) { return false; } update_usermeta($user_id, 'argo_twitter', $_POST['argo_twitter']); update_usermeta($user_id, 'argo_is_staff', $_POST['argo_is_staff']); }
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')); }
/** * save user meta * @param $user_id * @return bool */ public function _save_extra_profile_fields($user_id) { if (!current_user_can('edit_user', $user_id)) { return false; } update_usermeta($user_id, 'phone', $_POST['phone']); //update user profile }
public function newAction() { if (!get_option('users_can_register')) { $this->view->_flash->addError(__("User registration is disabled.", WPJB_DOMAIN)); return false; } if ($this->_isCandidate()) { return false; } if ($this->_isLoggedIn()) { wp_redirect(wpjb_link_to("employer_panel")); return; } if (Wpjb_Model_Employer::current()->isEmployer()) { $this->view->_flash->addError(__("You need to be registered as Candidate in order to access this page. Your current account type is Employer.", WPJB_DOMAIN)); return false; } $this->_setTitle(__("Register Employer", WPJB_DOMAIN)); $form = new Wpjb_Form_Frontend_Register(); $this->view->errors = array(); if ($this->isPost()) { $isValid = $form->isValid($this->getRequest()->getAll()); if ($isValid) { $username = $form->getElement("user_login")->getValue(); $password = $form->getElement("user_password")->getValue(); $email = $form->getElement("user_email")->getValue(); $id = wp_create_user($username, $password, $email); $val = $form->getValues(); update_usermeta($id, "is_employer", 1); $employer = new Wpjb_Model_Employer(); $employer->user_id = $id; $employer->company_name = $val["company_name"]; $employer->company_website = $val["company_website"]; $employer->company_info = $val["company_info"]; $employer->company_location = $val["company_location"]; $employer->is_public = $val["is_public"]; $employer->save(); $instance = Wpjb_Project::getInstance(); $router = $instance->getApplication("frontend")->getRouter(); /* @var $router Daq_Router */ $url = $instance->getApplication("frontend")->getUrl(); $url .= "/" . $router->linkTo("employer_login"); $mail = new Wpjb_Utility_Message(9); $mail->setTo($email); $mail->setParam("username", $username); $mail->setParam("password", $password); $mail->setParam("login_url", $url); $mail->send(); $form = new Wpjb_Form_Login(); $form->isValid(array("user_login" => $username, "user_password" => $password, "remember" => false)); $this->view->_flash->addInfo(__("You have been registered successfully", WPJB_DOMAIN)); $redirect = wpjb_link_to("employer_panel"); wp_redirect($redirect); } } $this->view->form = $form; return "company-new"; }
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'); } } } } }
function timtec_user_profile_fields_save($user_id) { if (!current_user_can('edit_user', $user_id)) { return false; } update_usermeta($user_id, 'instituicao', $_POST['instituicao']); update_usermeta($user_id, 'estado', $_POST['estado']); update_usermeta($user_id, 'cidade', $_POST['cidade']); }
protected function constantTest() { $time = microtime(true); for ($i = 0; $i < $this->runNumber; $i++) { $user_id = 1; update_usermeta($user_id, 'metakey', 'metavalue'); } $time = microtime(true) - $time; $this->enterResult($time); }
function action_process_option_update($user_id) { if (function_exists('update_user_meta')) { update_user_meta($user_id, 'tweetbutton_twitter', isset($_POST['tweetbutton_twitter']) ? $_POST['tweetbutton_twitter'] : ''); update_user_meta($user_id, 'tweetbutton_twitter_desc', isset($_POST['tweetbutton_twitter_desc']) ? $_POST['tweetbutton_twitter_desc'] : ''); } else { update_usermeta($user_id, 'tweetbutton_twitter', isset($_POST['tweetbutton_twitter']) ? $_POST['tweetbutton_twitter'] : ''); update_usermeta($user_id, 'tweetbutton_twitter_desc', isset($_POST['tweetbutton_twitter_desc']) ? $_POST['tweetbutton_twitter_desc'] : ''); } }
function add_friend() { global $userdata; get_currentuserinfo(); $rel = $_POST['friendship'] . ' ' . $_POST['physical'] . ' ' . $_POST['professional'] . ' ' . $_POST['geographical'] . ' ' . $_POST['family'] . ' ' . $_POST['identity'] . ' ' . $_POST['romantic']; update_usermeta($userdata->ID, "SocialMu_friend_" . $_POST['user_id'], $rel); $content_mail = $userdata->display_name . ' te ha agregado como contacto en la comunidad de la blogsfera, puedes ver su ficha pinchando en el siguiente enlace: http://comunidad.bbvablogs.com/?id=' . $userdata->ID; $user_friend = get_userdata($_POST['user_id']); wp_mail($user_friend->user_email, sprintf(__('Comunidad blogsfera - Nuevo contacto')), $content_mail, 'From: "Comunidad blogsfera bbva" <' . get_site_option('admin_email') . '>'); }