@@ -41,6 +41,14 @@ function register_paystack_setting_page() {
4141 register_setting ( 'paystack-form-settings-group ' , 'lsk ' );
4242 register_setting ( 'paystack-form-settings-group ' , 'lpk ' );
4343 }
44+ function txncheck ($ name ,$ txncharge ){
45+ if ($ name == $ txncharge ) {
46+ $ result = "selected " ;
47+ }else {
48+ $ result = "" ;
49+ }
50+ return $ result ;
51+ }
4452 function paystack_setting_page () {
4553 ?>
4654 <h1>Paystack Forms API KEYS Settings!</h1>
@@ -49,11 +57,18 @@ function paystack_setting_page() {
4957 <table class="form-table paystack_setting_page">
5058 <tr valign="top">
5159 <th scope="row">Mode</th>
52- <td><input type="text" name="mode" value="<?php echo esc_attr ( get_option ('mode ' ) ); ?> " /></td>
60+
61+ <td><select class="form-control" name="mode" id="parent_id">
62+ <option value="live" <?php echo txncheck ('live ' ,esc_attr ( get_option ('mode ' ) )) ?> >Live Mode</option>
63+ <option value="test" <?php echo txncheck ('test ' ,esc_attr ( get_option ('mode ' ) )) ?> >Test Mode</option>
64+ </select>
65+ <!-- <input type="text" name="mode" value="<?php echo esc_attr ( get_option ('mode ' ) ); ?> " /></td> -->
5366 </tr>
5467 <tr valign="top">
5568 <th scope="row">Test Secret Key</th>
56- <td><input type="text" name="tsk" value="<?php echo esc_attr ( get_option ('tsk ' ) ); ?> " /></td>
69+ <td>
70+
71+ <input type="text" name="tsk" value="<?php echo esc_attr ( get_option ('tsk ' ) ); ?> " /></td>
5772 </tr>
5873
5974 <tr valign="top">
@@ -216,7 +231,8 @@ function my_edit_paystack_form_columns( $columns ) {
216231 $ columns = array (
217232 'cb ' => '<input type="checkbox" /> ' ,
218233 'title ' => __ ( 'Name ' ),
219- 'shortcode ' => __ ( 'Shortcode ' ),
234+ 'shortcode ' => __ ( 'Shortcode ' ),
235+ 'payments ' => __ ( 'Payments ' ),
220236 'date ' => __ ( 'Date ' )
221237 );
222238
@@ -225,7 +241,8 @@ function my_edit_paystack_form_columns( $columns ) {
225241 add_action ( 'manage_paystack_form_posts_custom_column ' , 'my_paystack_form_columns ' , 10 , 2 );
226242
227243 function my_paystack_form_columns ( $ column , $ post_id ) {
228- global $ post ;
244+ global $ post ,$ wpdb ;
245+ $ table = $ wpdb ->prefix . 'paystack_forms_payments ' ;
229246
230247 switch ( $ column ) {
231248 case 'shortcode ' :
@@ -234,6 +251,13 @@ function my_paystack_form_columns( $column, $post_id ) {
234251 readonly="readonly" onfocus="this.select();"></span> ' ;
235252
236253 break ;
254+ case 'payments ' :
255+
256+ $ count_query = 'select count(*) from ' .$ table .' WHERE post_id = " ' .$ post_id .'" AND paid = "1" ' ;
257+ $ num = $ wpdb ->get_var ($ count_query );
258+
259+ echo '<a href=" ' .admin_url ('admin.php?page=submissions&form= ' .$ post_id ) .'"> ' . $ num .'</a> ' ;
260+ break ;
237261 default :
238262 break ;
239263 }
@@ -278,7 +302,8 @@ function help_metabox_details( $post ) {
278302
279303 ?>
280304 <div class="awesome-meta-admin">
281- To make an input compulsory add <code> required="required" </code> to the shortcode <br />
305+ To make an input field compulsory add <code> required="required" </code> to the shortcode <br /><br />
306+ It should look like this <code> [text name="Full Name" required="required" ]</code>
282307
283308 </div>
284309
@@ -306,15 +331,7 @@ function wpt_form_data() {
306331 $ txncharge = get_post_meta ($ post ->ID , '_txncharge ' , true );
307332 $ loggedin = get_post_meta ($ post ->ID , '_loggedin ' , true );
308333 $ currency = get_post_meta ($ post ->ID , '_currency ' , true );
309- function txncheck ($ name ,$ txncharge ){
310334
311- if ($ name == $ txncharge ) {
312- $ result = "selected " ;
313- }else {
314- $ result = "" ;
315- }
316- return $ result ;
317- }
318335 if ($ amount == "" ) {$ amount = 0 ;}
319336 if ($ paybtn == "" ) {$ paybtn = 'Pay ' ;}
320337 if ($ successmsg == "" ) {$ successmsg = 'Thank you for paying! ' ;}
@@ -490,7 +507,7 @@ public function prepare_items(){
490507
491508 $ table = $ wpdb ->prefix ."paystack_forms_payments " ;
492509 $ data = array ();
493- $ alldbdata = $ wpdb ->get_results ("SELECT * FROM $ table WHERE (post_id = ' " .$ post_id ."' AND paid = '0 ') " );
510+ $ alldbdata = $ wpdb ->get_results ("SELECT * FROM $ table WHERE (post_id = ' " .$ post_id ."' AND paid = '1 ') " );
494511
495512 foreach ($ alldbdata as $ key => $ dbdata ) {
496513 $ newkey = $ key +1 ;
@@ -508,7 +525,7 @@ public function prepare_items(){
508525 $ hidden = $ this ->get_hidden_columns ();
509526 $ sortable = $ this ->get_sortable_columns ();
510527 usort ( $ data , array ( &$ this , 'sort_data ' ) );
511- $ perPage = 6 ;
528+ $ perPage = 20 ;
512529 $ currentPage = $ this ->get_pagenum ();
513530 $ totalItems = count ($ data );
514531 $ this ->set_pagination_args ( array (
0 commit comments