[44] | 1 | <?php
|
---|
| 2 | /**
|
---|
| 3 | * @author: Javier Reyes Gomez (http://www.sociable.es)
|
---|
| 4 | * @date: 05/10/2008
|
---|
| 5 | * @license: GPLv2
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | if (!class_exists('WPfbConnect_Store')):
|
---|
| 9 | class WPfbConnect_Store {
|
---|
| 10 | var $comments_table_name;
|
---|
| 11 | var $usermeta_table_name;
|
---|
| 12 | var $users_table_name;
|
---|
| 13 |
|
---|
| 14 | function WPfbConnect_Store()
|
---|
| 15 | {
|
---|
| 16 | global $wpdb;
|
---|
| 17 |
|
---|
| 18 | $table_prefix = isset($wpdb->base_prefix) ? $wpdb->base_prefix : $wpdb->prefix;
|
---|
| 19 |
|
---|
| 20 | $this->comments_table_name = $table_prefix . 'comments';
|
---|
| 21 | $this->usermeta_table_name = $wpdb->prefix . 'usermeta';
|
---|
| 22 | $this->users_table_name = $wpdb->prefix . 'users';
|
---|
| 23 |
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | function isError($value)
|
---|
| 27 | {
|
---|
| 28 | return $value === false;
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | /**
|
---|
| 32 | * Create Facebook Connect columns
|
---|
| 33 | */
|
---|
| 34 | function create_tables()
|
---|
| 35 | {
|
---|
| 36 | global $wp_version, $wpdb, $fbconnect;
|
---|
| 37 |
|
---|
| 38 | if ($wp_version >= '2.3') {
|
---|
| 39 | require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
---|
| 40 | } else {
|
---|
| 41 | require_once(ABSPATH . 'wp-admin/admin-db.php');
|
---|
| 42 | require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | // add column to comments table
|
---|
| 46 | $result = maybe_add_column($this->comments_table_name, 'fbconnect',
|
---|
| 47 | "ALTER TABLE $this->comments_table_name ADD `fbconnect` varchar(50) NOT NULL DEFAULT '0'");
|
---|
| 48 |
|
---|
| 49 | // add column to users table
|
---|
| 50 | $result = maybe_add_column($this->users_table_name, 'fbconnect_lastlogin',
|
---|
| 51 | "ALTER TABLE $this->users_table_name ADD `fbconnect_lastlogin` int(14) NOT NULL DEFAULT '0'");
|
---|
| 52 |
|
---|
| 53 | // add column to users table
|
---|
| 54 | $result = maybe_add_column($this->users_table_name, 'fbconnect_userid',
|
---|
| 55 | "ALTER TABLE $this->users_table_name ADD `fbconnect_userid` varchar(250) NOT NULL DEFAULT '0'");
|
---|
| 56 |
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | }
|
---|
| 60 | endif;
|
---|
| 61 |
|
---|
| 62 |
|
---|
| 63 | ?>
|
---|