• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

How to make that vice leaders can invite member to guild too?

It's just so much more work then just having the leader, comparing rank etc.
 
It should be done, because then why having vice-leaders? They just have a different rank, the idea is that they should be able to invite players too.
 
I have not tested this, but you are more than welcome to give it a try if you'd like.

Locate /system/application/models/guilds_model.php and find public function isGuildLeader($id) {. Please paste the following code snippet above it.
PHP:
    public function hasViceLeader($id) {
        $this->load->database();
        $viceRank = 2;
        return $this->db->query( 'SELECT `p`.`id`, `p`.`name` FROM `guild_ranks` AS `r` LEFT JOIN `players` AS `p` ON `p`.`rank_id` = `r`.`id` WHERE `r`.`guild_id` = '.(int) $id.' AND `r`.`level` = '.(int) $viceRank.' AND `p`.`account_id` = '.(int) $_SESSION['account_id'].';' )->num_rows == 0 ? false: true;
    }
Now locate /system/application/controllers/guilds.php and find if(!$this->guilds_model->isGuildLeader. Replace the entire line with the following code snippet.
PHP:
if(!$this->guilds_model->isGuildLeader($data['guild'][0]['ownerid']) or !$this->guilds_model->hasViceLeader($id)) $ide->redirect(WEBSITE."/index.php/guilds");

EDIT: Make sure the last line is within the invite($id) function. I noticed there are several of those lines. For me, it is the second one.
 
I have read the code and it seems that all vice-leaders will be able to invite players, but what about leaders?

The function just read the owner of the guild, but it should let invite to vice leaders and leaders too.

Going to test it in a few minutes.
 
PHP:
!$this->guilds_model->isGuildLeader($data['guild'][0]['ownerid'])
?
 
Ah ok... Well tested it and doesn't work... it doesn't show the option to vice-leaders or leaders that can invite players, and how this doesn't appear, it seems that they can't invite.
 
Oh, obviously. Sorry about that.

Open /system/application/controllers/guilds.php. Locate the management($id) function. Within it you will find this line:
PHP:
if(!$this->guilds_model->isGuildLeader($data['guild'][0]['ownerid'])) $ide->redirect(WEBSITE."/index.php/guilds");
Change it to:
PHP:
if(!$this->guilds_model->isGuildLeader($data['guild'][0]['ownerid']) and !$this->guilds_model->hasViceLeader($id)) $ide->redirect(WEBSITE."/index.php/guilds");

Also please excuse the fact that I made a mistake in one of the previous code snippets. Change or to and.
PHP:
if(!$this->guilds_model->isGuildLeader($data['guild'][0]['ownerid']) or !$this->guilds_model->hasViceLeader($id)) $ide->redirect(WEBSITE."/index.php/guilds");
 
It still doesn't show anything, Im logged with a leader player and I can't invite players...
 
/system/application/controllers/guilds.php, find function view($id = null, $action = 0). Below
PHP:
$data['guild'] = $guild;
Add
PHP:
$this->load->model("guilds_model");
$data['viceleaders'] = $this->guilds_model->hasViceLeader($id);
/system/application/views/view_guild.php, find
PHP:
if($ide->isLogged() && in_array($guild->getOwner(), $account_players)) {
and change it to
PHP:
if(($ide->isLogged() && in_array($guild->getOwner(), $account_players)) or $viceleaders) {


It works for me now. Although it still shows certain options like Change MOTD, delete guild etc you are not actually able to modify them with a vice leader.
 
Back
Top