Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 12-29-2016, 09:31 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 113,113
Abronsyth is on a distinguished road
Default MySQL Help

I know the title is pretty vague but I am hoping someone can help me out here.

So the way the friends system works is it adds a user's id under the friend part in the database, but because users can have multiple friends it shows like "1, 16, 33" (for example). Clearly the comma is a separator, but I do not understand how new entries are added in that format or how the script knows to read each individual entry and use that information?

What I am trying to do is set up a system to record which users have used each promocode. So a user uses a promocode and it adds their ID to the list of those who've used it. Then I can add a setting option so that the admin can choose to make the promocode only redeemable once per user.

I can also eventually use it to set up a more stream-lined quest system than what I am currently using.

I found this chunk in class_friend.php which I think is relevant:
PHP Code:
   public function append($uid){
      
$mysidia Registry::get("mysidia");
      
$this->getfriendlist();
      
$friendsarray $this->friendlist->getids();      
      if(!
$this->isfriend$friendsarray[] = $uid;   
      
sort($friendsarray);     
      
$friends = (count($friendsarray) == 1)?$uid:implode(","$friendsarray);      
      
$mysidia->db->update("users", array("friends" => $friends), "username='{$this->user->username}'");
   } 
But I am having a hard time figuring this out Here's what I've added to class_promocode.php so far;
PHP Code:
  private function checkredeem() {
      
//This will check to see which users have already redeemed this code.
      
$mysidia Registry::get("mysidia");
      
$redeemed $mysidia->db->select("promocodes", array("redeemed"), "pid='{$this->pid}'")->fetchColumn();
      
$redeem = {$mysidia->user->uid};
      if(empty(
$this->redeemable)) return TRUE;
      else{
        if(
$redeemed){throw new AlreadyRedeemedException($mysidia->lang->redeemed);}
        
//Need to work on this part still...need to make it so that when they redeem it, they're ID is added to the list so they can't redeem it again
        
else {$mysidia->db->update("promocodes", array("redeemed" => $redeem), "pid='{$this->pid}'");}
        return 
TRUE;
      }
  } 
(I have lang_promo, admincp/promo, and admincp/view/promoview all ready to go, as soon as I get this figured out I'll release it as an actual mod)

But this is all I've got and right now it's pretty useless until I figure out how to properly add uids to the database.

If someone could help me I would really, really appreciate it <3
__________________
My Mods Site (1.3.4, 2020 Mods)

Last edited by Abronsyth; 12-29-2016 at 12:39 PM.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 02:39 PM.

Currently Active Users: 597 (0 members and 597 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636