Skip to content

Commit 69c8f82

Browse files
committed
Database fixes
1 parent 58bb610 commit 69c8f82

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

includes/class-paystack-forms-activator.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@ class Paystack_Forms_Activator {
3131
*/
3232
public static function activate() {
3333
global $wpdb;
34-
$charset_collate = $wpdb->get_charset_collate();
3534
$table_name = $wpdb->prefix . 'paystack_forms_payments';
3635

37-
$sql = "CREATE TABLE $table_name (
36+
$sql = "CREATE TABLE IF NOT EXISTS `".$table_name."` (
3837
id int(11) NOT NULL AUTO_INCREMENT,
3938
post_id int(11) NOT NULL,
4039
user_id int(11) NOT NULL,
@@ -43,15 +42,14 @@ public static function activate() {
4342
paid int(1) NOT NULL DEFAULT '0',
4443
txn_code varchar(255) DEFAULT '' NOT NULL,
4544
amount varchar(255) DEFAULT '' NOT NULL,
46-
views smallint(5) NOT NULL,
45+
ip varchar(255) NOT NULL,
4746
deleted_at varchar(255) DEFAULT '' NULL,
48-
created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
49-
modified datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
47+
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
48+
modified timestamp DEFAULT '0000-00-00 00:00:00' NOT NULL,
5049
UNIQUE KEY id (id)
51-
) $charset_collate;";
52-
50+
);";
5351
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
54-
dbDelta( $sql );
52+
dbDelta($sql);
5553
}
5654

5755

paystack-forms.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ function run_paystack_forms() {
7575

7676
}
7777
run_paystack_forms();
78+
7879
function shortcode_button_script(){
7980
if(wp_script_is("quicktags")){
8081
?>

public/class-paystack-forms-public.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ function paystack_submit_action() {
350350
$table,
351351
$insert
352352
);
353-
}
353+
}
354354

355355
$response = array(
356356
'result' => 'success',
@@ -428,7 +428,7 @@ function paystack_confirm_payment() {
428428

429429
}
430430
}else{
431-
$message = "Try Submitting Form again";
431+
$message = "Payment Verification Failed.";
432432
$result = "failed";
433433

434434
}

0 commit comments

Comments
 (0)