Plugin Directory

Changeset 2344280


Ignore:
Timestamp:
07/21/2020 06:35:53 PM (6 years ago)
Author:
mrityunjay
Message:

Email notification to admin user added when a file is submitted.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • smart-wetransfer/trunk/smart-wetransfer.php

    r2165918 r2344280  
    33Plugin Name: Smart WeTransfer
    44Plugin URI: https://grittechnologies.com/plugins
    5 Version: 1.2
     5Version: 1.3
    66Author: Mrityunjay Kumar
    77Author URI: https://profiles.wordpress.org/mrityunjay/
     
    2323
    2424function wetransfer_getForm(){
     25    ob_start();
     26    if(isset($_SESSION['grit_msg'])){
     27        echo "<h3 style='color:green'>".$_SESSION['grit_msg']."</h3>";
     28    }
     29    unset($_SESSION['grit_msg']);
    2530    ?>
    2631   
     
    8691    <p><br/><input type='submit' class='btn btn-primary' name='submit_file' value='<?php _e('Submit', 'wetransfer');?>'></p>
    8792    </form><?php
     93   
     94    return ob_get_clean();
    8895}
    8996   
     
    130137$save_failed = __('<span class="error">Data did not save.</span>', 'wetransfer');
    131138$dataArray['save_failed'] =  $save_failed;
     139}else{
     140   
     141add_action('init','smart_wetransfer_send_notification');
     142function smart_wetransfer_send_notification(){
     143//php mailer variables
     144  $to = get_option('admin_email');
     145  $subject = "New file submitted to wetransfer account";
     146  $message = "A new file submitted to your wetransfer account by ".$_POST['your_email'].". Link to the file is ".$_POST['wt_embed_output'];
     147  $headers = 'From: '. $_POST['your_email'] . "\r\n" .
     148  'Reply-To: ' . $_POST['your_email'] . "\r\n";
     149
     150
     151//Here put your Validation and send mail
     152$sent = wp_mail($to, $subject, strip_tags($message), $headers);
     153
     154$_SESSION['grit_msg'] = 'Success';
     155
     156}   
     157   
     158   
    132159}
    133160}
Note: See TracChangeset for help on using the changeset viewer.