コード例 #1
0
/**
 * Delete profile pic
 * @uses Simple Local Avatar Plugin
 * @link http://wordpress.org/extend/plugins/simple-local-avatars/
 */
function gd_delete_profile_pic()
{
    global $current_user;
    $nonce = $_POST['nonce'];
    if (!wp_verify_nonce($nonce, 'iel_theme_nonce')) {
        header("HTTP/1.0 409 Security Check.");
        exit;
    }
    if (empty($_POST['authorID'])) {
        header("HTTP/1.0 409 Could not find author ID.");
        exit;
    }
    $authorID = (int) $_POST['authorID'];
    if ($current_user->ID != $authorID) {
        header("HTTP/1.0 409 Please edit your own profile!");
        exit;
    }
    if (class_exists('Simple_Local_Avatars')) {
        $localAvatar = new Simple_Local_Avatars();
        $imgInfo = get_user_meta($authorID, 'simple_local_avatar', true);
        if (empty($imgInfo)) {
            header("HTTP/1.0 409 Could not find a picture to delete!");
            exit;
        }
        $localAvatar->avatar_delete($authorID);
        echo json_encode(array('img' => get_avatar($authorID, 80)));
    }
    exit;
}
コード例 #2
0
function simple_local_avatars_uninstall()
{
    $simple_local_avatars = new Simple_Local_Avatars();
    $users = get_users_of_blog();
    foreach ($users as $user) {
        $simple_local_avatars->avatar_delete($user->user_id);
    }
    delete_option('simple_local_avatars_caps');
}
コード例 #3
0
function simple_local_avatars_uninstall()
{
    $simple_local_avatars = new Simple_Local_Avatars();
    $users = get_users(array('meta_key' => 'simple_local_avatar', 'fields' => 'ids'));
    foreach ($users as $user_id) {
        $simple_local_avatars->avatar_delete($user_id);
    }
    delete_option('simple_local_avatars');
}
コード例 #4
0
ファイル: profile.php プロジェクト: rpavlovic/btc-site
    update_user_meta($current_user->ID, 'twitter', esc_attr($_POST['twitter']));
    update_user_meta($current_user->ID, 'instagram', esc_attr($_POST['instagram']));
    // Redirect so the page will show updated info.
    // I am not Author of this Code- i dont know why but it worked for me after changing below line to if ( count($error) == 0 ){
    if (count($error) == 0) {
        //action hook for plugins and extra fields saving
        do_action('edit_user_profile_update', $current_user->ID);
        do_action('personal_options_update', $current_user->ID);
        $av = new Simple_Local_Avatars();
        $av->edit_user_profile_update($current_user->ID);
        wp_redirect(get_permalink());
        exit;
    }
} else {
    if ('GET' == $_SERVER['REQUEST_METHOD'] && !empty($_GET['action']) && $_GET['action'] == 'remove-simple-local-avatar' && $current_user->ID == $_GET['user_id']) {
        $av = new Simple_Local_Avatars();
        $av->avatar_delete($current_user->ID);
        wp_redirect(get_permalink());
        exit;
    }
}
get_header();
btc_breadcrumbs();
$current_post = $post;
?>

				<div class="contact-form-area">

		<?php 
// Start the loop.
while (have_posts()) {
コード例 #5
0
ファイル: author.php プロジェクト: rafdizzle86/greatdiseases
 * @link http://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Tufts Great Diseases
 * @since Tufts Great Diseases 1.0
 */
get_header();
?>

<?php 
// Author object
$user_obj = get_queried_object();
// If we are looking at our own page, check if we've uploaded a picture
if ($user_obj->ID == get_current_user_id()) {
    if (class_exists('Simple_Local_Avatars')) {
        $local_avatar = new Simple_Local_Avatars();
        if (isset($_POST['delete_avatar'])) {
            $local_avatar->avatar_delete($user_obj->ID);
        } else {
            $local_avatar->edit_user_profile_update($user_obj->ID);
        }
    }
}
?>

<div class="content-sidebar-wrapper">

    <?php 
get_sidebar();
?>