function id_delete_user_meta($id, $val) { if (function_exists('delete_user_meta')) { return delete_user_meta($id, $val); } return delete_usermeta($id, $val); }
/** * Save our custom profile option. * @param int $user_id User ID * @return bool Whether or not the option was successfully saved. */ public function option_save($user_id) { if (!current_user_can('edit_user', $user_id)) { return false; } if (isset($_POST['snpe_send']) && 'Y' === $_POST['snpe_send']) { return update_usermeta($user_id, 'snpe_send', 'Y'); } else { return delete_usermeta($user_id, 'snpe_send'); } }
/** * Notify the blog admin of a new user, normally via email. * * @param int $user_id User ID * @param string $plaintext_pass Optional. The user's plaintext password */ function wp_new_user_notification($user_id, $plaintext_pass = '') { if (isset($_POST["cimy_uef_wp_PASSWORD"])) { delete_usermeta($user_id, 'default_password_nag'); } if (!is_multisite()) { $options = cimy_get_options(); if (!$options["confirm_email"]) { wp_new_user_notification_original($user_id, $plaintext_pass, $options["mail_include_fields"]); } else { if (!isset($_POST["cimy_uef_wp_PASSWORD"])) { delete_usermeta($user_id, 'default_password_nag'); } } } else { wp_new_user_notification_original($user_id, $plaintext_pass, $options["mail_include_fields"]); } }
function openid_profile_update($user_id) { if (empty($_POST['openid_delegate'])) { delete_usermeta($user_id, 'openid_delegate'); } else { $old_delegate = get_usermeta($user_id, 'openid_delegate'); $delegate = Auth_OpenID::normalizeUrl($_POST['openid_delegate']); if (openid_server_update_delegation_info($user_id, $delegate)) { openid_message(sprintf(__('Gathered OpenID information for delegate URL %s', 'openid'), '<strong>' . $delegate . '</strong>')); openid_status('success'); } else { openid_message(sprintf(__('Unable to find any OpenID information for delegate URL %s', 'openid'), '<strong>' . $delegate . '</strong>')); openid_status('error'); } } }
function ValidateUser() { global $wpdb; $regplus = get_option('register_plus'); if ($regplus['admin_verify'] && isset($_GET['checkemail'])) { echo '<p style="text-align:center;">' . __('Your account will be reviewed by an administrator and you will be notified when it is activated.', 'regplus') . '</p>'; } else { if ($regplus['email_verify'] && isset($_GET['checkemail'])) { echo '<p style="text-align:center;">' . __('Please activate your account using the verification link sent to your email address.', 'regplus') . '</p>'; } } if ($regplus['email_verify'] && isset($_GET['regplus_verification'])) { $regplus = get_option('register_plus'); $verify_key = $_GET['regplus_verification']; $user_id = $wpdb->get_var("SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key = 'email_verify' AND meta_value='{$verify_key}'"); if ($user_id) { $login = get_usermeta($user_id, 'email_verify_user'); $wpdb->query("UPDATE {$wpdb->users} SET user_login = '******' WHERE ID = '{$user_id}'"); delete_usermeta($user_id, 'email_verify_user'); delete_usermeta($user_id, 'email_verify'); delete_usermeta($user_id, 'email_verify_date'); $msg = '<p>' . sprintf(__('Thank you %s, your account has been verified, please login.', 'regplus'), $login) . '</p>'; echo $msg; } } }
function wordbooker_option_manager() { global $ol_flash, $wordbooker_settings, $_POST, $wp_rewrite, $user_ID, $wpdb, $blog_id, $wordbooker_user_settings_id, $wordbooker_hook; echo '<div class="wrap">'; echo '<h2>' . WORDBOOKER_APPLICATION_NAME . " " . __('Options Page', 'wordbooker') . ' </h2>'; if (isset($_POST["reset_user_config"])) { wordbooker_delete_userdata(); } $wordbooker_settings = wordbooker_options(); if (isset($wordbooker_settings['wordbooker_disabled'])) { echo "<div align='center'><b> " . __('WARNING : Wordbooker is DISABLED', 'wordbooker') . "</b></div>"; } else { if (isset($wordbooker_settings['wordbooker_fake_publish'])) { echo "<div align='center'><b> " . __('WARNING : Wordbooker is in TEST mode - NO Posts will be made to Facebook', 'wordbooker') . "</b></div>"; } } if ($wordbooker_settings['wordbooker_comment_cron'] != wp_get_schedule('wb_comment_job')) { $dummy = wp_clear_scheduled_hook('wb_comment_job'); $sql = "Delete from " . WORDBOOKER_POSTCOMMENTS . " where in_out='stat'"; $wpdb->query($sql); if ($wordbooker_settings['wordbooker_comment_cron'] == 'Never' || $wordbooker_settings['wordbooker_comment_cron'] == 'Manual') { } else { $dummy = wp_schedule_event(time(), $wordbooker_settings['wordbooker_comment_cron'], 'wb_comment_job'); } } //Set some defaults: # If the closedboxes are not set then lets set them up - General Options open, all the rest closed $wordbooker_settings = wordbooker_options(); $wb_boxes = get_usermeta($user_ID, 'closedpostboxes_settings_page_wordbooker'); if (count($wb_boxes) == 0) { $wb_boxes[0] = 'wb_opt2'; $wb_boxes[1] = 'wb_opt3'; $wb_boxes[2] = 'wb_opt4'; update_user_meta($user_ID, 'closedpostboxes_settings_page_wordbooker', $wb_boxes); } if (!wbs_retrieve_hash()) { $temp_hash = wbs_generate_hash(); wbs_store_hash($temp_hash); } #var_dump($wordbooker_settings); // If no default author set, lets set it if (!isset($wordbooker_settings["wordbooker_default_author"])) { $wordbooker_settings["wordbooker_default_author"] = 0; } // If no attribute set, then set it. if (!isset($wordbooker_settings["wordbooker_attribute"])) { $wordbooker_settings["wordbooker_attribute"] = __("Posted a new post on their blog", 'wordbooker'); } // If no Status line text, then set it if (!isset($wordbooker_settings["wordbooker_status_update_text"])) { $wordbooker_settings["wordbooker_status_update_text"] = __(": New blog post : %title% - %link%", 'wordbooker'); } // No Share link set, then set it if (!isset($wordbooker_settings["wordbooker_actionlink"])) { $wordbooker_settings["wordbooker_actionlink"] = 300; } // No extract length if (!isset($wordbooker_settings['wordbooker_extract_length'])) { $wordbooker_settings['wordbooker_extract_length'] = 256; } if (!isset($wordbooker_settings['wordbooker_page_post'])) { $wordbooker_settings['wordbooker_page_post'] = -100; } if (!isset($wordbooker_settings['wordbooker_advanced_diagnostics_level'])) { $wordbooker_settings['wordbooker_advanced_diagnostics_level'] = 99; } // Generate meta Description if (!isset($wordbooker_settings['wordbooker_description_meta_length'])) { $wordbooker_settings['wordbooker_description_meta_length'] = '350'; } if (!isset($wordbooker_settings['wordbooker_meta_tag_scan'])) { $wordbooker_settings['wordbooker_meta_tag_scan'] = "image,thumb,Thumbnail"; } // Now lets write those setting back.; wordbooker_set_options($wordbooker_settings); $wordbooker_user_settings_id = "wordbookuser" . $blog_id; echo '<div class="wrap">'; if (isset($_POST['user_meta'])) { // Now we check the hash, to make sure we are not getting CSRF if (wbs_is_hash_valid($_POST['token'])) { foreach (array_keys($_POST) as $key) { if (substr($key, 0, 8) == 'wordbook') { $wordbookeruser_settings[$key] = $_POST[$key]; } } $encoded_setings = $wordbookeruser_settings; #$wordbooker_user_settings_id="wordbookuser".$blog_id; update_usermeta($user_ID, $wordbooker_user_settings_id, $encoded_setings); if (isset($_POST['rwbus'])) { delete_usermeta($user_ID, $wordbooker_user_settings_id); $ol_flash = __("Your user level settings have been reset.", 'wordbooker'); } else { $ol_flash = __("Your user level settings have been saved.", 'wordbooker'); } } else { // Invalid form hash, possible CSRF attempt $ol_flash = __("Security hash missing.", 'wordbooker'); } // endif wbs_is_hash_valid } // end if user_meta check. if ($ol_flash != '') { echo '<div id="message" class="updated fade"><p>' . $ol_flash . '</p></div>'; } wordbooker_option_notices(); $sql = "select user_ID from " . WORDBOOKER_USERDATA . " where user_ID=" . $user_ID; $result = $wpdb->get_results($sql); # We need to put a check in here to stop this crapping out if there is no user id - so flag no row returned $got_id = 0; if (isset($result[0]->user_ID)) { $wbuser = wordbooker_get_userdata($result[0]->user_ID); if ($wbuser->access_token) { $got_id = 1; } } if ($got_id == 1) { wordbooker_update_userdata($wbuser); $checked_flag = array('on' => 'checked', 'off' => ''); # Populate the cache table for this user if its not there. $result = $wpdb->get_row("select facebook_id from " . WORDBOOKER_USERDATA . " where user_id=" . $user_ID); if (strlen($result->facebook_id) < 4) { wordbooker_cache_refresh($user_ID, $fbclient); } # If the user saved their config after setting permissions or chose to refresh the cache then lets refresh the cache if (isset($_POST["perm_save"])) { wordbooker_cache_refresh($user_ID, $fbclient); } function wordbooker_blog_level_options() { global $ol_flash, $wordbooker_settings, $_POST, $wp_rewrite, $user_ID, $wpdb, $blog_id, $wordbooker_user_settings_id, $wordbooker_hook; add_meta_box('wb_opt1', __('General Posting Options', 'wordbooker'), 'wordbooker_blog_posting_options', $wordbooker_hook, 'normal', 'core'); add_meta_box('wb_opt2', __('Facebook Like and Share Options', 'wordbooker'), 'wordbooker_blog_facebook_options', $wordbooker_hook, 'normal', 'core'); add_meta_box('wb_opt3', __('Comment Handling Options', 'wordbooker'), 'wordbooker_blog_comment_options', $wordbooker_hook, 'normal', 'core'); add_meta_box('wb_opt4', __('Advanced Options', 'wordbooker'), 'wordbooker_blog_advanced_options', $wordbooker_hook, 'normal', 'core'); echo '<p><hr><h3>'; _e('Blog Level Settings', 'wordbooker'); echo '</h3><form action="options.php" method="post" action="">'; wp_nonce_field('wordbooker_bl_options'); wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); settings_fields('wordbooker_options'); echo '<input type="hidden" name="wordbooker_settings[schema_vers]" value=' . $wordbooker_settings['schema_vers'] . ' />'; ?> <div id="poststuff" class="metabox-holder<?php echo 2 == $screen_layout_columns ? ' has-right-sidebar' : ''; ?> "> <div id="side-info-column" class="inner-sidebar"> <?php php; ?> </div> <div id="post-body" class="has-sidebar"> <div id="post-body-content" class="has-sidebar-content"> <?php do_meta_boxes($wordbooker_hook, 'normal', $data); ?> </div> </div> <br class="clear"/> </div> <?php if (current_user_can('activate_plugins')) { echo '<input type="submit" name="SBLO" value="' . __("Save Blog Level Options", 'wordbooker') . '" class="button-primary" /> <input type="submit" name="RSD" value="' . __("Reset to system Defaults", 'wordbooker') . '" class="button-primary" action="poo" />'; } echo '</p></form><br /></div><hr>'; } function wordbooker_blog_posting_options() { global $ol_flash, $wordbooker_settings, $_POST, $wp_rewrite, $user_ID, $wpdb, $blog_id, $wordbooker_user_settings_id; $checked_flag = array('on' => 'checked', 'off' => ''); $sql = "select wpu.ID,wpu.display_name from {$wpdb->users} wpu," . WORDBOOKER_USERDATA . " wud where wpu.ID=wud.user_id;"; $wb_users = $wpdb->get_results($sql); if (!isset($wordbooker_settings['wordbooker_comment_email'])) { $wordbooker_settings['wordbooker_comment_email'] = get_bloginfo('admin_email'); } ## Make it so that the drop down includes "Current logged in user" We know now that they have to have an account now as I've changed the code. echo '<label for="wb_publish_post_default">' . __("Default Publish Post to Facebook", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_publish_post_default]" ' . $checked_flag[$wordbooker_settings["wordbooker_publish_post_default"]] . ' ><br />'; echo '<label for="wb_publish_page_default">' . __("Default Publish Page to Facebook", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_publish_page_default]" ' . $checked_flag[$wordbooker_settings["wordbooker_publish_page_default"]] . ' ><br />'; _e('Unless changed, Posts will be published on the Facebook belonging to :', 'wordbooker'); echo '<select name="wordbooker_settings[wordbooker_default_author]" ><option value=0>'; _e('Current Logged in user', 'wordbooker'); echo ' </option>'; $option = ""; foreach ($wb_users as $wb_user) { if ($wb_user->ID == $wordbooker_settings["wordbooker_default_author"]) { $option .= '<option selected="yes" value=' . $wb_user->ID . '>'; } else { $option .= '<option value=' . $wb_user->ID . '>'; } $option .= $wb_user->display_name; $option .= '</option>'; } echo $option; echo '</select><br />'; echo '<label for="wb_publish_no_user">' . __("Publish Posts by non Wordbooker users", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_publish_no_user]" ' . $checked_flag[$wordbooker_settings["wordbooker_publish_no_user"]] . ' ><br />'; echo '<label for="wb_publish_user_publish">' . __("Allow non Wordbooker users to chose to publish a post", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_allow_publish_select]" ' . $checked_flag[$wordbooker_settings["wordbooker_allow_publish_select"]] . ' ><br />'; echo '<label for="wb_extract_length">' . __('Length of Extract', 'wordbooker') . ' :</label> <select id="wordbooker_extract_length" name="wordbooker_settings[wordbooker_extract_length]" >'; $arr = array(10 => "10", 20 => "20", 50 => "50", 100 => "100", 120 => "120", 150 => "150", 175 => "175", 200 => "200", 250 => "250", 256 => __("256 (Default) ", 'wordbooker'), 270 => "270", 300 => "300", 350 => "350", 400 => "400", 500 => "500", 600 => "600", 700 => "700", 800 => "800", 900 => "900"); foreach ($arr as $i => $value) { if ($i == $wordbooker_settings['wordbooker_extract_length']) { print '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_attribute">' . __("Post Attribute", 'wordbooker') . ' : </label>'; echo '<INPUT NAME="wordbooker_settings[wordbooker_attribute]" size=60 maxlength=240 value="' . stripslashes($wordbooker_settings["wordbooker_attribute"]) . '"><br />'; echo '<label for="wb_status_update">' . __("Facebook Status Attribute", 'wordbooker') . ' :</label>'; echo ' <INPUT NAME="wordbooker_settings[wordbooker_status_update_text]" size=60 maxlength=60 value="' . stripslashes($wordbooker_settings["wordbooker_status_update_text"]) . '"> '; echo '<br /><label for="wb_action_link">' . __("Action Link Option ", 'wordbooker') . ': </label><select id="wordbooker_actionlink" name="wordbooker_settings[wordbooker_actionlink]" >'; $arr = array(100 => "None ", 200 => __("Share Link ", 'wordbooker'), 300 => __("Read Full Article", 'wordbooker')); foreach ($arr as $i => $value) { if ($i == $wordbooker_settings['wordbooker_actionlink']) { print '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wordbooker_search_this_header">' . __("Enable Extended description for Share Link", 'wordbooker') . ' :</label> '; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_search_this_header]" ' . $checked_flag[$wordbooker_settings["wordbooker_search_this_header"]] . ' /><br />'; echo '<label for="wb_description_meta_length">' . __('Length of Description Meta-Tag', 'wordbooker') . ' :</label> <select id="wordbooker_description_meta_length" name="wordbooker_settings[wordbooker_description_meta_length]" >'; $arr = array(0 => "Disable", 150 => "150", 350 => "350 (Default)"); foreach ($arr as $i => $value) { if ($i == $wordbooker_settings['wordbooker_description_meta_length']) { print '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select><br />"; } function wordbooker_blog_facebook_options() { global $ol_flash, $wordbooker_settings, $_POST, $wp_rewrite, $user_ID, $wpdb, $blog_id, $wordbooker_user_settings_id; $fblike_action = array('recommend' => 'Recommend ', 'like' => 'Like '); $fblike_colorscheme = array('dark' => 'Dark', 'light' => 'Light'); $fblike_font = array('arial' => 'Arial', 'lucida grande' => 'Lucida grande ', 'segoe ui' => 'Segoe ui', 'tahoma' => 'Tahoma', 'trebuchet ms' => 'Trebuchet ms ', 'verdana' => 'Verdana'); $fblike_button = array('button_count' => 'Button Count ', 'standard' => 'Standard ', 'box_count' => 'Box Count'); $fblike_faces = array('false' => __('No', 'wordbooker'), 'true' => __('Yes', 'wordbooker')); $fblike_location = array('top' => __('Above Post ', 'wordbooker'), 'bottom' => __('Below Post', 'wordbooker'), 'coded' => __('Defined by theme template', 'wordbooker'), 'tagged' => __('Defined by Tag in post', 'wordbooker')); $checked_flag = array('on' => 'checked', 'off' => ''); $fblike_send = array('false' => __('No', 'wordbooker'), 'true' => __('Yes', 'wordbooker')); $fblike_send_combi = array('false' => __('No - use Send instead of Like', 'wordbooker'), 'true' => __('Yes - use both Like and Send', 'wordbooker')); echo '<label for="wb_facebook_like">' . __("Include a Facebook Like button in blog", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_like_button_show]" ' . $checked_flag[$wordbooker_settings["wordbooker_like_button_show"]] . ' ><br />'; echo '<label for="wb_facebook_like_front"> ' . __("Show Facebook Like button on front page", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_like_button_frontpage]" ' . $checked_flag[$wordbooker_settings["wordbooker_like_button_frontpage"]] . ' ><br />'; echo '<label for="wb_facebook_like_front"> ' . __("Show Facebook Like button on Category pages", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_like_button_category]" ' . $checked_flag[$wordbooker_settings["wordbooker_like_button_category"]] . ' ><br />'; echo '<label for="wb_facebook_like_page"> ' . __("Show Facebook Like button on Pages", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_like_button_page]" ' . $checked_flag[$wordbooker_settings["wordbooker_like_button_page"]] . ' ><br />'; echo '<label for="wb_facebook_like"> ' . __("Show Facebook Like button in each post", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_like_button_post]" ' . $checked_flag[$wordbooker_settings["wordbooker_like_button_post"]] . ' ><br />'; echo '<label for="wb_facebook_like"> ' . __("Don't show Facebook Like / Send Button on Sticky Posts", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_no_like_stick]" ' . $checked_flag[$wordbooker_settings["wordbooker_no_like_stick"]] . ' ><br />'; if (!is_numeric($wordbooker_settings['wordbooker_like_width']) || $wordbooker_settings['wordbooker_like_width'] < 0) { $wordbooker_settings['wordbooker_like_width'] = 250; } echo '<label for="wb_facebook_like_width"> ' . __("Width of Facebook Like box", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=text NAME="wordbooker_settings[wordbooker_like_width]" size="7"value="' . $wordbooker_settings["wordbooker_like_width"] . '" ><br />'; echo '<label for="wb_fblike_location"> ' . __('Facebook Like - Display Button ', 'wordbooker') . ' :</label> <select id="wordbooker_fblike_location" name="wordbooker_settings[wordbooker_fblike_location]" >'; foreach ($fblike_location as $i => $value) { if ($i == $wordbooker_settings['wordbooker_fblike_location']) { print '<option selected="yes" value="' . $i . '" >' . $fblike_location[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $fblike_location[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_fblike_action"> ' . __('Facebook Like - Verb to Display', 'wordbooker') . ' :</label> <select id="wordbooker_fblike_action" name="wordbooker_settings[wordbooker_fblike_action]" >'; foreach ($fblike_action as $i => $value) { if ($i == $wordbooker_settings['wordbooker_fblike_action']) { print '<option selected="yes" value="' . $i . '" >' . $fblike_action[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $fblike_action[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_fblike_colorscheme"> ' . __('Facebook Like - Colour Scheme', 'wordbooker') . ' :</label> <select id="wordbooker_fblike_colorscheme" name="wordbooker_settings[wordbooker_fblike_colorscheme]" >'; foreach ($fblike_colorscheme as $i => $value) { if ($i == $wordbooker_settings['wordbooker_fblike_colorscheme']) { print '<option selected="yes" value="' . $i . '" >' . $fblike_colorscheme[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $fblike_colorscheme[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_fblike_font"> ' . __('Facebook Like - Display Font', 'wordbooker') . ' :</label> <select id="wordbooker_fblike_font" name="wordbooker_settings[wordbooker_fblike_font]" >'; foreach ($fblike_font as $i => $value) { if ($i == $wordbooker_settings['wordbooker_fblike_font']) { print '<option selected="yes" value="' . $i . '" >' . $fblike_font[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $fblike_font[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_fblike_button"> ' . __('Facebook Like - Layout Style', 'wordbooker') . ' :</label> <select id="wordbooker_fblike_button" name="wordbooker_settings[wordbooker_fblike_button]" >'; foreach ($fblike_button as $i => $value) { if ($i == $wordbooker_settings['wordbooker_fblike_button']) { print '<option selected="yes" value="' . $i . '" >' . $fblike_button[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $fblike_button[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_fblike_faces"> ' . __('Facebook Like - Display Faces (Standard layout only)', 'wordbooker') . ' :</label> <select id="wordbooker_fblike_faces" name="wordbooker_settings[wordbooker_fblike_faces]" >'; foreach ($fblike_faces as $i => $value) { if ($i == $wordbooker_settings['wordbooker_fblike_faces']) { print '<option selected="yes" value="' . $i . '" >' . $fblike_faces[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $fblike_faces[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_fblike_send_combi"> ' . __('Combine Send with Like', 'wordbooker') . ' :</label> <select id="wordbooker_fblike_send_combi" name="wordbooker_settings[wordbooker_fblike_send_combi]" >'; foreach ($fblike_send_combi as $i => $value) { if ($i == $wordbooker_settings['wordbooker_fblike_send_combi']) { print '<option selected="yes" value="' . $i . '" >' . $fblike_send_combi[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $fblike_send_combi[$i] . '</option>'; } } echo "</select><br/> "; echo '<label for="wb_fblike_send"> ' . __('Facebook Send - Display Button', 'wordbooker') . ' :</label> <select id="wordbooker_fblike_send" name="wordbooker_settings[wordbooker_fblike_send]" >'; foreach ($fblike_send as $i => $value) { if ($i == $wordbooker_settings['wordbooker_fblike_send']) { print '<option selected="yes" value="' . $i . '" >' . $fblike_send[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $fblike_send[$i] . '</option>'; } } echo "</select><br /><hr><br />"; echo '<label for="wb_facebook_like_share">' . __("Include a Facebook Share button in blog", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_like_share_too]" ' . $checked_flag[$wordbooker_settings["wordbooker_like_share_too"]] . ' ><br />'; echo '<label for="wb_fbshare_location"> ' . __('Facebook Share - Display Button ', 'wordbooker') . ' :</label> <select id="wordbooker_fbshare_location" name="wordbooker_settings[wordbooker_fbshare_location]" >'; foreach ($fblike_location as $i => $value) { if ($i == $wordbooker_settings['wordbooker_fbshare_location']) { print '<option selected="yes" value="' . $i . '" >' . $fblike_location[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $fblike_location[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_facebook_share_front"> ' . __("Show Facebook Share button on front page", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_share_button_frontpage]" ' . $checked_flag[$wordbooker_settings["wordbooker_share_button_frontpage"]] . ' ><br />'; echo '<label for="wb_facebook_share_front"> ' . __("Show Facebook Share button on Category pages", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_share_button_category]" ' . $checked_flag[$wordbooker_settings["wordbooker_share_button_category"]] . ' ><br />'; echo '<label for="wb_facebook_share_page"> ' . __("Show Facebook Share button on Pages", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_share_button_page]" ' . $checked_flag[$wordbooker_settings["wordbooker_share_button_page"]] . ' ><br />'; echo '<label for="wb_facebook_share_post"> ' . __("Show Facebook Share button in each post", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_share_button_post]" ' . $checked_flag[$wordbooker_settings["wordbooker_share_button_post"]] . ' ><br />'; echo '<label for="wb_facebook_like"> ' . __("Don't show Facebook Share button on Sticky Posts", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_no_share_stick]" ' . $checked_flag[$wordbooker_settings["wordbooker_no_share_stick"]] . ' ><br />'; echo "<hr><br />"; echo '<label for="wb_facebook_gravatars">' . __("Do not replace Gravtars with Facebook Photos", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_no_facebook_gravatars]" ' . $checked_flag[$wordbooker_settings["wordbooker_no_facebook_gravatars"]] . ' ><br />'; /* echo "<hr><br />"; echo '<label for="wb_facebook_time">'.__("Use Frictionless sharing / Timeline instead of Share", 'wordbooker'). ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_time_button]" '.$checked_flag[$wordbooker_settings["wordbooker_time_button"]].' ><br />'; echo '<label for="wb_fbread_location"> '.__('Facebook Read - Display Button ', 'wordbooker').' :</label> <select id="wordbooker_fbread_location" name="wordbooker_settings[wordbooker_fbread_location]" >'; foreach ($fblike_location as $i => $value) { if ($i==$wordbooker_settings['wordbooker_fbread_location']){ print '<option selected="yes" value="'.$i.'" >'.$fblike_location[$i].'</option>';} else {print '<option value="'.$i.'" >'.$fblike_location[$i].'</option>';}} echo "</select><br />"; */ } function wordbooker_blog_comment_options() { global $ol_flash, $wordbooker_settings, $_POST, $wp_rewrite, $user_ID, $wpdb, $blog_id, $wordbooker_user_settings_id; $checked_flag = array('on' => 'checked', 'off' => ''); $fbcomment_colorscheme = array('dark' => 'Dark', 'light' => 'Light'); echo "<b>" . __('Wordpress Comment handling Options', 'wordbooker') . "</b><br />"; $scheds1['Never'] = array('interval' => 999999999, 'display' => __('Never ', 'wordbooker')); $scheds1['Manual'] = array('interval' => 999999999, 'display' => __('Manual Polling ', 'wordbooker')); $scheds2 = wp_get_schedules(); $scheds = array_merge($scheds1, $scheds2); echo '<label for="wb_comment_cron">' . __('Process Comments ', 'wordbooker') . ' :</label> <select id="wordbooker_comment_cron" name="wordbooker_settings[wordbooker_comment_cron]" >'; foreach (array_keys($scheds) as $ss) { if ($ss == $wordbooker_settings['wordbooker_comment_cron']) { print '<option selected="yes" value="' . $ss . '" >' . $scheds[$ss]['display'] . ' </option>'; } else { print '<option value="' . $ss . '" >' . $scheds[$ss]['display'] . ' </option>'; } } echo "</select> "; if ($wordbooker_settings['wordbooker_comment_cron'] != 'Never') { echo " (" . __("Next Scheduled fetch is in", 'wordbooker') . ' : ' . date('H:i', wp_next_scheduled('wb_comment_job') - time()) . ')'; } echo '<br /><label for="wb_publish_comment_handling">' . __("Enable Comment processing", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_comment_handling]" ' . $checked_flag[$wordbooker_settings["wordbooker_comment_handling"]] . ' /><br />'; echo '<label for="wb_import_comment"> ' . __("Disable Comment Importing", 'wordbooker') . ': </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_comment_pul]" ' . $checked_flag[$wordbooker_settings["wordbooker_comment_pull"]] . '/> <br />'; echo '<label for="wb_import_comment"> ' . __("Disable Comment Exporting", 'wordbooker') . ': </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_comment_push]" ' . $checked_flag[$wordbooker_settings["wordbooker_comment_push"]] . '/> <br />'; if (!isset($wordbooker_settings["wordbooker_comment_attribute"])) { $wordbooker_settings["wordbooker_comment_attribute"] = __("[Comment imported from blog]", 'wordbooker'); } echo '<label for="wb_cooment_attribute">' . __('Comment Tag', 'wordbooker') . ' : </label>'; echo '<INPUT NAME="wordbooker_settings[wordbooker_comment_attribute]" size=60 maxlength=240 value="' . stripslashes($wordbooker_settings["wordbooker_comment_attribute"]) . '"><br />'; if (strlen($wordbooker_settings['wordbooker_comment_post_format']) < 2) { $wordbooker_settings['wordbooker_comment_post_format'] = "%tag%"; } echo '<p class="DataForm"><label for="wb_cooment_post_format">' . __('Facebook Comment Structure', 'wordbooker') . ' : </label>'; echo "<TEXTAREA NAME='wordbooker_settings[wordbooker_comment_post_format]' ROWS=8 COLS=60>" . stripslashes($wordbooker_settings["wordbooker_comment_post_format"]) . "</TEXTAREA><br /></p>"; echo '<label for="wb_comment_email">' . __("Assign this email address to comments", 'wordbooker') . ' :</label>'; echo ' <INPUT NAME="wordbooker_settings[wordbooker_comment_email]" size=60 maxlength=60 value="' . stripslashes($wordbooker_settings["wordbooker_comment_email"]) . '"> <br />'; echo '<label for="wb_import_comment">' . __("Import Comments from Facebook for new Wordbooker Posts", 'wordbooker') . ': </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_comment_get]" ' . $checked_flag[$wordbooker_settings["wordbooker_comment_get"]] . '/> <br />'; echo '<label for="wb_publish_comment_push">' . __("Push Comments up to Facebook for new posts", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_comment_put]" ' . $checked_flag[$wordbooker_settings["wordbooker_comment_put"]] . ' /> <br /> '; echo '<label for="wb_publish_comment_approve">' . __("Auto Approve imported comments", 'wordbooker') . ' :</label> '; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_comment_approve]" ' . $checked_flag[$wordbooker_settings["wordbooker_comment_approve"]] . ' /><br />'; if ($wordbooker_settings['wordbooker_comment_cron'] != 'Never') { echo '<br /><input type="submit" value="' . __("Run Comment Handling Now", 'wordbooker') . '" name="mcp" class="button-primary" />'; } echo "<hr><br /><b>" . __('Facebook Comment Box Options', 'wordbooker') . "</b><br /><br />"; echo '<label for="wb_use_fb_comments">' . __("Enable Facebook Comment handling ", 'wordbooker') . ' : </label> '; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_use_fb_comments]" ' . $checked_flag[$wordbooker_settings["wordbooker_use_fb_comments"]] . ' /> <br />'; $fb_comment_location = array('bottom' => __('Created in line below post', 'wordbooker'), 'coded' => __('Defined by theme template', 'wordbooker'), 'tagged' => __('Defined by Tag in post', 'wordbooker')); echo '<label for="wb_comment_location">' . __('Comment placing ', 'wordbooker') . ' :</label> <select id="wordbooker_comment_location" name="wordbooker_settings[wordbooker_comment_location]" >'; foreach ($fb_comment_location as $i => $value) { if ($i == $wordbooker_settings['wordbooker_comment_location']) { print '<option selected="yes" value="' . $i . '" >' . $fb_comment_location[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $fb_comment_location[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_comment_colorscheme">' . __('Comment Box - Colour Scheme', 'wordbooker') . ' :</label> <select id="wb_comment_colorscheme" name="wordbooker_settings[wb_comment_colorscheme]" >'; foreach ($fbcomment_colorscheme as $i => $value) { if ($i == $wordbooker_settings['wb_comment_colorscheme']) { print '<option selected="yes" value="' . $i . '" >' . $fbcomment_colorscheme[$i] . '</option>'; } else { print '<option value="' . $i . '" >' . $fbcomment_colorscheme[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_use_fb_comments_admin">' . __("All Wordbooker users can moderate comments ", 'wordbooker') . ' : </label> '; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_fb_comments_admin]" ' . $checked_flag[$wordbooker_settings["wordbooker_fb_comments_admin"]] . ' /> <br />'; if (!defined('WORDBOOKER_PREMIUM') || defined('WORDBOOKER_MULTI') && WORDBOOKER_MULTI == true) { echo '<label for="fb_comment_app_id">' . __("Use this Facebook Application ID for comment moderation", 'wordbooker') . ' :</label>'; echo ' <INPUT NAME="wordbooker_settings[fb_comment_app_id]" size=20 maxlength=20 value="' . stripslashes($wordbooker_settings["fb_comment_app_id"]) . '"> <br />'; } echo '<label for="fb_comment_app_id">' . __("Width of comment box", 'wordbooker') . ' :</label>'; if (strlen($wordbooker_settings["fb_comment_box_size"]) <= 2) { $wordbooker_settings["fb_comment_box_size"] = 350; } if ($wordbooker_settings["fb_comment_box_size"] < 350) { $wordbooker_settings["fb_comment_box_size"] = 350; } echo ' <INPUT NAME="wordbooker_settings[fb_comment_box_size]" size=3 maxlength=3 value="' . stripslashes($wordbooker_settings["fb_comment_box_size"]) . '"> <br />'; echo '<label for="fb_comment_count">' . __("Number of comments to display", 'wordbooker') . ' :</label>'; if (strlen($wordbooker_settings["fb_comment_box_count"]) < 1) { $wordbooker_settings["fb_comment_box_count"] = 20; } if ($wordbooker_settings["fb_comment_box_count"] < 2) { $wordbooker_settings["fb_comment_box_count"] = 2; } echo ' <INPUT NAME="wordbooker_settings[fb_comment_box_count]" size=3 maxlength=3 value="' . stripslashes($wordbooker_settings["fb_comment_box_count"]) . '"> <br />'; echo '<label for="wordbooker_comment_notify">' . __('Enable notification of new comments', 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[fb_comment_box_notify]" ' . $checked_flag[$wordbooker_settings["fb_comment_box_notify"]] . '><br />'; echo '<label for="wordbooker_use_facebook_comments">' . __('Facebook comment handling should be enabled on new posts', 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_use_facebook_comments]" ' . $checked_flag[$wordbooker_settings["wordbooker_use_facebook_comments"]] . '><br />'; } function wordbooker_blog_advanced_options() { global $ol_flash, $wordbooker_settings, $_POST, $wp_rewrite, $user_ID, $wpdb, $blog_id, $wordbooker_user_settings_id, $table_prefix; $checked_flag = array('on' => 'checked', 'off' => ''); if (intval(WORDBOOKER_WP_VERSION) > 30) { $admin_users = get_users(array('role' => 'administrator')); echo '<label for="wordbooker_diagnostic admin">' . __('User who should get Admin level diagnostics', 'wordbooker') . ' :</label> <select id="wordbooker_diagnostic_admin" name="wordbooker_settings[wordbooker_diagnostic_admin]" >'; foreach ($admin_users as $adminuser) { if ($adminuser->ID == $wordbooker_settings['wordbooker_diagnostic_admin']) { print '<option selected="yes" value="' . $adminuser->ID . '" >' . $adminuser->display_name . ' ( ' . $adminuser->user_login . ' ) </option>'; } else { print '<option value="' . $adminuser->ID . '" >' . $adminuser->display_name . ' ( ' . $adminuser->user_login . ' ) </option>'; } } echo "</select><br />"; } if (!isset($wordbooker_settings['wordbooker_advanced_diagnostics_level'])) { $wordbooker_settings['wordbooker_advanced_diagnostics_level'] = 10; } $arr = array(0 => __("Show Everything and I mean everything", 'wordbooker'), 10 => __("Show everything but Cache Diagnostics", 'wordbooker'), 90 => __("Show result of major actions", 'wordbooker'), 99 => __("Don't show anything apart from Fatal errors", 'wordbooker'), 999 => __("Disabled (Show nothing at all)", 'wordbooker')); echo '<p><label for="wb_advanced_diagnostics_level">' . __("Post Diagnostics display level", 'wordbooker') . ' : </label><select id="wordbooker_advanced_diagnostics_level" name="wordbooker_settings[wordbooker_advanced_diagnostics_level]" >'; foreach ($arr as $i => $value) { if ($i == $wordbooker_settings['wordbooker_advanced_diagnostics_level']) { echo '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { echo '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select><br /></P><p>"; echo '<label for="wb_wordbooker_diag_clear">' . __("Clear detailed diagnostics on successful post", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_clear_diagnostics]" ' . $checked_flag[$wordbooker_settings["wordbooker_clear_diagnostics"]] . ' ></P><p>'; echo '<label for="wb_wordbooker_disable_shorties">' . __("Disable the use of short URLs in links posted to Facebook", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_disable_shorties]" ' . $checked_flag[$wordbooker_settings["wordbooker_disable_shorties"]] . ' ></P><p>'; echo '<label for="wb_wordbooker_fb_rec_act">' . __("Include FB Recent activity on Wordbooker Options page", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_fb_rec_act]" ' . $checked_flag[$wordbooker_settings["wordbooker_fb_rec_act"]] . ' ></P><p>'; echo '<label for="wb_facebook_iframe">' . __("Use Iframes instead of FBXML to render FB features", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_iframe]" ' . $checked_flag[$wordbooker_settings["wordbooker_iframe"]] . ' ></P><p>'; echo '<label for="wordbooker_use_url_not_slug">' . __("Use Site URL not Blog Description in Wall Posts", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_use_url_not_slug]" ' . $checked_flag[$wordbooker_settings["wordbooker_use_url_not_slug"]] . ' ></P><p>'; echo '<label for="wb_meta_tag_scan">' . __("Check the following Custom Post Meta tags for images", 'wordbooker') . ' :</label>'; echo ' <INPUT NAME="wordbooker_settings[wordbooker_meta_tag_scan]" size=60 maxlength=129 value="' . stripslashes($wordbooker_settings["wordbooker_meta_tag_scan"]) . '"/></P><p> '; echo '<label for="wb_meta_tag_thumb">' . __("Use Image from Custom Meta instead of Featured Image for Open Graph image", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_meta_tag_thumb]" ' . $checked_flag[$wordbooker_settings["wordbooker_meta_tag_thumb"]] . ' /></P><p>'; echo '<label for="wb_wordbooker_default_image">' . __("Default Open Graph image to use for posts", 'wordbooker') . ' :</label>'; echo ' <INPUT NAME="wordbooker_settings[wb_wordbooker_default_image]" size=60 maxlength=120 value="' . stripslashes($wordbooker_settings["wb_wordbooker_default_image"]) . '"></P><p>'; echo '<label for="wb_facebook_use_this_image">' . __("Use the above image instead of a blank for posts with no image", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_use_this_image]" ' . $checked_flag[$wordbooker_settings["wordbooker_use_this_image"]] . ' ></P><p>'; echo '<label for="wb_wordbooker_disable_ogtags">' . __("Disable in-line production of OpenGraph Tags", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_fb_disable_og]" ' . $checked_flag[$wordbooker_settings["wordbooker_fb_disable_og"]] . ' ></P><p>'; echo '<label for="wb_fake_publish">' . __("Only Pretend to Publish on Facebook - TEST MODE", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_fake_publish]" ' . $checked_flag[$wordbooker_settings["wordbooker_fake_publish"]] . ' /></P><p>'; echo '<label for="wb_disable">' . __("Disable ALL Wordbooker functionality", 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_settings[wordbooker_disabled]" ' . $checked_flag[$wordbooker_settings["wordbooker_disabled"]] . ' /></P>'; echo '<input type="hidden" name="wordbooker_settings[wordbooker_page_post]" value="-100" />'; echo '<input type="hidden" name="wordbooker_settings[wordbooker_orandpage]" value="2" />'; } function wordbooker_user_level_options() { global $ol_flash, $wordbooker_settings, $_POST, $wp_rewrite, $user_ID, $wpdb, $blog_id, $wordbooker_user_settings_id, $user_ID, $wordbooker_hook; id; # USER LEVEL OPTIONS $checked_flag = array('on' => 'checked', 'off' => ''); $wordbookeruser_settings = get_usermeta($user_ID, $wordbooker_user_settings_id); # Set a couple of options that we really need. if (!isset($wordbookeruser_settings['wordbooker_orandpage'])) { $wordbookeruser_settings['wordbooker_orandpage'] = 2; } if (!isset($wordbookeruser_settings['wordbooker_publish_default'])) { $wordbookeruser_settings['wordbooker_publish_default'] = $wordbooker_settings['wordbooker_publish_default']; } echo '<div class="wrap">'; echo '<h3>' . __('User Level Settings', 'wordbooker') . '</h3>'; _e("If set, these options will override the Blog Level options for this user", 'wordbooker'); echo '<br /><br /><form action="" method="post">'; echo '<input type="hidden" name="token" value="' . wbs_retrieve_hash() . '" />'; echo '<input type="hidden" name="user_meta" value="true" />'; wp_nonce_field('wordbooker_ul_options'); wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); echo '<label for="wb_publish_post_default">' . __('Default Publish Post to Facebook', 'wordbooker') . ' : </label>'; echo '<select id="wordbooker_publish_post_default" name="wordbooker_publish_post_default" >'; $arr = array(0 => __("Same as Blog", 'wordbooker'), 100 => __("No", 'wordbooker'), 200 => "Yes"); foreach ($arr as $i => $value) { if ($i == $wordbookeruser_settings['wordbooker_publish_post_default']) { echo '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { echo '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_publish_page_default">' . __('Default Publish Page to Facebook', 'wordbooker') . ' : </label>'; echo '<select id="wordbooker_publish_page_default" name="wordbooker_publish_page_default" >'; $arr = array(0 => __("Same as Blog", 'wordbooker'), 100 => __("No", 'wordbooker'), 200 => "Yes"); foreach ($arr as $i => $value) { if ($i == $wordbookeruser_settings['wordbooker_publish_page_default']) { echo '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { echo '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select><br />"; echo '<input type="hidden" name="wordbooker_page_post" value="-100" />'; echo '<input type="hidden" name="wordbooker_orandpage" value="2" />'; # Get the list of pages this user is an admin for $result = $wpdb->get_row("select pages from " . WORDBOOKER_USERDATA . " where user_id=" . $user_ID); $fanpages = unserialize($result->pages); $sql = "select wpu.ID,wpu.display_name,facebook_id from {$wpdb->users} wpu," . WORDBOOKER_USERDATA . " wud where wpu.ID=wud.user_id and wud.user_id=" . $user_ID; $wb_users = $wpdb->get_results($sql); $fanpages2 = $fanpages; $fanpages[] = array('id' => 'PW:' . $wb_users[0]->facebook_id, 'name' => "Personal Wall"); if (!isset($wordbookeruser_settings["wordbooker_primary_target"])) { $wordbookeruser_settings["wordbooker_primary_target"] = 'PW:' . $wb_users[0]->facebook_id; } $have_fan_pages = 0; if (count($fanpages) > 1) { echo '<p><label for="wb_primary_target">' . __('Post to the following Wall', 'wordbooker') . ' : </label>'; echo '<select id="wordbooker_primary_target" name="wordbooker_primary_target" >'; $option = ""; foreach ($fanpages as $fan_page) { if (strlen($fan_page['name']) >= 2) { if ($fan_page['id'] == $wordbookeruser_settings["wordbooker_primary_target"]) { $option .= '<option selected="yes" value=' . $fan_page['id'] . '>'; } else { $option .= '<option value=' . $fan_page[id] . '>'; } $option .= $fan_page['name'] . " (" . substr($fan_page['id'], 3) . ") "; $option .= '</option>'; } } echo $option; echo '</select> '; $arr = array(1 => __("As a Wall Post", 'wordbooker'), 2 => __("As a Note", 'wordbooker'), 3 => __("As a Status Update", 'wordbooker'), 4 => __("As a Link", 'wordbooker')); echo '<select id="wordbooker_primary_type" name="wordbooker_primary_type" >'; foreach ($arr as $i => $value) { if ($i == $wordbookeruser_settings['wordbooker_primary_type']) { echo '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { echo '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo '</select> <INPUT TYPE=CHECKBOX NAME="wordbooker_primary_active" ' . $checked_flag[$wordbookeruser_settings["wordbooker_primary_active"]] . '></p><p>'; } else { echo '<p><label for="wb_primary_target">' . __('Post to my Personal Wall', 'wordbooker') . ' : </label> '; echo '<input type="hidden" name="wordbooker_primary_target" value="PW:' . $wb_users[0]->facebook_id . '" />'; echo '<select id="wordbooker_primary_type" name="wordbooker_primary_type" >'; foreach ($arr as $i => $value) { if ($i == $wordbookeruser_settings['wordbooker_primary_type']) { echo '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { echo '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo ' <INPUT TYPE=CHECKBOX NAME="wordbooker_primary_active" ' . $checked_flag[$wordbookeruser_settings["wordbooker_primary_active"]] . '></p><p>'; } if (is_array($fanpages2)) { $have_fan_pages = 1; echo '<label for="wb_secondary_target">' . __('Post to the following Wall', 'wordbooker') . ' : </label>'; echo '<select id="wordbooker_secondary_target" name="wordbooker_secondary_target" >'; $option = ""; foreach ($fanpages2 as $fan_page) { if (strlen($fan_page['name']) >= 2) { if ($fan_page['id'] == $wordbookeruser_settings["wordbooker_secondary_target"]) { $option .= '<option selected="yes" value=' . $fan_page['id'] . '>'; } else { $option .= '<option value=' . $fan_page[id] . '>'; } $option .= $fan_page['name'] . " (" . substr($fan_page['id'], 3) . ") "; $option .= '</option>'; } } echo $option; echo '</select> '; echo '<select id="wordbooker_secondary_type" name="wordbooker_secondary_type" >'; foreach ($arr as $i => $value) { if ($i == $wordbookeruser_settings['wordbooker_secondary_type']) { echo '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { echo '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select>"; echo ' <INPUT TYPE=CHECKBOX NAME="wordbooker_secondary_active" ' . $checked_flag[$wordbookeruser_settings["wordbooker_secondary_active"]] . '></p><P>'; } if (!isset($wordbookeruser_settings['wordbooker_extract_length'])) { $wordbookeruser_settings['wordbooker_extract_length'] = $wordbooker_settings['wordbooker_extract_length']; } echo '<label for="wb_extract_length">' . __('Length of Extract', 'wordbooker') . ' : </label><select id="wordbooker_extract_length" name="wordbooker_extract_length" >'; $arr = array(10 => "10", 20 => "20", 50 => "50", 100 => "100", 120 => "120", 150 => "150", 175 => "175", 200 => "200", 250 => "250", 256 => __("256 (Default) ", 'wordbooker'), 270 => "270", 300 => "300", 350 => "350", 400 => "400", 500 => "500", 600 => "600", 700 => "700", 800 => "800", 900 => "900"); foreach ($arr as $i => $value) { if ($i == $wordbookeruser_settings['wordbooker_extract_length']) { echo '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { echo '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wb_status_update">' . __('Facebook Status Text', 'wordbooker') . ' : </label> '; echo '<INPUT NAME="wordbooker_status_update_text" size=60 maxlength=60 value="' . stripslashes($wordbookeruser_settings["wordbooker_status_update_text"]) . '"> '; echo '</select><br />'; echo '<label for="wb_attribute">' . __('Post Attribute', 'wordbooker') . ' : </label>'; echo '<INPUT NAME="wordbooker_attribute" size=60 maxlength=240 value="' . stripslashes($wordbookeruser_settings["wordbooker_attribute"]) . '"><br />'; echo '<label for="wb_action_link">' . __('Action Link Option', 'wordbooker') . ' : </label><select id="wordbooker_actionlink" name="wordbooker_actionlink" >'; $arr = array(0 => __("Same as Blog", 'wordbooker'), 100 => __("None", 'wordbooker'), 200 => __("Share Link", 'wordbooker'), 300 => __("Read Full Article", 'wordbooker')); foreach ($arr as $i => $value) { if ($i == $wordbookeruser_settings['wordbooker_actionlink']) { echo '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { echo '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select><br />"; echo '<label for="wordbooker_search_this_header">' . __('Enable Extended description for Share Link', 'wordbooker') . ' : </label> '; echo '<select id="wordbooker_search_this_header" name="wordbooker_search_this_header" >'; $arr = array(0 => __("Same as Blog", 'wordbooker'), 100 => __("No", 'wordbooker'), 200 => __("Yes", 'wordbooker')); foreach ($arr as $i => $value) { if ($i == $wordbookeruser_settings['wordbooker_search_this_header']) { echo '<option selected="yes" value="' . $i . '" >' . $arr[$i] . '</option>'; } else { echo '<option value="' . $i . '" >' . $arr[$i] . '</option>'; } } echo "</select><br />"; if (function_exists('get_the_post_thumbnail')) { echo '<label for="wb_thumb_only">' . __('Use Post Thumbnail only', 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_thumb_only" ' . $checked_flag[$wordbookeruser_settings["wordbooker_thumb_only"]] . '><br />'; } echo '<label for="wb_use_extract">' . __('Use Post Excerpt', 'wordbooker') . ' : </label>'; echo '<INPUT TYPE=CHECKBOX NAME="wordbooker_use_excerpt" ' . $checked_flag[$wordbookeruser_settings["wordbooker_use_excerpt"]] . '><br />'; echo '<label for="wb_status_id">' . __('Show Status for', 'wordbooker') . ' : </label> <select name="wordbooker_status_id" ><option selected="yes" value=-100>' . __('My Own Profile', 'wordbooker') . ' </option>'; $option = ""; if ($have_fan_pages == 1) { foreach ($fanpages as $fan_page) { if (substr($fan_page[id], 0, 2) != "GW") { if ($fan_page[id] == $wordbookeruser_settings["wordbooker_status_id"]) { $option .= '<option selected="yes" value=' . $fan_page[id] . '>'; } else { $option .= '<option value=' . $fan_page[id] . '>'; } $option .= $fan_page[name] . " "; $option .= '</option>'; } } echo $option; } echo '</select><br />'; _e('Disable Facebook User information in Status', 'wordbooker'); echo ' : <INPUT TYPE=CHECKBOX NAME="wordbooker_disable_status" ' . $checked_flag[$wordbookeruser_settings["wordbooker_disable_status"]] . '><br /><p>'; echo '<input type="submit" value="' . __("Save User Options", 'wordbooker') . '" name="swbus" class="button-primary" /> <input type="submit" name="rwbus" value="' . __("Reset to Blog Defaults", 'wordbooker') . '" class="button-primary" /></form><br /></div><hr>'; } // Lets poll if they want to - we only poll for this user if (isset($wordbooker_settings["wordbooker_comment_poll"]) && ADVANCED_DEBUG) { $dummy = wordbooker_poll_facebook($user_ID); } wordbooker_blog_level_options(); wordbooker_user_level_options(); wordbooker_render_errorlogs(); wordbooker_status($user_ID); wordbooker_option_status($wbuser); echo "<br /><hr><h3>"; _e("Donate", 'wordbooker'); echo "</h3>"; if (defined('WORDBOOKER_PREMIUM')) { _e("You're using the Premium options in Wordbooker. You really should contribute something to the support and development of this plugin. Please provide your FB Id number and your website when making payment so your details can be added to the <a href='http://wordbooker.tty.org.uk/thanks/'>'Thanks'</a> list on the web site", 'wordbooker'); } _e("If you've found this extension useful then please feel free to donate to its support and future development. Please provide your FB Id number and your website when making payment so your details can be added to the <a href='http://wordbooker.tty.org.uk/thanks/'>'Thanks'</a> page on the Website", 'wordbooker'); ?> <br /><br /> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHPwYJKoZIhvcNAQcEoIIHMDCCBywCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYBS1CS6j8gSPzUcHkKZ5UYKF2n97UX8EhSB+QgoExXlfJWLo6S7MJFvuzay0RhJNefA9Y1Jkz8UQahqaR7SuIDBkz0Ys4Mfx6opshuXQqxp17YbZSUlO6zuzdJT4qBny2fNWqutEpXe6GkCopRuOHCvI/Ogxc0QHtIlHT5TKRfpejELMAkGBSsOAwIaBQAwgbwGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIitf6nEQBOsSAgZgWnlCfjf2E3Yekw5n9DQrNMDoUZTckFlqkQaLYLwnSYbtKanICptkU2fkRQ3T9tYFMhe1LhAuHVQmbVmZWtPb/djud5uZW6Lp5kREe7c01YtI5GRlK63cAF6kpxDL9JT2GH10Cojt9UF15OH46Q+2V3gu98d0Lad77PXz3V1XY0cto29buKZZRfGG8u9NfpXZjv1utEG2CP6CCA4cwggODMIIC7KADAgECAgEAMA0GCSqGSIb3DQEBBQUAMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbTAeFw0wNDAyMTMxMDEzMTVaFw0zNTAyMTMxMDEzMTVaMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwUdO3fxEzEtcnI7ZKZL412XvZPugoni7i7D7prCe0AtaHTc97CYgm7NsAtJyxNLixmhLV8pyIEaiHXWAh8fPKW+R017+EmXrr9EaquPmsVvTywAAE1PMNOKqo2kl4Gxiz9zZqIajOm1fZGWcGS0f5JQ2kBqNbvbg2/Za+GJ/qwUCAwEAAaOB7jCB6zAdBgNVHQ4EFgQUlp98u8ZvF71ZP1LXChvsENZklGswgbsGA1UdIwSBszCBsIAUlp98u8ZvF71ZP1LXChvsENZklGuhgZSkgZEwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAgV86VpqAWuXvX6Oro4qJ1tYVIT5DgWpE692Ag422H7yRIr/9j/iKG4Thia/Oflx4TdL+IFJBAyPK9v6zZNZtBgPBynXb048hsP16l2vi0k5Q2JKiPDsEfBhGI+HnxLXEaUWAcVfCsQFvd2A1sxRr67ip5y2wwBelUecP3AjJ+YcxggGaMIIBlgIBATCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTA5MTAyODE0MzM1OVowIwYJKoZIhvcNAQkEMRYEFIf+6qkVI7LG/jPumIrQXIOhI4hJMA0GCSqGSIb3DQEBAQUABIGAdpAB4Mj4JkQ6K44Xxp4Da3GsRCeiLr2LMqrAgzF8jYGgV9zjf7PXxpC8XJTVC7L7oKDtoW442T9ntYj6RM/hSjmRO2iaJq0CAZkz2sPZWvGlnhYrpEB/XB3dhmd2nGhUMSXbtQzZvR7JMVoPR0zxL/X/Hfj6c+uF7BxW8xTSBqw=-----END PKCS7-----"> <input type="image" src="https://www.paypal.com/en_US/GB/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online."> <img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1"> </form><br /><br /><hr><h3> <?php wordbooker_option_support(); ?> <script type="text/javascript"> //<![CDATA[ jQuery(document).ready( function($) { // close postboxes that should be closed $('.if-js-closed').removeClass('if-js-closed').addClass('closed'); // postboxes setup //save_postboxes_state('<?php echo $wordbooker_hook; ?> '); postboxes.add_postbox_toggles('<?php echo $wordbooker_hook; ?> '); }); //]]> </script> <?php } else { wordbooker_option_setup($wbuser); wordbooker_render_errorlogs(); wordbooker_option_support(); } }
/** * bp_media_galleries_remove_data() * * It's always wise to clean up after a user is deleted. This stops the database from filling up with * redundant information. */ function bp_media_galleries_remove_data($user_id) { /* You'll want to run a function here that will delete all information from any component tables for this $user_id */ BP_Media_Galleries_Gallery::delete_by_user_id($user_id); BP_Media_Galleries_Media::delete_by_user_id($user_id); /* Remember to remove usermeta for this component for the user being deleted */ delete_usermeta($user_id, 'bp_media_galleries_some_setting'); do_action('bp_media_galleries_remove_data', $user_id); }
<?php try { if (!IDMObject::authZ('permission', 'ape_wp_email_reset')) { throw new Exception('You are not authorized to reset profiles.'); } require_once '/web/connect.plymouth.edu/wp-includes/registration.php'; $person = new PSUPerson($_GET['identifier']); if (!$person->pidm) { throw new Exception('Could not load person for pidm: ' . $_GET['pidm']); } //end if $user = get_userdatabypidm($person->pidm); update_usermeta($user->ID, 'psuname', $person->login_name); delete_usermeta($user->ID, 'ac_pwreset'); $response['message'] = 'WP psuname has been synched.'; $email = trim($_GET['email']); if ($email) { if ($_GET['type'] == 'primary') { $user_data = array('ID' => $user->ID, 'user_email' => $email); $which = "Email"; $old_email = $user->user_email; $result = wp_update_user((array) $user_data); } else { $which = "Alt. email"; $old_email = $user->email_alt; $result = update_usermeta($user->ID, 'email_alt', $email); } if ($result) { $response['message'] .= sprintf(' %s changed from "%s" to "%s"', $which, $old_email, $email); }
function bp_core_delete_avatar() { $user_id = get_current_user_id(); $old_v1 = get_usermeta($user_id, 'bp_core_avatar_v1_path'); $old_v2 = get_usermeta($user_id, 'bp_core_avatar_v2_path'); delete_usermeta($user_id, 'bp_core_avatar_v1_path'); delete_usermeta($user_id, 'bp_core_avatar_v2_path'); delete_usermeta($user_id, 'bp_core_avatar_v1'); delete_usermeta($user_id, 'bp_core_avatar_v2'); // Remove the actual images @unlink($old_v1); @unlink($old_v2); do_action('bp_core_delete_avatar', $user_id, $old_v1, $old_v2); }
/** * Updates ldap_auth user meta value based on option selected on the edit user form */ function wpmuUserFormLdapOptionUpdate() { global $user_id, $current_user; if ($user_id == 1 || !is_super_admin()) { return; } if ($_POST['ldapAccountType'] == 'LDAP') { update_usermeta($user_id, 'ldap_login', 'true'); } else { delete_usermeta($user_id, 'ldap_login'); } }
function tdomf_uninstall() { tdomf_reset_options(); echo "<span style='width:200px;'>"; _e("Removing info from all users (this may take a few minutes depending on number of users)... ", "tdomf"); echo "</span>"; $users = tdomf_get_all_users(); foreach ($users as $user) { delete_usermeta($user->ID, TDOMF_KEY_FLAG); delete_usermeta($user->ID, TDOMF_KEY_STATUS); } echo "<span style='color:green;'>"; _e("DONE", "tdomf"); echo "</span><br/>"; // This includes v0.6 options! // echo "<span style='width:200px;'>"; _e("Removing info from all posts (this may take a few minutes depending on number of posts)... ", "tdomf"); echo "</span>"; $posts = tdomf_get_all_posts(); foreach ($posts as $post) { delete_option(TDOMF_NOTIFY . $post->ID); delete_post_meta($post->ID, TDOMF_KEY_NOTIFY_EMAIL); delete_post_meta($post->ID, TDOMF_KEY_FLAG); delete_post_meta($post->ID, TDOMF_KEY_NAME); delete_post_meta($post->ID, TDOMF_KEY_EMAIL); delete_post_meta($post->ID, TDOMF_KEY_WEB); delete_post_meta($post->ID, TDOMF_KEY_IP); delete_post_meta($post->ID, TDOMF_KEY_USER_ID); delete_post_meta($post->ID, TDOMF_KEY_USER_NAME); delete_post_meta($post->ID, TDOMF_KEY_LOCK); } echo "<span style='color:green;'>"; _e("DONE", "tdomf"); echo "</span><br/>"; }
function wpu_map_killusermeta($intID) { //update usermeta on WP side if (function_exists('delete_user_meta')) { @delete_user_meta($intID, 'phpbb_userid'); @delete_user_meta($intID, 'phpbb_userLogin'); } else { @delete_usermeta($intID, 'phpbb_userid'); @delete_usermeta($intID, 'phpbb_userLogin'); } }
function ymind_admin_update() { $return = false; if (isset($_GET['unlock'])) { update_usermeta($_GET['unlock'], 'ymind_locked_out', 0); delete_usermeta($_GET['unlock'], 'ymind_activation_key'); $msg = '' . __('User has now been unlocked', 'ymind') . '.'; ymind_display_message($msg); } if (isset($_POST['submit'])) { $error = array(); $numerical_fields = array('timeout_logins' => '' . __('Lockout Login Count', 'ymind') . '', 'timeout_minutes' => '' . __('Lockout Login Minutes', 'ymind') . '', 'lockout_minutes' => '' . __('Lockout Minutes', 'ymind') . ''); $textual_fields = array('new_url' => '' . __('Redirect URL', 'ymind') . '', 'mail_subject' => '' . __('Email Subject', 'ymind') . '', 'mail_message' => '' . __('Email Message', 'ymind') . '', 'login_error' => '' . __('Login Error', 'ymind') . '', 'activate_redirect' => '' . __('Activation Redirect', 'ymind') . ''); if ($_POST['email_offender'] == 0 && $_POST['timeout_minutes'] > $_POST['lockout_minutes']) { $error[] = '' . __('Locked out minutes must be greater than the number of minutes it takes to lock someone out.', 'ymind') . ''; } foreach ($numerical_fields as $key => $label) { if (!is_numeric($_POST[$key])) { $error[] = '' . __('Expecting a number for', 'ymind') . ' ' . $label; } } foreach ($textual_fields as $key => $label) { if (is_numeric($_POST[$key])) { $error[] = '' . __('Expecting a string for', 'ymind') . ' ' . $label; } } if (!count($error)) { update_option('ymind_redirect_url', $_POST['new_url']); update_option('ymind_email_offender', $_POST['email_offender']); update_option('ymind_mail_subject', $_POST['mail_subject']); update_option('ymind_mail_message', $_POST['mail_message']); update_option('ymind_lockout_minutes', $_POST['lockout_minutes']); update_option('ymind_timeout_minutes', $_POST['timeout_minutes']); update_option('ymind_timeout_logins', $_POST['timeout_logins']); update_option('ymind_lockout_option', $_POST['lockout_option']); update_option('ymind_locked_out_error', $_POST['login_error']); update_option('ymind_activate_redirect', $_POST['activate_redirect']); $msg = '' . __('Options have been successfully updated.', 'ymind') . ''; ymind_display_feedback($msg); } else { $msg = '<ul style="margin:5px; padding-left: 10px;">'; foreach ($error as $err) { $msg .= '<li>' . $err . '</li>'; } $msg .= '</ul>'; ymind_display_error($msg); } } }
function delete_user_meta($user_id, $meta_key, $meta_value) { return delete_usermeta($user_id, $meta_key, $meta_value); }
function friends_remove_data($user_id) { BP_Friends_Friendship::delete_all_for_user($user_id); /* Remove usermeta */ delete_usermeta($user_id, 'total_friend_count'); /* Remove friendship requests FROM user */ bp_core_delete_notifications_from_user($user_id, $bp->friends->slug, 'friendship_request'); do_action('friends_remove_data', $user_id); }
function bp_dtheme_activity_template_loader() { global $bp; /* We need to calculate and return the feed URL for each scope */ $feed_url = site_url( BP_ACTIVITY_SLUG . '/feed/' ); switch ( $_POST['scope'] ) { case 'friends': $feed_url = $bp->loggedin_user->domain . BP_ACTIVITY_SLUG . '/friends/feed/'; break; case 'groups': $feed_url = $bp->loggedin_user->domain . BP_ACTIVITY_SLUG . '/groups/feed/'; break; case 'favorites': $feed_url = $bp->loggedin_user->domain . BP_ACTIVITY_SLUG . '/favorites/feed/'; break; case 'mentions': $feed_url = $bp->loggedin_user->domain . BP_ACTIVITY_SLUG . '/mentions/feed/'; delete_usermeta( $bp->loggedin_user->id, 'bp_new_mention_count' ); break; } /* Buffer the loop in the template to a var for JS to spit out. */ ob_start(); locate_template( array( 'activity/activity-loop.php' ), true ); $result['contents'] = ob_get_contents(); $result['feed_url'] = apply_filters( 'bp_dtheme_activity_feed_url', $feed_url, $_POST['scope'] ); ob_end_clean(); echo json_encode( $result ); }
function budget_save_extra_profile_fields($user_id) { if (!current_user_can('edit_user', $user_id)) { return false; } update_usermeta($user_id, 'default_desk', $_POST['default_desk']); update_usermeta($user_id, 'default_view', $_POST['default_view']); if (!empty($_POST['is_ae'])) { update_usermeta($user_id, 'is_ae', 1); } else { delete_usermeta($user_id, 'is_ae'); } }
/** * Update metadata of user. * * There is no need to serialize values, they will be serialized if it is * needed. The metadata key can only be a string with underscores. All else will * be removed. * * Will remove the metadata, if the meta value is empty. * * @since 2.0.0 * @uses $wpdb WordPress database object for queries * * @param int $user_id User ID * @param string $meta_key Metadata key. * @param mixed $meta_value Metadata value. * @return bool True on successful update, false on failure. */ function update_usermeta($user_id, $meta_key, $meta_value) { global $wpdb; if (!is_numeric($user_id)) { return false; } $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); /** @todo Might need fix because usermeta data is assumed to be already escaped */ if (is_string($meta_value)) { $meta_value = stripslashes($meta_value); } $meta_value = maybe_serialize($meta_value); if (empty($meta_value)) { return delete_usermeta($user_id, $meta_key); } $cur = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->usermeta} WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key)); if (!$cur) { $wpdb->query($wpdb->prepare("INSERT INTO {$wpdb->usermeta} ( user_id, meta_key, meta_value )\n\t\tVALUES\n\t\t( %d, %s, %s )", $user_id, $meta_key, $meta_value)); } else { if ($cur->meta_value != $meta_value) { $wpdb->query($wpdb->prepare("UPDATE {$wpdb->usermeta} SET meta_value = %s WHERE user_id = %d AND meta_key = %s", $meta_value, $user_id, $meta_key)); } else { return false; } } wp_cache_delete($user_id, 'users'); return true; }
/** * bp_example_remove_data() * * It's always wise to clean up after a user is deleted. This stops the database from filling up with * redundant information. */ function bp_gameful_remove_data($user_id) { /* You'll want to run a function here that will delete all information from any component tables for this $user_id */ /* Remember to remove usermeta for this component for the user being deleted */ delete_usermeta($user_id, 'bp_gameful_some_setting'); do_action('bp_gameful_remove_data', $user_id); }
/** * Deletes extra field value if nothing was populated * * @param string $get_user_id * @param string $eudfield * @param string $value * @return void * @author Vadimk */ function eud_delete_option($get_user_id, $eudfield, $value) { if (function_exists('delete_user_meta')) { delete_user_meta($get_user_id, str_replace('eud', '', $eudfield), $value); } else { delete_usermeta($get_user_id, str_replace('eud', '', $eudfield), $value); } }
/** * xprofile_remove_data_on_user_deletion() * * When a user is deleted, we need to clean up the database and remove all the * profile data from each table. Also we need to clean anything up in the usermeta table * that this component uses. * * @package BuddyPress XProfile * @param $user_id The ID of the deleted user * @uses get_usermeta() Get a user meta value based on meta key from wp_usermeta * @uses delete_usermeta() Delete user meta value based on meta key from wp_usermeta * @uses delete_data_for_user() Removes all profile data from the xprofile tables for the user */ function xprofile_remove_data($user_id) { BP_XProfile_ProfileData::delete_data_for_user($user_id); // delete any avatar files. @unlink(get_usermeta($user_id, 'bp_core_avatar_v1_path')); @unlink(get_usermeta($user_id, 'bp_core_avatar_v2_path')); // unset the usermeta for avatars from the usermeta table. delete_usermeta($user_id, 'bp_core_avatar_v1'); delete_usermeta($user_id, 'bp_core_avatar_v1_path'); delete_usermeta($user_id, 'bp_core_avatar_v2'); delete_usermeta($user_id, 'bp_core_avatar_v2_path'); }
function avatars_manage() { global $current_user; $uid = $_GET['uid']; $user = get_userdata($uid); $img_insert = "<div style='width: 489px; height: 260px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; border: 3px dashed gray;'></div>"; if (($uid == $current_user->ID || current_user_can('edit_users')) && is_numeric($_GET['uid'])) { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?> > <head> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?> ; charset=<?php echo get_option('blog_charset'); ?> " /> <title>Photo Management</title> <?php wp_enqueue_style('global'); wp_enqueue_style('wp-admin'); wp_enqueue_style('colors'); wp_enqueue_style('ie'); $this->avatars_initialise(); do_action('admin_print_styles'); do_action('admin_print_scripts'); do_action('admin_head'); ?> </head> <body> <?php $files = $this->avatar_strip_suffix($user->avatar); $root = $this->avatar_root(); switch ($_REQUEST['act']) { case 'DEL': // Check NONCE... if (!wp_verify_nonce($_REQUEST['n'], AVATARS_NONCE_KEY)) { die('(1) Security check.'); } // Remove local avatar files. foreach ($files as $f) { if (file_exists($root . $f)) { @unlink($root . $f); } } delete_usermeta($uid, 'avatar'); break; case 'TWIT': // Check NONCE... if (!wp_verify_nonce($_REQUEST['n'], AVATARS_NONCE_KEY)) { die('(2) Security check.'); } // Save Twitter ID. update_user_meta($uid, 'twitter_id', $_REQUEST['twitter_id']); break; case 'SAVE': // Check NONCE... if (!wp_verify_nonce($_REQUEST[AVATARS_NONCE_KEY], AVATARS_NONCE_KEY)) { die('(3) Security check.'); } if ($_POST['x1'] != '') { $files = $this->avatar_strip_suffix($user->avatar); $this->avatar_crop($user, $files[BASE_FILE]); } else { $this->avatar_upload($uid); $files = $this->avatar_strip_suffix($user->avatar); } break; } $this->output_avatar_error_message($user); printf("<form enctype='multipart/form-data' action='%s?action=avatars_manage&act=SAVE&uid=%s' method='post'>", admin_url('admin-ajax.php'), $uid); $nonce = wp_create_nonce(AVATARS_NONCE_KEY); printf("<input type='hidden' name='%s' value='%s' />", AVATARS_NONCE_KEY, $nonce); ?> <span style='width: 200px; float: left; padding:8px;'> <h3>Current Image</h3> <?php printf("<p><small>%s</small></p>", __('Current Photo image and type.', 'avatars')); printf("<p><span class='avatar_avatar'>%s</span>", get_avatar($uid, $this->avatar_options['size'])); printf("<span class='avatar_text'><strong>%s</strong> %s.</span></p>", $this->get_avatar_type(), __('avatar', 'avatars')); global $avatar_type; if ($avatar_type == TYPE_LOCAL) { printf("<p><a id='avatars_local_button' class='button' href='%s?action=avatars_manage&act=DEL&uid=%s&n=%s'>%s</a></p>", admin_url('admin-ajax.php'), $uid, $nonce, __('Delete local Photo', 'avatars')); list($w, $h, $type, $attr) = getimagesize($root . $files[BASE_FILE]); //$img_insert = sprintf("<div style='width: 489px; height: 260px;'><img id='avatar_upload' src='%s' /></div>", $files[BASE_FILE]); } ?> <script type="text/javascript"> parent.avatar_refresh(jQuery('.avatar_avatar img.avatar').attr('src')); </script> <?php /* New Image area printf("<p><small>%s</small></p>", __('How the uploaded image will look after manual cropping.', 'avatars')); if($avatar_type == TYPE_LOCAL) { $scaled_size = (empty($this->avatar_options['scale']) ? SCALED_SIZE : $this->avatar_options['scale']); printf("<div id='avatar_preview_div' style='width: %spx; height: %spx;'><img id='avatar_preview_img' src='%s' style='position: relative;' /></div>", $scaled_size, $scaled_size, $files[BASE_FILE]); } */ ?> </span> <span style='width: 497px; padding:8px; float: right;'> <h3>Image Upload</h3> <?php printf("<p><small>%s</small></p>", __('Upload an image to use as an Photo.', 'avatars')); ?> <input type='file' name='avatar_file' id='avatar_file' style='width: 486px;' /> <p> <span class='field-hint '><small> <?php _e('Hints: Square images make better avatars.', 'avatars'); ?> <br /> <?php _e('Small image files are best for avatars, e.g. approx. 10K or smaller.', 'avatars'); ?> </small></span> </p> <?php // printf("<p>%s</p>", $img_insert); printf("<p><input type='submit' value='Update Photo' class='button' /></p>"); ?> <input type="hidden" name="x1" value="" /> <input type="hidden" name="y1" value="" /> <input type="hidden" name="x2" value="" /> <input type="hidden" name="y2" value="" /> <input type="hidden" name="w" value="" /> <input type="hidden" name="h" value="" /> <script type="text/javascript"> function avatar_preview(img, selection) { var scaleX = 100 / (selection.width || 1); var scaleY = 100 / (selection.height || 1); jQuery('#avatar_preview_img').css({ width: Math.round(scaleX * <?php echo $w; ?> ) + 'px', height: Math.round(scaleY * <?php echo $h; ?> ) + 'px', marginLeft: '-' + (Math.round(scaleX * selection.x1) + 0) + 'px', marginTop: '-' + (Math.round(scaleY * selection.y1) + 0) + 'px' }); } function avatar_update_sel(img, selection) { jQuery('input[name="x1"]').val(selection.x1); jQuery('input[name="y1"]').val(selection.y1); jQuery('input[name="x2"]').val(selection.x2); jQuery('input[name="y2"]').val(selection.y2); jQuery('input[name="w"]').val(selection.width); jQuery('input[name="h"]').val(selection.height); } function avatar_init_view(img, selection) { avatar_preview(img, selection); avatar_update_sel(img, selection); } jQuery(document).ready(function () { jQuery('#avatar_upload').imgAreaSelect({ aspectRatio: '1:1', handles: true, x1: <?php echo $w / 2 - 50; ?> , y1: <?php echo $h / 2 - 50; ?> , x2: <?php echo $w / 2 + 30; ?> , y2: <?php echo $h / 2 + 30; ?> , imageWidth: <?php echo $w; ?> , imageHeight: <?php echo $h; ?> , onInit: avatar_init_view, onSelectChange: avatar_preview, onSelectEnd: avatar_update_sel }); }); </script> <?php /* Twitter ID printf("<p><small>%s</small></p>", __('Set the Twitter ID to use a Twitter Photo image.', 'avatars')); if($this->avatar_options['twitter'] == 'on') { printf("<p><label for='twitter_id'>%s </label><input type='text' value='%s' style='width: 60%%' id='twitter_id' name='twitter_id' /></p>", 'Twitter ID:', $user->twitter_id ); } printf("<p><a id='avatars_twitter_button' class='button' href='%s?action=avatars_manage&act=TWIT&uid=%s&n=%s'>%s</a></p>", admin_url('admin-ajax.php'), $uid, $nonce, __('Update Twitter ID', 'avatars') ); */ ?> <script type="text/javascript"> jQuery('#avatars_twitter_button').click(function() { jQuery(this).attr('href', this.href + '&twitter_id=' + jQuery('#twitter_id').val()); return true; }); </script> </span> </form> <?php do_action('admin_print_footer_scripts'); ?> </body> </html> <?php } else { wp_die(__("(1) You are not allowed to do that.", 'avatars')); } die; }
function userphoto_profile_update($userID) { global $userphoto_validtypes; global $userphoto_validextensions; global $current_user; $userdata = get_userdata($userID); #Delete photo if (@$_POST['userphoto_delete']) { delete_usermeta($userID, "userphoto_error"); if ($userdata->userphoto_image_file) { $upload_dir = wp_upload_dir(); $bdir = trailingslashit($upload_dir['basedir']) . 'userphoto/'; $imagepath = $bdir . basename($userdata->userphoto_image_file); $thumbpath = $bdir . basename($userdata->userphoto_thumb_file); if (file_exists($imagepath) && !@unlink($imagepath)) { update_usermeta($userID, 'userphoto_error', __("Unable to delete photo.", 'user-photo')); } else { @unlink($thumbpath); delete_usermeta($userID, "userphoto_approvalstatus"); delete_usermeta($userID, "userphoto_image_file"); delete_usermeta($userID, "userphoto_image_width"); delete_usermeta($userID, "userphoto_image_height"); delete_usermeta($userID, "userphoto_thumb_file"); delete_usermeta($userID, "userphoto_thumb_width"); delete_usermeta($userID, "userphoto_thumb_height"); } } } else { #Upload the file if (isset($_FILES['userphoto_image_file']) && @$_FILES['userphoto_image_file']['name']) { #Upload error $error = ''; if ($_FILES['userphoto_image_file']['error']) { switch ($_FILES['userphoto_image_file']['error']) { case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: $error = __("The uploaded file exceeds the max upload size.", 'user-photo'); break; case UPLOAD_ERR_PARTIAL: $error = __("The uploaded file was only partially uploaded.", 'user-photo'); break; case UPLOAD_ERR_NO_FILE: $error = __("No file was uploaded.", 'user-photo'); break; case UPLOAD_ERR_NO_TMP_DIR: $error = __("Missing a temporary folder.", 'user-photo'); break; case UPLOAD_ERR_CANT_WRITE: $error = __("Failed to write file to disk.", 'user-photo'); break; case UPLOAD_ERR_EXTENSION: $error = __("File upload stopped by extension.", 'user-photo'); break; default: $error = __("File upload failed due to unknown error.", 'user-photo'); } } else { if (!$_FILES['userphoto_image_file']['size']) { $error = sprintf(__("The file “%s” was not uploaded. Did you provide the correct filename?", 'user-photo'), $_FILES['userphoto_image_file']['name']); } else { if (!preg_match("/\\.(" . join('|', $userphoto_validextensions) . ")\$/i", $_FILES['userphoto_image_file']['name'])) { $error = sprintf(__("The file extension “%s” is not allowed. Must be one of: %s.", 'user-photo'), preg_replace('/.*\\./', '', $_FILES['userphoto_image_file']['name']), join(', ', $userphoto_validextensions)); } else { if (@(!$userphoto_validtypes[$_FILES['userphoto_image_file']['type']])) { $error = sprintf(__("The uploaded file type “%s” is not allowed.", 'user-photo'), $_FILES['userphoto_image_file']['type']); } } } } $tmppath = $_FILES['userphoto_image_file']['tmp_name']; $imageinfo = null; $thumbinfo = null; if (!$error) { $userphoto_maximum_dimension = get_option('userphoto_maximum_dimension'); #if(empty($userphoto_maximum_dimension)) # $userphoto_maximum_dimension = USERPHOTO_DEFAULT_MAX_DIMENSION; $imageinfo = getimagesize($tmppath); if (!$imageinfo || !$imageinfo[0] || !$imageinfo[1]) { $error = __("Unable to get image dimensions.", 'user-photo'); } else { if ($imageinfo[0] > $userphoto_maximum_dimension || $imageinfo[1] > $userphoto_maximum_dimension) { if (userphoto_resize_image($tmppath, null, $userphoto_maximum_dimension, $error)) { $imageinfo = getimagesize($tmppath); } } } //else if($imageinfo[0] > $userphoto_maximum_dimension) // $error = sprintf(__("The uploaded image had a width of %d pixels. The max width is %d.", 'user-photo'), $imageinfo[0], $userphoto_maximum_dimension); //else if($imageinfo[0] > $userphoto_maximum_dimension) // $error = sprintf(__("The uploaded image had a height of %d pixels. The max height is %d.", 'user-photo'), $imageinfo[1], $userphoto_maximum_dimension); } if (!$error) { $upload_dir = wp_upload_dir(); $dir = trailingslashit($upload_dir['basedir']) . 'userphoto'; #$umask = umask(0); if (!file_exists($dir) && @(!mkdir($dir, 0777))) { $error = sprintf(__("The userphoto upload content directory does not exist and could not be created. Please ensure that you have write permissions for the '%s' directory. Did you put slash at the beginning of the upload path in Misc. settings? It should be a path relative to the WordPress root directory. <code>wp_upload_dir()</code> returned:<br /> <code style='white-space:pre'>%s</code>", 'user-photo'), $dir, print_r($upload_dir, true)); } #umask($umask); if (!$error) { $oldimagefile = basename($userdata->userphoto_image_file); $oldthumbfile = basename($userdata->userphoto_thumb_file); #$imagefile = preg_replace('/^.+(?=\.\w+$)/', $userdata->user_nicename, strtolower($_FILES['userphoto_image_file']['name'])); $imagefile = "{$userID}." . preg_replace('{^.+?\\.(?=\\w+$)}', '', strtolower($_FILES['userphoto_image_file']['name'])); $imagepath = $dir . '/' . $imagefile; $thumbfile = preg_replace("/(?=\\.\\w+\$)/", '.thumbnail', $imagefile); $thumbpath = $dir . '/' . $thumbfile; if (!move_uploaded_file($tmppath, $imagepath)) { $error = sprintf(__("Unable to place the user photo at: %s", 'user-photo'), $imagepath); } else { chmod($imagepath, 0666); #Generate thumbnail $userphoto_thumb_dimension = get_option('userphoto_thumb_dimension'); #if(empty($userphoto_thumb_dimension)) # $userphoto_thumb_dimension = USERPHOTO_DEFAULT_THUMB_DIMENSION; if (!($userphoto_thumb_dimension >= $imageinfo[0] && $userphoto_thumb_dimension >= $imageinfo[1])) { userphoto_resize_image($imagepath, $thumbpath, $userphoto_thumb_dimension, $error); } else { copy($imagepath, $thumbpath); chmod($thumbpath, 0666); } $thumbinfo = getimagesize($thumbpath); #Update usermeta if ($current_user->user_level <= get_option('userphoto_level_moderated')) { update_usermeta($userID, "userphoto_approvalstatus", USERPHOTO_PENDING); $admin_notified = get_option('userphoto_admin_notified'); if ($admin_notified) { $admin = get_userdata($admin_notified); @wp_mail($admin->user_email, "User Photo for " . $userdata->display_name . " Needs Approval", get_option("siteurl") . "/wp-admin/user-edit.php?user_id=" . $userdata->ID . "#userphoto"); } } else { update_usermeta($userID, "userphoto_approvalstatus", USERPHOTO_APPROVED); } update_usermeta($userID, "userphoto_image_file", $imagefile); //TODO: use userphoto_image update_usermeta($userID, "userphoto_image_width", $imageinfo[0]); //TODO: use userphoto_image_width update_usermeta($userID, "userphoto_image_height", $imageinfo[1]); update_usermeta($userID, "userphoto_thumb_file", $thumbfile); update_usermeta($userID, "userphoto_thumb_width", $thumbinfo[0]); update_usermeta($userID, "userphoto_thumb_height", $thumbinfo[1]); //Delete old thumbnail if it has a different filename (extension) if ($oldimagefile != $imagefile) { @unlink($dir . '/' . $oldimagefile); } if ($oldthumbfile != $thumbfile) { @unlink($dir . '/' . $oldthumbfile); } } } } } #Set photo approval status if ($current_user->has_cap('edit_users') && array_key_exists('userphoto_approvalstatus', $_POST) && in_array((int) $_POST['userphoto_approvalstatus'], array(USERPHOTO_PENDING, USERPHOTO_REJECTED, USERPHOTO_APPROVED))) { update_usermeta($userID, "userphoto_approvalstatus", (int) $_POST['userphoto_approvalstatus']); if ((int) $_POST['userphoto_approvalstatus'] == USERPHOTO_REJECTED) { update_usermeta($userID, "userphoto_rejectionreason", $_POST['userphoto_rejectionreason']); } else { delete_usermeta($userID, "userphoto_rejectionreason"); } } } if ($error) { update_usermeta($userID, 'userphoto_error', $error); } else { delete_usermeta($userID, "userphoto_error"); } }
/** * Delete the user settings of the current user. * * @package WordPress * @subpackage Option * @since 2.7.0 */ function delete_all_user_settings() { if (!($user = wp_get_current_user())) { return; } delete_usermeta($user->ID, 'user-settings'); setcookie('wp-settings-' . $user->ID, ' ', time() - 31536000, SITECOOKIEPATH); }
function update_usermeta( $user_id, $meta_key, $meta_value ) { global $wpdb; if ( !is_numeric( $user_id ) ) return false; $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); // FIXME: usermeta data is assumed to be already escaped if ( is_string($meta_value) ) $meta_value = stripslashes($meta_value); $meta_value = maybe_serialize($meta_value); $meta_value = $wpdb->escape($meta_value); if (empty($meta_value)) { return delete_usermeta($user_id, $meta_key); } $cur = $wpdb->get_row("SELECT * FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key'"); if ( !$cur ) { $wpdb->query("INSERT INTO $wpdb->usermeta ( user_id, meta_key, meta_value ) VALUES ( '$user_id', '$meta_key', '$meta_value' )"); } else if ( $cur->meta_value != $meta_value ) { $wpdb->query("UPDATE $wpdb->usermeta SET meta_value = '$meta_value' WHERE user_id = '$user_id' AND meta_key = '$meta_key'"); } else { return false; } $user = get_userdata($user_id); wp_cache_delete($user_id, 'users'); wp_cache_delete($user->user_login, 'userlogins'); return true; }
static function advman_3_4_3(&$data) { // for some reason our meta boxes were hidden - remove this from database $us = get_users_of_blog(); foreach ($us as $u) { delete_usermeta($u->user_id, 'meta-box-hidden_advman'); } }
function delete_user_meta($userid, $metakey, $ignored = '') { return delete_usermeta($userid, $metakey); }
function set_admin_language() { global $wpdb, $current_user; if (is_null($current_user) && function_exists('wp_get_current_user')) { $u = wp_get_current_user(); if ($u->ID > 0) { $current_user = $u; } } $active_languages = array_keys($wpdb->get_col("SELECT code FROM {$wpdb->prefix}icl_languages WHERE active=1")); //don't use method get_active_language() $this->admin_language = $this->get_user_admin_language($current_user->data->ID); if ($this->admin_language != '' && !in_array($this->admin_language, $active_languages)) { delete_usermeta($current_user->data->ID, 'icl_admin_language'); } if (!in_array($this->settings['admin_default_language'], $active_languages) || is_null($this->settings['admin_default_language'])) { $this->settings['admin_default_language'] = '_default_'; $this->save_settings(); } if (!$this->admin_language) { $this->admin_language = $this->settings['admin_default_language']; } if ($this->admin_language == '_default_' && $this->get_default_language()) { $this->admin_language = $this->get_default_language(); } }
/** * Update metadata of user. * * There is no need to serialize values, they will be serialized if it is * needed. The metadata key can only be a string with underscores. All else will * be removed. * * Will remove the metadata, if the meta value is empty. * * @since 2.0.0 * @deprecated 3.0.0 * @deprecated Use update_user_meta() * @see update_user_meta() * * @param int $user_id User ID * @param string $meta_key Metadata key. * @param mixed $meta_value Metadata value. * @return bool True on successful update, false on failure. */ function update_usermeta($user_id, $meta_key, $meta_value) { _deprecated_function(__FUNCTION__, '3.0', 'update_user_meta()'); global $wpdb; if (!is_numeric($user_id)) { return false; } $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); /** @todo Might need fix because usermeta data is assumed to be already escaped */ if (is_string($meta_value)) { $meta_value = stripslashes($meta_value); } $meta_value = maybe_serialize($meta_value); if (empty($meta_value)) { return delete_usermeta($user_id, $meta_key); } $cur = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->usermeta} WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key)); if ($cur) { do_action('update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value); } if (!$cur) { $wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value')); } else { if ($cur->meta_value != $meta_value) { $wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key')); } else { return false; } } clean_user_cache($user_id); wp_cache_delete($user_id, 'user_meta'); if (!$cur) { do_action('added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value); } else { do_action('updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value); } return true; }
private function _delete_options() { delete_option($this->option_name); $users_of_blog = get_users_of_blog(); foreach ((array) $users_of_blog as $user) { if (function_exists('delete_user_meta')) { delete_user_meta($user->ID, $this->option_name); } else { delete_usermeta($user->ID, $this->option_name); } } unset($users_of_blog); $this->options = $this->_init_options(array()); }