diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/admin/views/giglog_admin_page.php | 2 | ||||
-rw-r--r-- | includes/concert.php | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/includes/admin/views/giglog_admin_page.php b/includes/admin/views/giglog_admin_page.php index 8228f38..5749bab 100644 --- a/includes/admin/views/giglog_admin_page.php +++ b/includes/admin/views/giglog_admin_page.php @@ -141,7 +141,7 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { if(isset($_POST['edit']) && $_POST['edit']=="EDIT" && !empty($cid)) //A bit overdoing with the checks if concert ID is empty both here and in find_cid. But based on that, things are NULL or not. Better ideas? $c = GiglogAdmin_Concert::find_cid($cid); else - $c = GiglogAdmin_Concert::find_cid(''); + $c = new GiglogAdmin_Concert(); $content='<form method="POST" action="" class="concedit" > Form to create/edit concerts, bands, venues<br>' .'<input type="hidden" name="pid" value="' .$c->id(). '" />' diff --git a/includes/concert.php b/includes/concert.php index 7453319..3084eb4 100644 --- a/includes/concert.php +++ b/includes/concert.php @@ -32,7 +32,7 @@ if ( !class_exists('GiglogAdmin_Concert') ) { * so this constructor can be used to construct the object * directly from the database row. */ - private function __construct($attrs) + public function __construct($attrs = []) { $this->id = isset($attrs->id) ? $attrs->id : NULL; $this->band = isset($attrs->band) ? $attrs->band : NULL; @@ -59,7 +59,9 @@ if ( !class_exists('GiglogAdmin_Concert') ) { static function find_cid($id) - { global $wpdb; + { + global $wpdb; + if(!empty($id)) { $csql = 'SELECT * FROM wpg_concerts WHERE id="' . $id . '"'; @@ -70,8 +72,8 @@ if ( !class_exists('GiglogAdmin_Concert') ) { } } else - { $arr = array_fill(0, 6, null); - return new GiglogAdmin_Concert($arr); + { + return new GiglogAdmin_Concert(); } } |