Example #1
0
/**
 * Handle create action from new form
 */
function post_flagger_handle_create()
{
    //Delete 'action' from the $_POST array
    unset($_POST['action']);
    $messageId = 1;
    //Check if flag slug does not exists
    if (!post_flagger_flag_exists($_POST['slug'])) {
        //Create the flag
        post_flagger_create_flag($_POST);
    } else {
        $messageId = 3;
    }
    //Redirect to plugin settings page
    wp_redirect(admin_url('options-general.php?page=post-flagger-options&m=' . $messageId));
    exit;
}
Example #2
0
/**
 *
 */
function post_flagger_create_favorites()
{
    $favorite = array('name' => 'Favorites', 'slug' => 'favorites', 'unflagged_code' => 'Fav This', 'flagged_code' => 'Faved');
    if (!post_flagger_flag_exists($favorite['slug'])) {
        post_flagger_create_flag($favorite);
    }
}