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 10-16-2016, 08:12 PM
Ittermat's Avatar
Ittermat Ittermat is offline
The awesomesauce
 
Join Date: Feb 2016
Location: in front of my laptop
Posts: 272
Gender: Female
Credits: 32,837
Ittermat is on a distinguished road
Default Item recieved notification?

Is there a way to set it up so the user gets a message when I give them an item through the ACP?

So for example.. I go to- ACP->Inventory->Give item to User

and I give them an item. Lets say I gave them some cat food?

So I'd like a message to be automatically sent to let them know this has been done... whether it says something along the lines of-

Subject: You've been given an item
From: Staff

Congratulations! you've been given a "cat food" (item image) By a staff member! No need to reply to this message! We were just letting you know it was now in your inventory! (links to inventory)

~Atrocity staff


Otherwise they have no idea they've gotten something..and its sorta frusterating...
Reply With Quote
  #2  
Old 10-17-2016, 12:46 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 327,586
Hall of Famer is on a distinguished road
Default

Well Mys v1.3.x does not have a notification system, which is planned for Mys v1.4.0. Its not difficult to make it though, all you need is to create a PM after the insert query of creating an item for user.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #3  
Old 10-17-2016, 01:02 PM
Ittermat's Avatar
Ittermat Ittermat is offline
The awesomesauce
 
Join Date: Feb 2016
Location: in front of my laptop
Posts: 272
Gender: Female
Credits: 32,837
Ittermat is on a distinguished road
Default

eh? Im not sure I understand?
Reply With Quote
  #4  
Old 10-17-2016, 06:46 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 327,586
Hall of Famer is on a distinguished road
Default

Well when you create an item for user inventory, the script will executes an INSERT SQL query, which you can find from file /admincp/inventory.php. Or alternatively, it runs an UPDATE query if the user already has this item. The code should be on these lines:

Code:
            if(is_object($inventory)){
                $newquantity = $inventory->quantity + $mysidia->input->post("quantity");  
                $mysidia->db->update("inventory", array("quantity" => $newquantity), "itemname='{$mysidia->input->post("itemname")}' and owner='{$mysidia->input->post("owner")}'");     
            }
            else{
                $item = $mysidia->db->select("items", array("id","category"), "itemname = '{$mysidia->input->post("itemname")}'")->fetchObject();    
                $mysidia->db->insert("inventory", array("iid" => NULL, "category" => $item->category, "itemname" => $mysidia->input->post("itemname"),
                                                        "owner" => $mysidia->input->post("owner"), "quantity" => $mysidia->input->post("quantity"), "status" => 'Available'));    
            }

So what you need to do is to write another SQL query that adds a private message to the recipient of the item, right below these lines.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #5  
Old 10-17-2016, 09:21 PM
Ittermat's Avatar
Ittermat Ittermat is offline
The awesomesauce
 
Join Date: Feb 2016
Location: in front of my laptop
Posts: 272
Gender: Female
Credits: 32,837
Ittermat is on a distinguished road
Default

.....I have no idea what you mean by most of this...I dont know how to write a query or anything!
Reply With Quote
  #6  
Old 10-17-2016, 09:35 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 327,586
Hall of Famer is on a distinguished road
Default

Alright, I will write the actual code for you, its not very difficult really. My way to do this is to create a PrivateMessage object and call the post() method to send and save it, which may be harder to understand for you than to write an INSERT query. But since you dont even know how to write an INSERT query, it doesnt matter, just copy/paste the code and follow the instructions.

This is the complete code:

Code:
$message = new PrivateMessage;
$message->setrecipient($mysidia->input->post("owner"));
$message->setmessage("You have received an item from Admin", "Dear {$mysidia->input->post("owner")}, you have received {$mysidia->input->post("quantity")} {$mysidia->input->post("itemname")} on Atrocity.com. Enjoy!");
$message->post();
All you need to do is to add it below the if...else statement code I showed you in an earlier post. Search for 'public function add()' in file /admincp/inventory.php, and you should find it around line 29-37.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #7  
Old 10-17-2016, 11:05 PM
Ittermat's Avatar
Ittermat Ittermat is offline
The awesomesauce
 
Join Date: Feb 2016
Location: in front of my laptop
Posts: 272
Gender: Female
Credits: 32,837
Ittermat is on a distinguished road
Default

Thank you Famer.. Im sorry Im so useless when it comes to coding ;-;..

I appreciate the help though. <3
Reply With Quote
Reply

Thread Tools
Display Modes

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 06:16 PM.

Currently Active Users: 453 (0 members and 453 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