File tree 1 file changed +13
-1
lines changed
admin/controller/settings
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,10 @@ function delete() {
39
39
$ site_id = $ this ->request ->post ['site_id ' ] ?? $ this ->request ->get ['site_id ' ] ?? false ;
40
40
41
41
if ($ site_id ) {
42
+ $ active_deleted = false ;
43
+ $ active_site_id = $ this ->session ->get ('site_id ' );
44
+
45
+
42
46
if (is_numeric ($ site_id )) {
43
47
$ site_id = [$ site_id ];
44
48
}
@@ -49,6 +53,10 @@ function delete() {
49
53
if ($ site ) {
50
54
SitesList::deleteSite ($ site );
51
55
}
56
+
57
+ if ($ id == $ active_site_id ) {
58
+ $ active_deleted = true ;
59
+ }
52
60
}
53
61
54
62
$ sites = new SiteSQL ();
@@ -60,6 +68,10 @@ function delete() {
60
68
61
69
if ($ result && isset ($ result ['site ' ])) {
62
70
$ this ->view ->success [] = ucfirst (__ ('site ' )) . __ (' deleted! ' );
71
+ //if active site was deleted set the next valid site as active
72
+ if ($ active_deleted ) {
73
+ $ this ->setSite ();
74
+ }
63
75
} else {
64
76
$ this ->view ->errors [] = sprintf (__ ('Error deleting %s! ' ), __ (' site ' ));
65
77
}
@@ -79,7 +91,7 @@ function index() {
79
91
} else {
80
92
$ options ['site_id ' ] = Admin :: siteAccess ();
81
93
}
82
-
94
+
83
95
$ page = $ this ->request ->get ['page ' ] ?? 1 ;
84
96
$ limit = $ this ->request ->get ['limit ' ] ?? 10 ;
85
97
You can’t perform that action at this time.
0 commit comments