Contact Listing for WP Job Manager - Version 1.1.0

Version Description

Download this release

Release Info

Developer adampickering
Plugin Icon wp plugin Contact Listing for WP Job Manager
Version 1.1.0
Comparing to
See all releases

Code changes from version 1.0.5 to 1.1.0

includes/forms/cf7.php CHANGED
@@ -77,6 +77,20 @@ class Astoundify_Job_Manager_Contact_Listing_Form_CF7 extends Astoundify_Job_Man
77
 
78
  $recipient = $object->_application ? $object->_application : $object->_candidate_email;
79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  $components[ 'recipient' ] = $recipient;
81
 
82
  return $components;
77
 
78
  $recipient = $object->_application ? $object->_application : $object->_candidate_email;
79
 
80
+ //if we couldn't find the email by now, get it from the listing owner/author
81
+ if ( empty( $recipient ) ) {
82
+
83
+ //just get the email of the listing author
84
+ $owner_ID = $object->post_author;
85
+
86
+ //retrieve the owner user data to get the email
87
+ $owner_info = get_userdata( $owner_ID );
88
+
89
+ if ( false !== $owner_info ) {
90
+ $recipient = $owner_info->user_email;
91
+ }
92
+ }
93
+
94
  $components[ 'recipient' ] = $recipient;
95
 
96
  return $components;
includes/forms/gravityforms.php CHANGED
@@ -51,16 +51,18 @@ class Astoundify_Job_Manager_Contact_Listing_Form_GravityForms extends Astoundif
51
 
52
  $notification[ 'toType' ] = 'email';
53
 
54
- $listing = false;
55
  $fields = $form[ 'fields' ];
56
 
57
  foreach ( $fields as $check ) {
58
- if ( $check[ 'inputName' ] == 'Listing ID' ) {
59
- $listing = $check[ 'id' ];
 
 
60
  }
61
  }
62
 
63
- $object = get_post( $listing );
64
 
65
  if ( ! isset( $this->forms[ $object->post_type ] ) ) {
66
  return;
@@ -72,6 +74,20 @@ class Astoundify_Job_Manager_Contact_Listing_Form_GravityForms extends Astoundif
72
 
73
  $to = $object->_application ? $object->_application : $object->_candidate_email;
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  $notification[ 'to' ] = $to;
76
 
77
  return $notification;
51
 
52
  $notification[ 'toType' ] = 'email';
53
 
54
+ $listing_ID = false;
55
  $fields = $form[ 'fields' ];
56
 
57
  foreach ( $fields as $check ) {
58
+ if ( $check[ 'label' ] == 'Listing ID' ) {
59
+ if ( isset( $entry[ $check[ 'id' ] ] ) ) {
60
+ $listing_ID = $entry[ $check['id'] ];
61
+ }
62
  }
63
  }
64
 
65
+ $object = get_post( $listing_ID );
66
 
67
  if ( ! isset( $this->forms[ $object->post_type ] ) ) {
68
  return;
74
 
75
  $to = $object->_application ? $object->_application : $object->_candidate_email;
76
 
77
+ //if we couldn't find the email by now, get it from the listing owner/author
78
+ if ( empty( $to ) ) {
79
+
80
+ //just get the email of the listing author
81
+ $owner_ID = $object->post_author;
82
+
83
+ //retrieve the owner user data to get the email
84
+ $owner_info = get_userdata( $owner_ID );
85
+
86
+ if ( false !== $owner_info ) {
87
+ $to = $owner_info->user_email;
88
+ }
89
+ }
90
+
91
  $notification[ 'to' ] = $to;
92
 
93
  return $notification;
includes/forms/ninjaforms.php CHANGED
@@ -77,7 +77,9 @@ class Astoundify_Job_Manager_Contact_Listing_Form_NinjaForms extends Astoundify_
77
  }
78
  }
79
 
80
- $object = get_post( $ninja_forms_processing->get_field_value( $field_id ) );
 
 
81
 
82
  if ( ! is_a( $object, 'WP_Post' ) ) {
83
  return $setting;
@@ -89,6 +91,20 @@ class Astoundify_Job_Manager_Contact_Listing_Form_NinjaForms extends Astoundify_
89
 
90
  $setting[ $fake ] = $object->_application ? $object->_application : $object->_candidate_email;
91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  return $setting;
93
  }
94
 
77
  }
78
  }
79
 
80
+ $listing_ID = $ninja_forms_processing->get_field_value( $field_id );
81
+
82
+ $object = get_post( $listing_ID );
83
 
84
  if ( ! is_a( $object, 'WP_Post' ) ) {
85
  return $setting;
91
 
92
  $setting[ $fake ] = $object->_application ? $object->_application : $object->_candidate_email;
93
 
94
+ //if we couldn't find the email by now, get it from the listing owner/author
95
+ if ( empty( $setting[ $fake ] ) ) {
96
+
97
+ //just get the email of the listing author
98
+ $owner_ID = $object->post_author;
99
+
100
+ //retrieve the owner user data to get the email
101
+ $owner_info = get_userdata( $owner_ID );
102
+
103
+ if ( false !== $owner_info ) {
104
+ $setting[ $fake ] = $owner_info->user_email;
105
+ }
106
+ }
107
+
108
  return $setting;
109
  }
110
 
readme.txt CHANGED
@@ -7,7 +7,7 @@ Contributors: Astoundify
7
  Tags: job, job listing, job apply, gravity forms, wp job manager, gravity forms, gravityforms, ninja forms, ninjaforms, contact form 7, cf7
8
  Requires at least: 4.4
9
  Tested up to: 4.4.*
10
- Stable Tag: 1.0.5
11
  License: GPLv3
12
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
13
 
@@ -38,7 +38,7 @@ The plugin can also be used on any theme but no extra styling (outside the CSS t
38
  You **must** create a *hidden* field with the following specific settings:
39
 
40
  * **Label:** Listing ID
41
- * **Allow field to be dynamically populated:** `{entry_id}`
42
 
43
  The Job/Resume listing must also have an email address associated with it, not a URL to a website.
44
 
@@ -75,6 +75,10 @@ If you have purchased Jobify and still have questions, please post on our dedica
75
 
76
  == Changelog ==
77
 
 
 
 
 
78
  = 1.0.5: April, 9, 2015 =
79
 
80
  * Fix: Don't override Contact Form 7 Mail (2) email notification.
7
  Tags: job, job listing, job apply, gravity forms, wp job manager, gravity forms, gravityforms, ninja forms, ninjaforms, contact form 7, cf7
8
  Requires at least: 4.4
9
  Tested up to: 4.4.*
10
+ Stable Tag: 1.1.0
11
  License: GPLv3
12
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
13
 
38
  You **must** create a *hidden* field with the following specific settings:
39
 
40
  * **Label:** Listing ID
41
+ * **Allow field to be dynamically populated:** `{embed_post:ID}`
42
 
43
  The Job/Resume listing must also have an email address associated with it, not a URL to a website.
44
 
75
 
76
  == Changelog ==
77
 
78
+ = 1.1.0: February 25, 2016 =
79
+
80
+ * New: Fall back to the listing owner's user account email if no `_application` field value exists.
81
+
82
  = 1.0.5: April, 9, 2015 =
83
 
84
  * Fix: Don't override Contact Form 7 Mail (2) email notification.
wp-job-manager-contact-listing.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Contact job listings or resume listings with your choice of Gravity Forms, Ninja Forms, or Contact Form 7
6
  * Author: Astoundify
7
  * Author URI: http://astoundify.com
8
- * Version: 1.0.5
9
  * Text Domain: wp-job-manager-contact-listing
10
  */
11
 
5
  * Description: Contact job listings or resume listings with your choice of Gravity Forms, Ninja Forms, or Contact Form 7
6
  * Author: Astoundify
7
  * Author URI: http://astoundify.com
8
+ * Version: 1.1.0
9
  * Text Domain: wp-job-manager-contact-listing
10
  */
11