SHARE
TWEET

Untitled

a guest Jun 19th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function checkin_event( $contenu = '' ) {
  2.     global $event_clicked;
  3.     global $register_type;
  4.     if ( is_user_logged_in() ) {
  5.         $fs_current_user = wp_get_current_user();
  6.         $user_value = $fs_current_user->ID;
  7.         $pseudo = $fs_current_user->user_nicename;
  8.            
  9.         global $wpdb;
  10.         $usercontrol = $wpdb->get_var( $wpdb->prepare("SELECT check_user FROM tw_twunchin WHERE check_event = $event_clicked AND check_user = $user_value"));
  11.        
  12.         if ( !$usercontrol && !dejaIndecis() && ( get_the_ID() == $event_clicked ) ) {         
  13.  
  14.             $wpdb->query("INSERT INTO tw_twunchin(check_event, check_user, check_type, check_date) VALUES('$event_clicked', '$user_value', '$register_type', NOW())");
  15.            
  16.             $nombre_participants = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM tw_twunchin WHERE check_event = $event_clicked"));
  17.            
  18.             $wpdb->update( $wpdb->posts, array('inscrits_count' => $nombre_participants), array('ID' => $event_clicked) );
  19.            
  20.             @wp_mail( get_option('admin_email'), "Twunch checkin - ". html_entity_decode(get_the_title(get_the_ID())). " : ". $nombre_participants." inscrits", "L utilisateur ".$pseudo." (".$user_value.")  est inscrit pour le twunch : ".html_entity_decode(get_the_title(get_the_ID())), $headers);
  21.            
  22.             $contenu = "<div id='twittos-inscrits' class='coin_6px'>".listeInscrits()."</div>";
  23.             $contenu.= "".listeIndecis()."</div> <!-- END :: Single Twunch -->";
RAW Paste Data
Top