Uridium Posted December 21, 2021 Posted December 21, 2021 it seems the underboss can remove themselves but the boss cannot remove them other than kicking them.. open up gangs.inc.php and add this >> /* start underboss removal */ public function method_removeUnderboss() { if (!$this->user->info->US_gang) return; $this->construct = false; $gang = new Gang($this->user->info->US_gang); if ($this->user->id != $gang->gang["boss"]) { $this->error("You dont have permission to do this!"); return $this->method_home(); } $id = $this->methodData->user; $newUB = new User($id); $oldUB = new User($gang->gang["underboss"]); if ($newUB->id && $newUB->info->US_gang != $this->user->info->US_gang) { $this->error("This user is not part of this gang!"); return $this->method_home(); } $update = $this->db->prepare("UPDATE gangs SET G_underboss = 0 WHERE G_id = :id"); $update->bindParam(":id", $gang->id); $update->execute(); if ($oldUB->id != 0) { $oldUB->newNotification("You have been demoted from underboss of " . $gang->gang["name"]); } $this->error("Underboss Removal updated", "success"); if ($newUB->id != 0) { $gang->log("was removed as the underboss", $oldUB); } $this->method_home(); } /* end removal */ after public function method_setUnderboss() section now open gangs.tpl.php and add {#if isBoss} <p> <button name="action" value="removeUnderboss" class="btn btn-block btn-default"> Remove Underboss </button> </p> {/if} after your setUnderboss class and your done if you notice on your gangs home page it says Gand Information you can change that word Gang to your gang name.. look for public $gangHome =' and from there just change {_settings "gangName"} to become {name} and your given gang name will appear dont alter the one for public $gangs = ' as that one is for the viewing of listed gangs Quote
URBANZ Posted December 21, 2021 Posted December 21, 2021 (edited) very nice did have a look at making something similar havent been on default GL in a while but here you go this should do the trick. first find the following around line 267 in gang.inc.php $this->html .= $this->page->buildElement("gangHome", $gang); add the following code above foreach ($gang['members'] as $key => $value) { $gang['members'][$key]['underboss'] = ($value['user']['id'] == $g->gang["underboss"] ? 1 : 0); } then replace method_setUnderboss() around line 278 with the following code public function method_setUnderboss() { if (!$this->user->info->US_gang) return; $this->construct = false; $gang = new Gang($this->user->info->US_gang); if ($this->user->id != $gang->gang["boss"]) { $this->error("You dont have permission to do this!"); return $this->method_home(); } $id = (isset($this->methodData->user) ? $this->methodData->user : $gang->gang["underboss"]); $newUB = new User($id); $oldUB = new User($gang->gang["underboss"]); if ($newUB->id && $newUB->info->US_gang != $this->user->info->US_gang) { $this->error("This user is not part of this gang!"); return $this->method_home(); } $ubid = ($oldUB->id == $newUB->id ? 0 : $newUB->id); $update = $this->db->prepare("UPDATE gangs SET G_underboss = :ub WHERE G_id = :id"); $update->bindParam(":ub", $ubid); $update->bindParam(":id", $gang->id); $update->execute(); if ($newUB->id != 0 && $newUB->id != $oldUB->id) { $newUB->newNotification("You have been promoted to the underboss of " . $gang->gang["name"]); $this->error("Underboss updated", "success"); $gang->log("is now the underboss", $newUB); } if ($oldUB->id != 0) { $oldUB->newNotification("You have been demoted from underboss of " . $gang->gang["name"]); $this->error("Underboss removal updated", "success"); $gang->log("was removed as the underboss", $oldUB); } $this->method_home(); } finally find the following in gangs.tpl.php around line 234 {#if isBoss} <p> <button name="action" value="setUnderboss" class="btn btn-block btn-default"> Set Underboss </button> </p> {/if} replace with {#if isBoss} <p> <button name="action" value="setUnderboss" class="btn btn-block btn-default"> Set Underboss </button> </p> {#each members} {#if underboss} <p> <a href="?page=gangs&action=setUnderboss" class="btn btn-block btn-danger"> Remove Underboss </a> </p> {/if} {/each} {/if} Edited December 22, 2021 by URBANZ 1 Quote
Canjucks Posted March 5, 2022 Posted March 5, 2022 What or where do I start with wanting to change the leadership where I can kick the underboss if I am the leader? Is it really just a matter of removing the highlighted code? yes it does ... at least what I tested anyway also on line 399 change from gangpermissions to gangPermissions $permissions = $this->db->prepare("DELETE FROM gangPermissions WHERE GP_user = :u"); I'm also trying to find where I edit the list for edit members like below in gangs, I want to add the underboss to that list when they're set to this as they might do some dodge move and then you may not have someone else to set underboss in replacement: Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.