예제 #1
0
 function test_largo_remove_user_avatar()
 {
     // Set the avatar for $user_id to $avatar_id
     largo_associate_avatar_with_user($this->user_id, $this->avatar_id);
     // Remove the avatar
     largo_remove_user_avatar($this->user_id);
     // Retrieve the $avatar_id directly with `get_user_meta`
     $retrieved = get_user_meta($this->user_id, LARGO_AVATAR_META_NAME, true);
     // $retrieved should be empty at this point
     $this->assertEmpty($retrieved);
 }
예제 #2
0
function largo_remove_avatar()
{
    $user_id = false;
    if (!empty($_POST['user_id'])) {
        $user_id = $_POST['user_id'];
    }
    $ret = largo_remove_user_avatar($user_id);
    if (!empty($ret)) {
        echo json_encode(array('success' => true));
    } else {
        echo json_encode(array('success' => false));
    }
    wp_die();
}