Posso ricevere una notifica e -mail quando i media vengono caricati nella libreria multimediale?

wordpress.stackexchange https://wordpress.stackexchange.com/questions/46351

  •  01-11-2019
  •  | 
  •  

Domanda

Ho un caricatore front -end solo per i membri, utilizzando questo codice:

<?php
function insert_attachment_form($postID) {
?>
<form id="file-form" name="file-form" method="POST" action="" enctype="multipart/form-data" >
    <input type="file" id="async-upload" name="async-upload" />
    <input type="hidden" name="postID" value="<?php echo $postID; ?>" />
    <?php wp_nonce_field('client-file-upload', 'client-file-upload'); ?>
    <input type="submit" value="Upload" id="submit" name="submit" />
</form>
<?php } 

function process_attachment() {
// verify this came from the our screen and with proper authorization,
// because save_post can be triggered at other times
if ( !wp_verify_nonce( $_POST['client-file-upload'], 'client-file-upload') ) {
    return $post->ID;
}

// Is the user allowed to edit the post or page?
if ( !current_user_can( 'publish_posts', $post->ID ))
    return $post->ID;

if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_FILES )) {
    require_once(ABSPATH . 'wp-admin/includes/admin.php');
    $id = media_handle_upload('async-upload', $_POST['postID']);
    unset($_FILES);
}
}?>

Idealmente, vorrei avere il caricatore di file WordPress di drag-and-drop qui, o almeno un indicatore di avanzamento. Ma sto divagando (però, punti bonus se puoi guidarmi verso questo) - questa sarà un'area in cui i clienti caricano file per noi. Ho bisogno di un'e -mail per essere generata in qualche modo insieme a questo, a un amministratore. Qualche idea?

Nessuna soluzione corretta

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a wordpress.stackexchange
scroll top