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 02-18-2016, 02:51 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,652
Abronsyth is on a distinguished road
Default PM Users for Donation Alert

Resolved

I've looked at the functions that send a PM to a user when they receive a trade, but I couldn't figure this one out.

I'd like to make it so that when users receive a currency donation they also receive a PM that tells them;
"[Username] has sent you [amount] currency!"

Anyone have any ideas?
__________________
My Mods Site (1.3.4, 2020 Mods)

Last edited by Abronsyth; 02-18-2016 at 03:57 PM.
Reply With Quote
  #2  
Old 02-18-2016, 03:29 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 86,938
Kyttias is on a distinguished road
Default

Try:
PHP Code:
$pm = new PrivateMessage(); 
$pm->setsender('SYSTEM'); // Or... whatever? You can change this.
$pm->setrecipient(htmlentities(addslashes(trim($recipient->username))));
$pm->setmessage("Donation For You!""{$mysidia->user->username} has sent you {$amount} {$mysidia->settings->cost}!");
$pm->post(); 
You could probably also have the sender be the user?
PHP Code:
$pm->setsender($mysidia->user->username); 
Here's the whole donate.php with the addition:
  Spoiler: donate.php 
PHP Code:
<?php

use Resource\Native\Integer;
use 
Resource\Native\String;

class 
DonateController extends AppController{

    public function 
__construct(){
        
parent::__construct("member");
    }
    
    public function 
index(){
        
$mysidia Registry::get("mysidia");        
        if(
$mysidia->input->post("recipient") and $mysidia->input->post("amount")){
            
$recipient preg_replace("/[^a-zA-Z0-9\\040]/"""$mysidia->input->post("recipient"));
            
$amount $mysidia->input->post("amount");
            
$recipient = new Member($recipient);            
             if(
$amount 0) throw new DonationException("negative");
            elseif(
$mysidia->user->money $amount) throw new DonationException("funds");
            elseif(
$recipient->username == $mysidia->user->username) throw new DonationException("user");
            else{
                
$mysidia->user->donate($recipient$amount);
                
$this->setField("recipient", new String($recipient->username));
                
$this->setField("amount", new Integer($amount));

                
$pm = new PrivateMessage(); 
                
$pm->setsender('SYSTEM'); // Or... whatever? You can change this.
                
$pm->setrecipient(htmlentities(addslashes(trim($recipient->username))));
                
$pm->setmessage("Donation Acquired""{$mysidia->user->username} has sent you {$amount} {$mysidia->settings->cost}!");
                
$pm->post();  
                
            }    
            return;
        }
    }
}
?>


Untested, of course. Luckily it appears to be super simple to implement notifications via PM!
__________________
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; 02-18-2016 at 03:31 PM.
Reply With Quote
  #3  
Old 02-18-2016, 03:56 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,652
Abronsyth is on a distinguished road
Default

Sweet, it works perfectly!

Thank you very much <3
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #4  
Old 04-06-2016, 12:19 PM
NobodysHero's Avatar
NobodysHero NobodysHero is offline
Co-Owner of MystFell
 
Join Date: Nov 2013
Posts: 144
Gender: Female
Credits: 18,402
NobodysHero is on a distinguished road
Default

Awesome! That was a great idea, Abronsyth! Thanks for sharing. 8D
Reply With Quote
  #5  
Old 07-04-2020, 01:14 AM
Micolai's Avatar
Micolai Micolai is offline
Loving Mysidia!
 
Join Date: May 2020
Location: Tennessee
Posts: 130
Gender: Female
Credits: 26,495
Micolai is on a distinguished road
Default

For some reason I keep getting an email that sends out to users after donations are made to them.
__________________
"You try you fail, you try you fail, but the only true failure is if you stop trying. So try again." - Haunted Mansion

Last edited by Micolai; 07-04-2020 at 01:27 AM.
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 05:27 AM.

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