From bc9297b682328f3764b7b3875297274143e17d8d Mon Sep 17 00:00:00 2001
From: Julian Wendling <xdeavenx@gmail.com>
Date: Sun, 3 Oct 2021 10:01:13 +0900
Subject: [PATCH] CHANGE save and return return to link after approving a
 course

---
 pending.php | 13 ++++++++++++-
 version.php |  2 +-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/pending.php b/pending.php
index b1b2336..3b0b36b 100644
--- a/pending.php
+++ b/pending.php
@@ -64,7 +64,18 @@ if (!empty($approve) and confirm_sesskey()) {
 
     if ($courseid !== false) {
         if (has_capability('moodle/course:update', context_course::instance($courseid))) {
-            redirect(new moodle_url('/course/edit.php', ['id' => $courseid, 'returnto' => 'pending']));
+            // > Hsh julian wendling - changed "save and return" link to go back to hsh pending page
+            $returnurl = new moodle_url($baseurl);
+            
+            $saveandbackurl = new moodle_url($CFG->wwwroot . '/course/edit.php', array(
+                        'id' => $courseid,
+                        'sesskey' => sesskey(),
+                        'returnto' => 'url',
+                        'returnurl' => $returnurl->out(false))
+                    );
+            
+            redirect(new moodle_url($saveandbackurl->out()));
+            // < Hsh julian wendling
         } else {
             redirect(new moodle_url('/course/view.php', ['id' => $courseid]));
         }
diff --git a/version.php b/version.php
index ca56158..52de53f 100644
--- a/version.php
+++ b/version.php
@@ -17,7 +17,7 @@
 defined('MOODLE_INTERNAL') || die();
 
 $plugin->component = 'local_hsh';
-$plugin->version = 2021022300;
+$plugin->version = 2021022301;
 $plugin->release = '3.3 (Build: 2015042300)';
 $plugin->requires = 2014051200;
 $plugin->maturity = MATURITY_STABLE;
-- 
GitLab