![]() |
#1
|
||||
|
||||
![]()
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... |
#2
|
||||
|
||||
![]()
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. |
#3
|
||||
|
||||
![]()
eh? Im not sure I understand?
|
#4
|
||||
|
||||
![]()
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. |
#5
|
||||
|
||||
![]()
.....I have no idea what you mean by most of this...I dont know how to write a query or anything!
|
#6
|
||||
|
||||
![]()
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();
__________________
![]() Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site. |
#7
|
||||
|
||||
![]()
Thank you Famer.. Im sorry Im so useless when it comes to coding ;-;..
I appreciate the help though. <3 |
![]() |
|
|
What's New? |
What's Hot? |
What's Popular? |