Disabling clicks by other users

Forum
Last Post
Threads / Messages

GeneticAlpha

Loving Mysidia!
Member
Joined
May 24, 2020
Messages
287
Points
18
Age
31
Location
Tennessee
Mysidian Dollar
13,377
RESOLVED

I feel like I've been posting a lot lately lol sorry guys... I'm wondering if there is a way for me to disable clicks by other users. Meaning, say I'm a member, I can click my horse, but other people can't. How could I set this up?

The reason I'm wanting to do this is I plan to turn the 'Level up' system into a raising system, where I change the level up title to 'Feed' that way the member basically feeds their horse themselves everyday and that raises the adoptable to get them to age.
 
Last edited:
there are 2 ways to do archive this first the "notsoeasyone"
you can try adding a if to the levelup.php and levelupview.php
it can be something like:
if(adopt->getOwner() == $mysidia->user->username){levelupcode goes here}
else{ $document->addLangvar("you can't feed others pets");} but if your levelup.php and levelupview.php is very modified then it will be kind of tricky to put everything in place without breaking something...

now the easy way:
look for this code in levelup.php
PHP:
        elseif($this->settings->owner == "disabled" and $this->adopt->getOwner() == $mysidia->user->username){
 			throw new LevelupException("owner");	           
        }

and add this below:
PHP:
        elseif($this->adopt->getOwner() != $mysidia->user->username){
 			throw new LevelupException("user");
}
(note this is just a copy/paste/edit of the original code posted above)

to add the message that will appear for the users you must open lang_levelup.php and add this:
PHP:
$lang['user'] = "Unfortunately, the admin has disabled the option for users to click others adoptables.";
(you can edit the message... that's just a copy/paste/edit of the error for the owner... when they can't levelup their own adopts)

I test the code on my site and so far it works for me... i can only level up my own adopts, for the rest it gives me an error. i recommend doing a backup of your files before adding the code and do a heavy test of it, to see if it works for you too.
to disable the code just add // before elseif and throw or just delete it.

VERY IMPORTANT!: with this enabled once the user logs out he/she can't level up any of the adopts. this means not even guest can help the adopts to grow up. maybe someone can find a way to allow guest to level the adopts...

take in mind that the daycare will not work correctly with this, so you will probably need to disable the daycare or edit it to show only the owned adoptables... but for that you just need to go to the myadopt page to see them. so there's no point for the daycare.
 
Last edited:
there are 2 ways to do archive this first the "notsoeasyone"
you can try adding a if to the levelup.php and levelupview.php
it can be something like:
if(adopt->getOwner() == $mysidia->user->username){levelupcode goes here}
else{ $document->addLangvar("you can't feed others pets");} but if your levelup.php and levelupview.php is very modified then it will be kind of tricky to put everything in place without breaking something...

now the easy way:
look for this code in levelup.php
PHP:
        elseif($this->settings->owner == "disabled" and $this->adopt->getOwner() == $mysidia->user->username){
 			throw new LevelupException("owner");	           
        }

and add this below:
PHP:
        elseif($this->adopt->getOwner() != $mysidia->user->username){
 			throw new LevelupException("user");
}
(note this is just a copy/paste/edit of the original code posted above)

to add the message that will appear for the users you must open lang_levelup.php and add this:
PHP:
$lang['user'] = "Unfortunately, the admin has disabled the option for users to click others adoptables.";
(you can edit the message... that's just a copy/paste/edit of the error for the owner... when they can't levelup their own adopts)

I test the code on my site and so far it works for me... i can only level up my own adopts, for the rest it gives me an error. i recommend doing a backup of your files before adding the code and do a heavy test of it, to see if it works for you too.
to disable the code just add // before elseif and throw or just delete it.

VERY IMPORTANT!: with this enabled once the user logs out he/she can't level up any of the adopts. this means not even guest can help the adopts to grow up. maybe someone can find a way to allow guest to level the adopts...

take in mind that the daycare will not work correctly with this, so you will probably need to disable the daycare or edit it to show only the owned adoptables... but for that you just need to go to the myadopt page to see them. so there's no point for the daycare.

Hmm, I tried the steps you put in quotes, but it didn't work >_< it was allowing the clicks anyway and I was a little confused on the first steps you mentioned that might not work if the files are modified. I'm not sure if my files are considered heavily modified or not, I didn't set any of them up. they were all installed when I got my hosting through Mysidia when I signed up. Thanks for helping me! I really appreciate it.
 
weird the code is not working for you, i tested it many times and worked, I even manage to make it part of the options in the admin panel, like the disable user to click their own adopts.
i can't truly help you with the other option, my levelup is very edited, i did try to add the first option to the levelupview.php, and got the message i can't feed others adopts, but the click still counted and got the same result in the levelup.php the click still counted.

the code in the quotes should work, because based on something that's already in the site... the other option i can think is to edit directly the
PHP:
        elseif($this->settings->owner == "disabled" and $this->adopt->getOwner() == $mysidia->user->username){
             throw new LevelupException("owner");               
        }

to something like this:
PHP:
        elseif($this->adopt->getOwner() != $mysidia->user->username){
             throw new LevelupException("owner");               
        }
or like this:
PHP:
        elseif($this->settings->owner == "enabled" and $this->adopt->getOwner() != $mysidia->user->username){
             throw new LevelupException("owner");               
        }
if one of that options works then just edit the lang_levelup $owner to the message you want to display.
The only thing about editing this code is that the option to enable/disable the user to click their own adopts will become unusable, but if the second option works, then it will become the option to enable/disable the users from clicking others adopts.

just remember to backup your file before adding/editing something.
sorry I can't be of more help in this area. and sorry if i don't make sense some times... English is not my native language, so most of the time is kind of complicated for me to explain something >_>
 
Okay, so, your very first post the "Easy way" quoted example was right. I wasn't adding the code in the right spot and it now works. Thank you so very much for your help!
 
glad it worked for you ^^

I really do appreciate the help :D it's been a dream of mine for a really long time to get this up and running and I feel like for the most part what stuff I want is easy stuff, just time consuming and I don't always know what I need to do to get what I am wanting done, etc so I end up having to ask questions a lot lol. But I feel like I usually follow tutorials pretty well. One of my friends is helping me learn where certain files are in the system because a big problem was me not knowing where I needed to go in my stuff to do certain things, etc.

Is there by chance a way I can easier contact you to ask you questions? If not that's okay, I just know these forums are a little slow at getting answers lol. I don't have many things right now I'm needing help with, just a couple.
 
is more easy for me here in the forum, usually i check it every 2 hours XD
but if for some reason cant find me, the you can contact me on discord, or by email.
(will send the info by a pm ^^)
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,274
Messages
33,114
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top