コード例 #1
0
function install_signup_builder()
{
    //NB Always set wpdb globally!
    global $wpdb, $user_ID;
    //Set Table Name
    $signup_builder_table = $wpdb->prefix . "signup_builder";
    //Check whether or not the table already exists
    if (!check_signup_builder_existance($signup_builder_table)) {
        // Create the main Table, don't forget the ( ` ) - MySQL Reference @ http://www.w3schools.com/Sql/sql_create_table.asp
        $signup_builder_table_install = "CREATE TABLE `" . $signup_builder_table . "` (\t\t\t\n\t\t\t`id` MEDIUMINT(8) unsigned NOT NULL auto_increment PRIMARY KEY,\n\t\t\t`field_name` VARCHAR(255),\n\t\t\t`field_type` VARCHAR(255),\n\t\t\t`field_label` VARCHAR(255),\n\t\t\t`field_values` VARCHAR(255),\n\t\t\t`field_max_value` VARCHAR(255),\n\t\t\t`field_isEmpty` INT( 1 ),\n\t\t\t`field_can_delete` INT( 1 ) NOT NULL DEFAULT 1,\n\t\t\t`field_class` VARCHAR( 20 ),\n\t\t\t`field_order` INT( 1 ),\n\t\t\t`field_error_msg` VARCHAR(255),\n\t\t\t`field_sub_label` VARCHAR(255));";
        $signup_builder_table_add = " INSERT INTO `" . $signup_builder_table . "` \n\t\t\t   (`id`, `field_name`, `field_type`, `field_label`, `field_values`, `field_max_value`, `field_isEmpty`, `field_can_delete`, `field_class`, `field_order`, `field_error_msg`, `field_sub_label`) \n\tVALUES ('', 'username', 'text', 'Username', '', '50', 1, 0, '', 1,'','Type a username'), \n\t\t   ('', 'password', 'password', 'Password', '', '50', 1, 0, '', 2,'','Type a password'),\n\t\t   ('', 'email', 'text', 'Email', '', '50', 1, 0, '', 3,'','Enter your valid email');";
        //Run the and validate that it was successful
        if (mysql_query($signup_builder_table_install) === true) {
            $tabe_created = 1;
        }
        if (mysql_query($signup_builder_table_add) === true) {
            $tabe_created = 1;
        }
    }
    //check if post space exist if not add new post and store data
    check_create_post();
    //default email
    create_email_message();
    //default color
    sb_default_menu();
}
コード例 #2
0
function custom_signup()
{
    // add_menu_page('Front GUI', 'Front GUI', 'add_users', 'signup-builder/signup-builder.php', 'show_signup',   plugins_url('signup-builder/images/star.png'));
    add_menu_page('Signup Builder', 'Signup Builder', 8, 'signup-builder/signup-builder.php', 'show_signup', plugins_url('signup-builder/images/star.png'));
    check_create_post();
}