-
Notifications
You must be signed in to change notification settings - Fork 1
/
confOrg.php
104 lines (80 loc) · 2.75 KB
/
confOrg.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
/*
Plugin Name: Conference Organizer
Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
Description: Plugin to handle, Registration, Session SignUps and Scheduling of a(n) (Un)Conference
Version: 0.1
Author: Bill Deys So Far
Author URI: http://deys.ca
License: Does CC-BY-NC-SA work here????
*/
$ConfOrg_db_version = "1.0";
function ConfOrg_install ()
{
global $wpdb;
global $ConfOrg_db_version;
// Table of People Registered
/* wspaetzel: why not just use Wordpress's built in user tables? */
$table_name = $wpdb->prefix . "registrants";
if($wpdb->get_var("show tables like '$table_name'") != $table_name)
{
$sql = "CREATE TABLE " . $table_name . " (
reg_id mediumint(9) NOT NULL AUTO_INCREMENT,
username VARCHAR(50) NOT NULL,
fullName VARCHAR(50) NOT NULL,
email VARCHAR(50) NOT NULL,
twitter VARCHAR(50) NOT NULL,
website VARCHAR(50) NOT NULL,
blog VARCHAR(50) NOT NULL,
UNIQUE KEY id (reg_id)
);";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
}
// Table of Sessions
$table_name = $wpdb->prefix . "session";
if($wpdb->get_var("show tables like '$table_name'") != $table_name)
{
$sql = "CREATE TABLE " . $table_name . " (
session_id mediumint(9) NOT NULL AUTO_INCREMENT,
session_title VARCHAR(50) NOT NULL,
description VARCHAR(250) NOT NULL,
link VARCHAR(250),
UNIQUE KEY id (session_id)
);";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
}
// Table of Session Id's and their Presentors (multiple reg_id to a session_id)
$table_name = $wpdb->prefix . "presentors";
if($wpdb->get_var("show tables like '$table_name'") != $table_name)
{
$sql = "CREATE TABLE " . $table_name . " (
session_id mediumint(9) NOT NULL,
reg_id mediumint(9) NOT NULL
);";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
}
//Still need a table for schedule and one for display options from the admin panel
add_option("ConfOrg_db_version", $ConfOrg_db_version);
/* $welcome_name = "Mr. Wordpress";
$welcome_text = "Congratulations, you just completed the installation!";
$insert = "INSERT INTO " . $table_name .
" (time, name, text) " .
"VALUES ('" . time() . "','" . $wpdb->escape($welcome_name) . "','" . $wpdb->escape($welcome_text) . "')";
$results = $wpdb->query( $insert );
*/
}
function ConfOrg ($action)
{
//Figure out which action is called for
//If [registration] call ConOrg_Register
//If [addSession] call ConOrg_AddSession
//If [displaySession] call ConOrg_DislpaySession
//If
return $output;
}
register_activation_hook(__FILE__,'ConfOrg_install');
add_filter('the_content','ConfOrg');
?>