From e42c33c7b2a9c28d0cfc3b086cf2fa34a133d1bb Mon Sep 17 00:00:00 2001 From: wisdomanthoni Date: Wed, 28 Aug 2019 23:10:41 +0100 Subject: [PATCH] update settings page to show webhook url --- lang/en/enrol_paystack.php | 2 +- settings.php | 24 ++++++++++-------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/lang/en/enrol_paystack.php b/lang/en/enrol_paystack.php index 9692dde..a41b474 100644 --- a/lang/en/enrol_paystack.php +++ b/lang/en/enrol_paystack.php @@ -95,4 +95,4 @@ $string['charge_description2'] = 'Charge for Course Enrolment Cost.'; $string['paystack_sorry'] = "Sorry, you can not use the script that way."; $string['webhook'] = 'Paystack Webhook Url'; -$string['webhook_desc'] = 'Add this Webhook Url to your paystack account developer settings page here https://dashboard.paystack.com/#/settings/developer'; +$string['webhook_desc'] = 'Add this Webhook Url "{$a->webhook}" to your paystack account developer settings page here'; diff --git a/settings.php b/settings.php index ddf40c2..1964b67 100644 --- a/settings.php +++ b/settings.php @@ -31,20 +31,16 @@ /** Paystack live mode enabled.*/ define('LIVE_MODE_ENABLED', 1); -if ($ADMIN->fulltree) { - global $CFG; +global $CFG; +if ($ADMIN->fulltree) { + $webhook = "$CFG->wwwroot/enrol/paystack/webhook.php"; + $url = "https://dashboard.paystack.com/#/settings/developer"; + $text = '

Add this Webhook Url ' . $webhook . ' to your paystack account developer settings page here

'; $settings->add(new admin_setting_heading( 'enrol_paystack_enrolname_short', '', - get_string('pluginname_desc', 'enrol_paystack') - )); - - $settings->add(new admin_setting_description( - 'enrol_paystack/webhook', - get_string('webhook', 'enrol_paystack'), - get_string('webhook_desc', 'enrol_paystack'), - "$CFG->wwwroot/enrol/paystack/webhook.php" + get_string('pluginname_desc', 'enrol_paystack') . " " . $text )); $options = array( @@ -120,10 +116,10 @@ ENROL_EXT_REMOVED_UNENROL => get_string('extremovedunenrol', 'enrol'), ); $settings->add(new admin_setting_configselect( - 'enrol_paystack/expiredaction', - get_string('expiredaction', 'enrol_paystack'), - get_string('expiredaction_help', 'enrol_paystack'), - ENROL_EXT_REMOVED_SUSPENDNOROLES, + 'enrol_paystack/expiredaction', + get_string('expiredaction', 'enrol_paystack'), + get_string('expiredaction_help', 'enrol_paystack'), + ENROL_EXT_REMOVED_SUSPENDNOROLES, $options ));