/**
 * This function will run on the activation of this plugin.
 *
 * This function is responsible for performing all necessary actions when activated. For
 * example, this function will check to see if a form already exists for creating new
 * music competitions. If no such form exists, this function will create a new form
 * designed specifically for creating new music competitions.
 *
 * @since 1.0.0
 * @author KREW
 */
function aria_create_competition_activation()
{
    require_once ABSPATH . 'wp-admin/includes/plugin.php';
    if (is_plugin_active('gravityforms/gravityforms.php')) {
        $forms = GFAPI::get_forms();
        $create_competition_form_id = aria_get_create_competition_form_id();
        // if the form for creating music competitions does not exist, create a new form
        if ($create_competition_form_id === -1) {
            aria_create_competition_form();
        }
    } else {
        $error_message = 'Error: The Gravity Forms plugin is not active. Please activate';
        $error_message .= ' the Gravity Forms plugin and reactivate this plugin.';
        wp_die($error_message);
    }
}
예제 #2
0
function aria_activation_func()
{
    require_once ABSPATH . 'wp-admin/includes/plugin.php';
    if (is_plugin_active('gravityforms/gravityforms.php')) {
        aria_create_teacher_form("Sample Created");
        aria_create_student_form("Sample Created");
        // Get all forms from gravity forms
        $forms = GFAPI::get_forms();
        // Set the form index of the Competition Creation Form.
        $competition_creation_form_title = "ARIA: Create a Competition";
        $index = -1;
        // Loop through each form to see if the form was previously created.
        foreach ($forms as $form) {
            if ($form['title'] == "ARIA: Create a Competition") {
                $index = $form['id'];
            }
        }
        // form does not exist; create new form
        if ($index == -1) {
            $result = aria_create_competition_form();
        }
    }
}