<?php

include "../wp-load.php";
$id = isset($_POST['id']) ? $_POST['id'] : null;
$name = $_POST['bucket-name'];
$description = $_POST['description'];
if (!$id) {
    $bucket = new Bucket($name, $description, $id);
    $bucketId = $bucket->create();
    $frontEndController = new frontEndController();
    $frontEndController->addUserToBucket($bucketId);
} else {
    $bucket = new Bucket($name, $description, $id);
    $id = $bucket->update();
}
header("Location: /buckets");
exit;