| @@ -352,15 +352,18 @@ | ||
| 352 | 352 | |
| 353 | 353 | $value = implode( '<br> ', $serialized_value ); |
| 354 | 354 | } |
| 355 | 355 | } elseif ( $field['type'] == 'signature_field' ) { |
| 356 | - $url = content_url() . $value; | |
| 357 | - $value = $url; | |
| 356 | + $url = $value; | |
| 358 | 357 | |
| 359 | 358 | if ( isset( $_REQUEST['action'] ) != 'weforms_pdf_download' ) { |
| 359 | + $url = content_url() . '/' . $value; | |
| 360 | 360 | $value = sprintf( '<img src="%s">', $url ); |
| 361 | 361 | $value .= sprintf( '<a style="margin-left: -200px" href="%s">Download</a>', $url ); |
| 362 | 362 | } |
| 363 | + else{ | |
| 364 | + $value = sprintf( '<img src="%s">', $url ); | |
| 365 | + } | |
| 363 | 366 | } |
| 364 | 367 | |
| 365 | 368 | $this->fields[ $result->meta_key ]['value'] = apply_filters( 'weforms_entry_meta_field', $value, $field ); |
| 366 | 369 | } |
| @@ -416,6 +419,36 @@ | ||
| 416 | 419 | return; |
| 417 | 420 | } |
| 418 | 421 | |
| 419 | 422 | return $wpdb->get_row( "SELECT * FROM {$wpdb->prefix}weforms_payments WHERE entry_id = {$this->id} " ); |
| 423 | + } | |
| 424 | + | |
| 425 | + /** | |
| 426 | + * Get Form from entry id. | |
| 427 | + * | |
| 428 | + * @param int $entry_id The entry id. | |
| 429 | + * @global object $wpdb The Wordpress database object. | |
| 430 | + * | |
| 431 | + * @return object The form object. | |
| 432 | + */ | |
| 433 | + public static function get_form( $entry_id ) { | |
| 434 | + $form_id = self::get_form_id( $entry_id ); | |
| 435 | + | |
| 436 | + return ! empty( $form_id ) ? weforms()->form->get( $form_id ) : null; | |
| 437 | + } | |
| 438 | + | |
| 439 | + /** | |
| 440 | + * Get form id from entry id. | |
| 441 | + * | |
| 442 | + * @param int $entry_id The entry id. | |
| 443 | + * @global object $wpdb The Wordpress database object. | |
| 444 | + * | |
| 445 | + * @return int The form id. | |
| 446 | + */ | |
| 447 | + public static function get_form_id( $entry_id ) { | |
| 448 | + global $wpdb; | |
| 449 | + | |
| 450 | + $results = $wpdb->get_results( "SELECT form_id FROM {$wpdb->prefix}weforms_entries WHERE id = {$entry_id} " ); | |
| 451 | + | |
| 452 | + return ! empty( $results[0]->form_id ) ? $results[0]->form_id : null; | |
| 420 | 453 | } |
| 421 | 454 | } |