View Single Post
  #1  
Old 11-10-2014, 01:01 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 90,947
Kyttias is on a distinguished road
Default Condition based on highest level adopt owned? *solved*

How can I check if a user owns at least one adoptable above a certain level?

I'd like to bar entry to certain pages until the user has an adoptable "strong enough" to protect them there. I don't need a guide on how to make a custom page, just... the database statement.

edit: Nvm, after a lot of tinkering, I got it:
PHP Code:
#Check if user has an adoptable at least lvl 10
$mysidia Registry::get("mysidia");
$req_lvl 10;
$stmt $mysidia->db->select("owned_adoptables", array("currentlevel"), "owner='{$mysidia->user->username}'");
if (
$stmt >= $req_lvl) {  
    
$msg "You have a lvl {$req_lvl}{$mysidia->user->username}? Awesome!";
}
else {
    
$msg "{$mysidia->user->username}, you do not have a lvl {$req_lvl}.";

But while I'm here, any way I can get the name of said strongest adoptable?
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.

Last edited by Kyttias; 11-10-2014 at 07:31 PM.
Reply With Quote