Пример #1
0
 function __construct($id = false)
 {
     $this->mensaje = new Mensajes();
     if (!$id) {
         return;
     }
     /*ESTO ES SOLO CUANDO SE PIDE INFO*/
     $data = get_post_meta($id);
     $this->ID = $id;
     $this->timestamp = isset($data['timestamp']) ? reset($data['timestamp']) : false;
     $this->timestamp_legible = $this->timestamp ? date_i18n('Y-m-d H:i:s', $this->timestamp) : false;
     $this->clase = isset($data['clase']) ? reset($data['clase']) : false;
     $this->comprador = isset($data['comprador']) ? reset($data['comprador']) : false;
     $this->bici = isset($data['bici']) ? unserialize(reset($data['bici'])) : false;
     $this->bici_id_real = $this->bici ? $this->get_id_bici_front() : '';
     $this->expiracion = isset($data['expiracion']) ? reset($data['expiracion']) : expiracion_primer_paquete(true);
 }
Пример #2
0
 public function get_paquete()
 {
     if (!$this->forze) {
         if (is_user_logged_in() && get_user_meta($this->comprador, 'ya_compro', true)) {
             return;
         }
     }
     $precio = $this->filtros_precio(200);
     if (is_user_logged_in() && !get_user_meta($this->comprador, 'ya_compro', true) && get_user_meta($this->comprador, 'codigo_aplicado', true)) {
         $precio = 150;
     }
     $this->data = array('ID' => 'regalo', 'cantidad' => 1, 'precio' => $precio, 'color' => 'red', 'expiracion' => expiracion_primer_paquete());
 }
Пример #3
0
 function sumar_clases($user_id = 0, $numero_clases = 0, $expiracion = false)
 {
     if (!$user_id || !$numero_clases) {
         return;
     }
     if ($expiracion === false) {
         $expiracion = expiracion_primer_paquete(true);
     }
     $clases = numero_clases_user($user_id, true);
     for ($i = 1; $i <= (int) $numero_clases; $i++) {
         $clases[] = $expiracion;
     }
     $clases = array_filter($clases);
     update_user_meta($user_id, 'cantidad_clases', $clases);
 }