@@ -259,6 +259,7 @@ function kkd_pff_paystack_editor_add_extra_metaboxes() {
259259 add_meta_box ('kkd_pff_paystack_editor_add_recur_data ' , 'Recurring Payment ' , 'kkd_pff_paystack_editor_add_recur_data ' , 'paystack_form ' , 'side ' , 'default ' );
260260 add_meta_box ('kkd_pff_paystack_editor_add_email_data ' , 'Email Receipt Settings ' , 'kkd_pff_paystack_editor_add_email_data ' , 'paystack_form ' , 'normal ' , 'default ' );
261261 add_meta_box ('kkd_pff_paystack_editor_add_quantity_data ' , 'Quantity Payment ' , 'kkd_pff_paystack_editor_add_quantity_data ' , 'paystack_form ' , 'side ' , 'default ' );
262+ add_meta_box ('kkd_pff_paystack_editor_add_agreement_data ' , 'Agreement checkbox ' , 'kkd_pff_paystack_editor_add_agreement_data ' , 'paystack_form ' , 'side ' , 'default ' );
262263
263264 }
264265
@@ -388,6 +389,29 @@ function kkd_pff_paystack_editor_add_quantity_data() {
388389 echo '<input type="number" name="_quantity" value=" ' . $ quantity . '" class="widefat pf-number" />
389390 <small>Your users only get to pay in quantities if the from amount is not set to zero and recur is set to none.</small> ' ;
390391
392+ }
393+ function kkd_pff_paystack_editor_add_agreement_data () {
394+ global $ post ;
395+
396+ // Noncename needed to verify where the data originated
397+ echo '<input type="hidden" name="eventmeta_noncename" id="eventmeta_noncename" value=" ' .
398+ wp_create_nonce ( plugin_basename (__FILE__ ) ) . '" /> ' ;
399+
400+ // Get the location data if its already been entered
401+ $ useagreement = get_post_meta ($ post ->ID , '_useagreement ' , true );
402+ $ agreementlink = get_post_meta ($ post ->ID , '_agreementlink ' , true );
403+
404+ if ($ useagreement == "" ) {$ useagreement = 'no ' ;}
405+ if ($ agreementlink == "" ) {$ agreementlink = '' ;}
406+ // Echo out the field
407+ echo '<small>Allow your users pay in multiple quantity</small><p>Use agreement checkbox:</p> ' ;
408+ echo '<select class="form-control" name="_useagreement" style="width:100%;">
409+ <option value="no" ' .kkd_pff_paystack_txncheck ('no ' ,$ useagreement ).'>No</option>
410+ <option value="yes" ' .kkd_pff_paystack_txncheck ('yes ' ,$ useagreement ).'>Yes</option>
411+ </select> ' ;
412+ echo '<p>Agreement Page Link:</p> ' ;
413+ echo '<input type="text" name="_agreementlink" value=" ' . $ agreementlink . '" class="widefat" /> ' ;
414+
391415 }
392416 function kkd_pff_paystack_save_data ($ post_id , $ post ) {
393417
@@ -418,6 +442,9 @@ function kkd_pff_paystack_save_data($post_id, $post) {
418442 $ form_meta ['_usequantity ' ] = $ _POST ['_usequantity ' ];
419443 $ form_meta ['_quantity ' ] = $ _POST ['_quantity ' ];
420444
445+ $ form_meta ['_useagreement ' ] = $ _POST ['_useagreement ' ];
446+ $ form_meta ['_agreementlink ' ] = $ _POST ['_agreementlink ' ];
447+
421448 // Add values of $form_meta as custom fields
422449
423450 foreach ($ form_meta as $ key => $ value ) { // Cycle through the $form_meta array!
@@ -467,6 +494,7 @@ function kkd_pff_paystack_payment_submissions(){
467494 $ loggedin = get_post_meta ($ id ,'_loggedin ' ,true );
468495 $ txncharge = get_post_meta ($ id ,'_txncharge ' ,true );
469496
497+ echo "<title> " .$ obj ->post_title ." Payments </title> " ;
470498 echo "<h1> " .$ obj ->post_title ." Payments</h1> " ;
471499 $ exampleListTable = new Kkd_Pff_Paystack_Payments_List_Table ();
472500 $ exampleListTable ->prepare_items ();
@@ -483,17 +511,17 @@ class Kkd_Pff_Paystack_Wp_List_Table{
483511 public function __construct (){
484512 add_action ( 'admin_menu ' , array ($ this , 'add_menu_example_list_table_page ' ));
485513 }
486- public function add_menu_example_list_table_page (){
514+ public function add_menu_example_list_table_page (){
487515 add_menu_page ( '' , '' , 'manage_options ' , 'example-list-table.php ' , array ($ this , 'list_table_page ' ) );
488516 }
489- public function list_table_page (){
517+ public function list_table_page (){
490518 $ exampleListTable = new Example_List_Table ();
491519 $ exampleListTable ->prepare_items ($ data );
492520 ?>
493- <div class="wrap">
494- <div id="icon-users" class="icon32"></div>
495- <?php $ exampleListTable ->display (); ?>
496- </div>
521+ <div class="wrap">
522+ <div id="icon-users" class="icon32"></div>
523+ <?php $ exampleListTable ->display (); ?>
524+ </div>
497525 <?php
498526 }
499527}
@@ -508,17 +536,17 @@ function format_data($data){
508536 if (array_key_exists ("0 " , $ new )) {
509537 foreach ($ new as $ key => $ item ) {
510538 if ($ item ->type == 'text ' ) {
511- $ text .= '<b> ' .$ item ->display_name ."</b> : " .$ item ->value ."<br /> " ;
539+ $ text .= '<b> ' .$ item ->display_name .": </b> " .$ item ->value ."<br /> " ;
512540 }else {
513- $ text .= '<b> ' .$ item ->display_name ."</b> : <a target='_blank' href=' " .$ item ->value ."'>link</a><br /> " ;
541+ $ text .= '<b> ' .$ item ->display_name .": </b> <a target='_blank' href=' " .$ item ->value ."'>link</a><br /> " ;
514542 }
515543
516544 }
517545 }else {
518546 $ text = '' ;
519547 if (count ($ new ) > 0 ) {
520548 foreach ($ new as $ key => $ item ) {
521- $ text .= '<b> ' .$ key ."</b> : " .$ item ."<br /> " ;
549+ $ text .= '<b> ' .$ key .": </b> " .$ item ."<br /> " ;
522550 }
523551 }
524552 }
0 commit comments