Contact Listing for WP Job Manager - Version 1.4.1

Version Description

Download this release

Release Info

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

Code changes from version 1.3.0 to 1.4.1

includes/class-wp-job-manager-contact-listing-form.php CHANGED
@@ -1,153 +1,158 @@
1
- <?php
2
- /**
3
- * Base form class. Grab the form values, add settings, and
4
- * output the correct form.
5
- *
6
- * @since WP Job Manager - Contact Listing 1.0.0
7
- *
8
- * @return void
9
- */
10
- class Astoundify_Job_Manager_Contact_Listing_Form extends Astoundify_Job_Manager_Contact_Listing {
11
-
12
- /**
13
- * @var $jobs_form_id
14
- */
15
- public $forms;
16
-
17
- /**
18
- * Set the form values, remove the default application template
19
- * and attach our own. Call and of the children's special actions.
20
- *
21
- * @since WP Job Manager - Contact Listing 1.0.0
22
- *
23
- * @return void
24
- */
25
- public function __construct() {
26
- if ( ! class_exists( 'WP_Job_Manager' ) ) {
27
- return;
28
- }
29
-
30
- global $job_manager;
31
-
32
- $this->forms = apply_filters( 'job_manager_contact_listing_forms', array(
33
- 'job_listing' => array(
34
- 'contact' => get_option( 'job_manager_form_contact', false )
35
- ),
36
- 'resume' => array(
37
- 'contact' => get_option( 'resume_manager_form_contact', false )
38
- )
39
- ) );
40
-
41
- add_filter( 'job_manager_settings', array( $this, 'job_manager_settings' ) );
42
- add_filter( 'resume_manager_settings', array( $this, 'resume_manager_settings' ) );
43
-
44
- if ( ! parent::$active_plugin ) {
45
- return;
46
- }
47
-
48
- $this->setup_actions();
49
-
50
- // Output the shortcode
51
-
52
-
53
- if ( ! get_option( 'resume_manager_force_application' ) ) {
54
- add_action( 'job_manager_application_details_email', array( $this, 'job_manager_application_details_email' ), 5 );
55
- }
56
-
57
- if ( class_exists( 'WP_Resume_Manager' ) ) {
58
- global $resume_manager;
59
-
60
- remove_action( 'resume_manager_contact_details', array( $resume_manager->post_types, 'contact_details_email' ) );
61
- add_action( 'resume_manager_contact_details', array( $this, 'job_manager_application_details_email' ) );
62
- }
63
- }
64
-
65
- /**
66
- * Add settings fields to select the appropriate form for each listing type.
67
- *
68
- * @since WP Job Manager - Contact Listing 1.0.0
69
- *
70
- * @return void
71
- */
72
- public function job_manager_settings($settings) {
73
- $args = array(
74
- 'post_type' => 'job_listing',
75
- 'key' => 'job_listings',
76
- 'option' => 'job_manager'
77
- );
78
-
79
- $settings = $this->add_settings( $args, $settings );
80
-
81
- return $settings;
82
- }
83
-
84
- /**
85
- * Add settings fields to select the appropriate form for each listing type.
86
- *
87
- * @since WP Job Manager - Contact Listing 1.0.0
88
- *
89
- * @return void
90
- */
91
- public function resume_manager_settings($settings) {
92
- $args = array(
93
- 'post_type' => 'resume',
94
- 'key' => 'resume_listings',
95
- 'option' => 'resume_manager'
96
- );
97
-
98
- $settings = $this->add_settings( $args, $settings );
99
-
100
- return $settings;
101
- }
102
-
103
- private function add_settings( $args, $settings ) {
104
- $post_type = $args[ 'post_type' ];
105
- $forms = $this->forms[ $post_type ];
106
-
107
- $p_type_obj = get_post_type_object( $post_type );
108
-
109
- foreach ( $forms as $key => $value ) {
110
- $settings[ $args[ 'key' ] ][1][] = array(
111
- 'name' => sprintf( '%s_form_%s', $args[ 'option' ], $key ),
112
- 'std' => null,
113
- 'label' => sprintf( __( '%s a %s Form', 'wp-job-manager-contact-listing' ), ucfirst( $key ), $p_type_obj->labels->singular_name ),
114
- 'desc' => '',
115
- 'type' => 'select',
116
- 'options' => $this->get_forms()
117
- );
118
- }
119
-
120
- return $settings;
121
- }
122
-
123
- /**
124
- * Output the necessary form shortocde.
125
- *
126
- * @since WP Job Manager - Contact Listing 1.0.0
127
- *
128
- * @return void
129
- */
130
- public function job_manager_application_details_email( $apply ) {
131
- global $job_manager;
132
-
133
- $plugin = parent::$active_plugin;
134
- $post = get_post();
135
-
136
- if ( ! is_a( $post, 'WP_Post' ) ) {
137
- return;
138
- }
139
-
140
- $form = isset( $this->forms[ $post->post_type ][ 'contact' ] ) ? $this->forms[ $post->post_type ][ 'contact' ] : false;
141
-
142
- if ( ! $form ) {
143
- return;
144
- }
145
-
146
- // Only remove the default text when contact form is set.
147
- remove_action( 'job_manager_application_details_email', array( $job_manager->post_types, 'application_details_email' ) );
148
-
149
- // Add contact form content
150
- do_action( 'job_manager_contact_listing_form_' . $plugin, $form );
151
- }
152
-
153
- }
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Base form class. Grab the form values, add settings, and
4
+ * output the correct form.
5
+ *
6
+ * @since WP Job Manager - Contact Listing 1.0.0
7
+ *
8
+ * @return void
9
+ */
10
+ class Astoundify_Job_Manager_Contact_Listing_Form extends Astoundify_Job_Manager_Contact_Listing {
11
+
12
+ /**
13
+ * @var $jobs_form_id
14
+ */
15
+ public $forms;
16
+
17
+ /**
18
+ * Set the form values, remove the default application template
19
+ * and attach our own. Call and of the children's special actions.
20
+ *
21
+ * @since WP Job Manager - Contact Listing 1.0.0
22
+ *
23
+ * @return void
24
+ */
25
+ public function __construct() {
26
+ if ( ! class_exists( 'WP_Job_Manager' ) ) {
27
+ return;
28
+ }
29
+
30
+ global $job_manager;
31
+
32
+ $this->forms = apply_filters( 'job_manager_contact_listing_forms', array(
33
+ 'job_listing' => array(
34
+ 'contact' => get_option( 'job_manager_form_contact', false )
35
+ ),
36
+ 'resume' => array(
37
+ 'contact' => get_option( 'resume_manager_form_contact', false )
38
+ )
39
+ ) );
40
+
41
+ add_filter( 'job_manager_settings', array( $this, 'job_manager_settings' ) );
42
+ add_filter( 'resume_manager_settings', array( $this, 'resume_manager_settings' ) );
43
+
44
+ if ( ! parent::$active_plugin ) {
45
+ return;
46
+ }
47
+
48
+ $this->setup_actions();
49
+
50
+ // Output the shortcode
51
+
52
+
53
+ if ( ! get_option( 'resume_manager_force_application' ) ) {
54
+ add_action( 'job_manager_application_details_email', array( $this, 'job_manager_application_details_email' ), 5 );
55
+ }
56
+
57
+ if ( class_exists( 'WP_Resume_Manager' ) ) {
58
+ global $resume_manager;
59
+
60
+ remove_action( 'resume_manager_contact_details', array( $resume_manager->post_types, 'contact_details_email' ) );
61
+ add_action( 'resume_manager_contact_details', array( $this, 'job_manager_application_details_email' ) );
62
+ }
63
+ }
64
+
65
+ /**
66
+ * Add settings fields to select the appropriate form for each listing type.
67
+ *
68
+ * @since WP Job Manager - Contact Listing 1.0.0
69
+ *
70
+ * @return void
71
+ */
72
+ public function job_manager_settings($settings) {
73
+ $args = array(
74
+ 'post_type' => 'job_listing',
75
+ 'key' => 'job_listings',
76
+ 'option' => 'job_manager'
77
+ );
78
+
79
+ $settings = $this->add_settings( $args, $settings );
80
+
81
+ return $settings;
82
+ }
83
+
84
+ /**
85
+ * Add settings fields to select the appropriate form for each listing type.
86
+ *
87
+ * @since WP Job Manager - Contact Listing 1.0.0
88
+ *
89
+ * @return void
90
+ */
91
+ public function resume_manager_settings($settings) {
92
+ $args = array(
93
+ 'post_type' => 'resume',
94
+ 'key' => 'resume_listings',
95
+ 'option' => 'resume_manager'
96
+ );
97
+
98
+ $settings = $this->add_settings( $args, $settings );
99
+
100
+ return $settings;
101
+ }
102
+
103
+ private function add_settings( $args, $settings ) {
104
+ $post_type = $args[ 'post_type' ];
105
+ $forms = $this->forms[ $post_type ];
106
+
107
+ $p_type_obj = get_post_type_object( $post_type );
108
+
109
+ /* Bail. */
110
+ if( ! $p_type_obj ){
111
+ return $settings;
112
+ }
113
+
114
+ foreach ( $forms as $key => $value ) {
115
+ $settings[ $args[ 'key' ] ][1][] = array(
116
+ 'name' => sprintf( '%s_form_%s', $args[ 'option' ], $key ),
117
+ 'std' => null,
118
+ 'label' => sprintf( __( '%s a %s Form', 'wp-job-manager-contact-listing' ), ucfirst( $key ), $p_type_obj->labels->singular_name ),
119
+ 'desc' => '',
120
+ 'type' => 'select',
121
+ 'options' => $this->get_forms()
122
+ );
123
+ }
124
+
125
+ return $settings;
126
+ }
127
+
128
+ /**
129
+ * Output the necessary form shortocde.
130
+ *
131
+ * @since WP Job Manager - Contact Listing 1.0.0
132
+ *
133
+ * @return void
134
+ */
135
+ public function job_manager_application_details_email( $apply ) {
136
+ global $job_manager;
137
+
138
+ $plugin = parent::$active_plugin;
139
+ $post = get_post();
140
+
141
+ if ( ! is_a( $post, 'WP_Post' ) ) {
142
+ return;
143
+ }
144
+
145
+ $form = isset( $this->forms[ $post->post_type ][ 'contact' ] ) ? $this->forms[ $post->post_type ][ 'contact' ] : false;
146
+
147
+ if ( ! $form ) {
148
+ return;
149
+ }
150
+
151
+ // Only remove the default text when contact form is set.
152
+ remove_action( 'job_manager_application_details_email', array( $job_manager->post_types, 'application_details_email' ) );
153
+
154
+ // Add contact form content
155
+ do_action( 'job_manager_contact_listing_form_' . $plugin, $form );
156
+ }
157
+
158
+ }
includes/forms/cf7.php CHANGED
@@ -1,126 +1,130 @@
1
- <?php
2
- /**
3
- * Contact Form 7 support.
4
- *
5
- * @since WP Job Manager - Contact Listing 1.0.0
6
- *
7
- * @return void
8
- */
9
- class Astoundify_Job_Manager_Contact_Listing_Form_CF7 extends Astoundify_Job_Manager_Contact_Listing_Form {
10
-
11
- /**
12
- * Load the base form class.
13
- *
14
- * @since WP Job Manager - Contact Listing 1.0.0
15
- *
16
- * @return void
17
- */
18
- public function __construct() {
19
- parent::__construct();
20
- }
21
-
22
- /**
23
- * Hook into processing and attach our own things.
24
- *
25
- * @since WP Job Manager - Contact Listing 1.0.0
26
- *
27
- * @return void
28
- */
29
- public function setup_actions() {
30
- add_filter( 'wpcf7_mail_components', array( $this, 'notification_email' ), 10, 3 );
31
- add_action( 'job_manager_contact_listing_form_cf7', array( $this, 'output_form' ) );
32
- }
33
-
34
- /**
35
- * Output the shortcode.
36
- *
37
- * @since WP Job Manager - Contact Listing 1.0.0
38
- *
39
- * @return void
40
- */
41
- public function output_form($form) {
42
- $args = apply_filters( 'job_manager_contact_listing_cf7_apply_form_args', '' );
43
-
44
- echo do_shortcode( sprintf( '[contact-form-7 id="%s" %s]', $form, $args ) );
45
- }
46
-
47
- /**
48
- * Set the notification email when sending an email.
49
- *
50
- * @since WP Job Manager - Contact Listing 1.0.0
51
- *
52
- * @return string The email to notify.
53
- */
54
- public function notification_email( $components, $cf7, $three = null ) {
55
- $submission = WPCF7_Submission::get_instance();
56
- $unit_tag = $submission->get_meta( 'unit_tag' );
57
-
58
- if ( ! preg_match( '/^wpcf7-f(\d+)-p(\d+)-o(\d+)$/', $unit_tag, $matches ) )
59
- return $components;
60
-
61
- $post_id = (int) $matches[2];
62
- $object = get_post( $post_id );
63
-
64
- // Prevent issues when the form is not submitted via a listing/resume page
65
- if ( ! isset( $this->forms[ $object->post_type ] ) ) {
66
- return $components;
67
- }
68
-
69
- if ( ! array_search( $cf7->id(), $this->forms[ $object->post_type ] ) ) {
70
- return $components;
71
- }
72
-
73
- // Bail if this is the second mail
74
- if ( isset( $three ) && 'mail_2' == $three->name() ) {
75
- return $components;
76
- }
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;
97
- }
98
-
99
- /**
100
- * Get all forms and return in a simple array for output.
101
- *
102
- * @since WP Job Manager - Contact Listing 1.0.0
103
- *
104
- * @return void
105
- */
106
- public function get_forms() {
107
- $forms = array( 0 => __( 'Please select a form', 'wp-job-manager-contact-listing' ) );
108
-
109
- $_forms = get_posts(
110
- array(
111
- 'numberposts' => -1,
112
- 'post_type' => 'wpcf7_contact_form',
113
- )
114
- );
115
-
116
- if ( ! empty( $_forms ) ) {
117
-
118
- foreach ( $_forms as $_form ) {
119
- $forms[ $_form->ID ] = $_form->post_title;
120
- }
121
- }
122
-
123
- return $forms;
124
- }
125
-
126
- }
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Contact Form 7 support.
4
+ *
5
+ * @since WP Job Manager - Contact Listing 1.0.0
6
+ *
7
+ * @return void
8
+ */
9
+ class Astoundify_Job_Manager_Contact_Listing_Form_CF7 extends Astoundify_Job_Manager_Contact_Listing_Form {
10
+
11
+ /**
12
+ * Load the base form class.
13
+ *
14
+ * @since WP Job Manager - Contact Listing 1.0.0
15
+ *
16
+ * @return void
17
+ */
18
+ public function __construct() {
19
+ parent::__construct();
20
+ }
21
+
22
+ /**
23
+ * Hook into processing and attach our own things.
24
+ *
25
+ * @since WP Job Manager - Contact Listing 1.0.0
26
+ *
27
+ * @return void
28
+ */
29
+ public function setup_actions() {
30
+ add_filter( 'wpcf7_mail_components', array( $this, 'notification_email' ), 10, 3 );
31
+ add_action( 'job_manager_contact_listing_form_cf7', array( $this, 'output_form' ) );
32
+ }
33
+
34
+ /**
35
+ * Output the shortcode.
36
+ *
37
+ * @since WP Job Manager - Contact Listing 1.0.0
38
+ *
39
+ * @return void
40
+ */
41
+ public function output_form($form) {
42
+ $args = apply_filters( 'job_manager_contact_listing_cf7_apply_form_args', '' );
43
+
44
+ if ( function_exists( 'pll_get_post' ) ) {
45
+ $form = pll_get_post( $form );
46
+ }
47
+
48
+ echo do_shortcode( sprintf( '[contact-form-7 id="%s" %s]', $form, $args ) );
49
+ }
50
+
51
+ /**
52
+ * Set the notification email when sending an email.
53
+ *
54
+ * @since WP Job Manager - Contact Listing 1.0.0
55
+ *
56
+ * @return string The email to notify.
57
+ */
58
+ public function notification_email( $components, $cf7, $three = null ) {
59
+ $submission = WPCF7_Submission::get_instance();
60
+ $unit_tag = $submission->get_meta( 'unit_tag' );
61
+
62
+ if ( ! preg_match( '/^wpcf7-f(\d+)-p(\d+)-o(\d+)$/', $unit_tag, $matches ) )
63
+ return $components;
64
+
65
+ $post_id = (int) $matches[2];
66
+ $object = get_post( $post_id );
67
+
68
+ // Prevent issues when the form is not submitted via a listing/resume page
69
+ if ( ! isset( $this->forms[ $object->post_type ] ) ) {
70
+ return $components;
71
+ }
72
+
73
+ if ( ! array_search( $cf7->id(), $this->forms[ $object->post_type ] ) ) {
74
+ return $components;
75
+ }
76
+
77
+ // Bail if this is the second mail
78
+ if ( isset( $three ) && 'mail_2' == $three->name() ) {
79
+ return $components;
80
+ }
81
+
82
+ $recipient = $object->_application ? $object->_application : $object->_candidate_email;
83
+
84
+ //if we couldn't find the email by now, get it from the listing owner/author
85
+ if ( empty( $recipient ) ) {
86
+
87
+ //just get the email of the listing author
88
+ $owner_ID = $object->post_author;
89
+
90
+ //retrieve the owner user data to get the email
91
+ $owner_info = get_userdata( $owner_ID );
92
+
93
+ if ( false !== $owner_info ) {
94
+ $recipient = $owner_info->user_email;
95
+ }
96
+ }
97
+
98
+ $components[ 'recipient' ] = $recipient;
99
+
100
+ return $components;
101
+ }
102
+
103
+ /**
104
+ * Get all forms and return in a simple array for output.
105
+ *
106
+ * @since WP Job Manager - Contact Listing 1.0.0
107
+ *
108
+ * @return void
109
+ */
110
+ public function get_forms() {
111
+ $forms = array( 0 => __( 'Please select a form', 'wp-job-manager-contact-listing' ) );
112
+
113
+ $_forms = get_posts(
114
+ array(
115
+ 'numberposts' => -1,
116
+ 'post_type' => 'wpcf7_contact_form',
117
+ )
118
+ );
119
+
120
+ if ( ! empty( $_forms ) ) {
121
+
122
+ foreach ( $_forms as $_form ) {
123
+ $forms[ $_form->ID ] = $_form->post_title;
124
+ }
125
+ }
126
+
127
+ return $forms;
128
+ }
129
+
130
+ }
includes/forms/gravityforms.php CHANGED
@@ -1,117 +1,117 @@
1
- <?php
2
- /**
3
- * Gravity Forms support.
4
- *
5
- * @since WP Job Manager - Contact Listing 1.0.0
6
- *
7
- * @return void
8
- */
9
- class Astoundify_Job_Manager_Contact_Listing_Form_GravityForms extends Astoundify_Job_Manager_Contact_Listing_Form {
10
-
11
- /**
12
- * Load the base form class.
13
- *
14
- * @since WP Job Manager - Contact Listing 1.0.0
15
- *
16
- * @return void
17
- */
18
- public function __construct() {
19
- parent::__construct();
20
- }
21
-
22
- public function setup_actions() {
23
- add_action( 'job_manager_contact_listing_form_gravityforms', array( $this, 'output_form' ) );
24
- add_filter( 'gform_notification', array( $this, 'notification_email' ), 10, 3 );
25
- }
26
-
27
- /**
28
- * Output the shortcode.
29
- *
30
- * @since WP Job Manager - Contact Listing 1.0.0
31
- *
32
- * @return void
33
- */
34
- public function output_form($form) {
35
- $args = apply_filters( 'job_manager_contact_listing_gravityforms_apply_form_args', 'title="false" description="false" ajax="true"' );
36
-
37
- echo do_shortcode( sprintf( '[gravityform id="%s" %s]', $form, $args ) );
38
- }
39
-
40
- /**
41
- * Set the notification email when sending an email.
42
- *
43
- * @since WP Job Manager - Contact Listing 1.0.0
44
- *
45
- * @return string The email to notify.
46
- */
47
- public function notification_email( $notification, $form, $entry ) {
48
- if ( 'no-reply@listingowner.com' != $notification[ 'to' ] ) {
49
- return $notification;
50
- }
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;
69
- }
70
-
71
- if ( ! array_search( $form[ 'id' ], $this->forms[ $object->post_type ] ) ) {
72
- return;
73
- }
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;
94
- }
95
-
96
- /**
97
- * Get all forms and return in a simple array for output.
98
- *
99
- * @since WP Job Manager - Contact Listing 1.0.0
100
- *
101
- * @return void
102
- */
103
- public function get_forms() {
104
- $forms = array( 0 => __( 'Please select a form', 'wp-job-manager-contact-listing' ) );
105
-
106
- $_forms = RGFormsModel::get_forms( null, 'title' );
107
-
108
- if ( ! empty( $_forms ) ) {
109
- foreach ( $_forms as $_form ) {
110
- $forms[ $_form->id ] = $_form->title;
111
- }
112
- }
113
-
114
- return $forms;
115
- }
116
-
117
- }
1
+ <?php
2
+ /**
3
+ * Gravity Forms support.
4
+ *
5
+ * @since WP Job Manager - Contact Listing 1.0.0
6
+ *
7
+ * @return void
8
+ */
9
+ class Astoundify_Job_Manager_Contact_Listing_Form_GravityForms extends Astoundify_Job_Manager_Contact_Listing_Form {
10
+
11
+ /**
12
+ * Load the base form class.
13
+ *
14
+ * @since WP Job Manager - Contact Listing 1.0.0
15
+ *
16
+ * @return void
17
+ */
18
+ public function __construct() {
19
+ parent::__construct();
20
+ }
21
+
22
+ public function setup_actions() {
23
+ add_action( 'job_manager_contact_listing_form_gravityforms', array( $this, 'output_form' ) );
24
+ add_filter( 'gform_notification', array( $this, 'notification_email' ), 10, 3 );
25
+ }
26
+
27
+ /**
28
+ * Output the shortcode.
29
+ *
30
+ * @since WP Job Manager - Contact Listing 1.0.0
31
+ *
32
+ * @return void
33
+ */
34
+ public function output_form($form) {
35
+ $args = apply_filters( 'job_manager_contact_listing_gravityforms_apply_form_args', 'title="false" description="false" ajax="true"' );
36
+
37
+ echo do_shortcode( sprintf( '[gravityform id="%s" %s]', $form, $args ) );
38
+ }
39
+
40
+ /**
41
+ * Set the notification email when sending an email.
42
+ *
43
+ * @since WP Job Manager - Contact Listing 1.0.0
44
+ *
45
+ * @return string The email to notify.
46
+ */
47
+ public function notification_email( $notification, $form, $entry ) {
48
+ if ( 'no-reply@listingowner.com' != $notification[ 'to' ] ) {
49
+ return $notification;
50
+ }
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;
69
+ }
70
+
71
+ if ( ! array_search( $form[ 'id' ], $this->forms[ $object->post_type ] ) ) {
72
+ return;
73
+ }
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;
94
+ }
95
+
96
+ /**
97
+ * Get all forms and return in a simple array for output.
98
+ *
99
+ * @since WP Job Manager - Contact Listing 1.0.0
100
+ *
101
+ * @return void
102
+ */
103
+ public function get_forms() {
104
+ $forms = array( 0 => __( 'Please select a form', 'wp-job-manager-contact-listing' ) );
105
+
106
+ $_forms = RGFormsModel::get_forms( null, 'title' );
107
+
108
+ if ( ! empty( $_forms ) ) {
109
+ foreach ( $_forms as $_form ) {
110
+ $forms[ $_form->id ] = $_form->title;
111
+ }
112
+ }
113
+
114
+ return $forms;
115
+ }
116
+
117
+ }
includes/forms/ninjaforms.php CHANGED
@@ -1,218 +1,221 @@
1
- <?php
2
- /**
3
- * Ninja Forms support.
4
- *
5
- * @since WP Job Manager - Contact Listing 1.0.0
6
- *
7
- * @return void
8
- */
9
- class Astoundify_Job_Manager_Contact_Listing_Form_NinjaForms extends Astoundify_Job_Manager_Contact_Listing_Form {
10
-
11
- /**
12
- * Pre THREE release.
13
- * @access protected
14
- */
15
- public $is_pre_three;
16
-
17
- /**
18
- * Load the base form class.
19
- *
20
- * @since WP Job Manager - Contact Listing 1.0.0
21
- *
22
- * @return void
23
- */
24
- public function __construct() {
25
- $this->is_pre_three = version_compare( get_option( 'ninja_forms_version', '0.0.0' ), '3', '<' ) || get_option( 'ninja_forms_load_deprecated', false );
26
-
27
- parent::__construct();
28
- }
29
-
30
- /**
31
- * Hook into processing and attach our own things.
32
- *
33
- * @since WP Job Manager - Contact Listing 1.0.0
34
- *
35
- * @return void
36
- */
37
- public function setup_actions() {
38
- add_action( 'job_manager_contact_listing_form_ninjaforms', array( $this, 'output_form' ) );
39
- add_filter( 'nf_email_notification_process_setting', array( $this, 'notification_email' ), 10, 3 );
40
-
41
- if ( ! $this->is_pre_three ) {
42
- Ninja_forms()->merge_tags[ 'wp-job-manager' ] = new Astoundify_NF_MergeTags_WPJobManager();
43
- }
44
- }
45
-
46
- /**
47
- * Output the shortcode.
48
- *
49
- * @since WP Job Manager - Contact Listing 1.0.0
50
- *
51
- * @return void
52
- */
53
- public function output_form($form) {
54
- $args = apply_filters( 'job_manager_contact_listing_ninjaforms_apply_form_args', '' );
55
-
56
- if ( $this->is_pre_three ) {
57
- echo do_shortcode( sprintf( '[ninja_forms_display_form id="%s" %s]', $form, $args ) );
58
- } else {
59
- echo do_shortcode( sprintf( '[ninja_forms id="%s" %s]', $form, $args ) );
60
- }
61
- }
62
-
63
- /**
64
- * Set the notification email when sending an email.
65
- *
66
- * @since WP Job Manager - Contact Listing 1.0.0
67
- *
68
- * @return string The email to notify.
69
- */
70
- public function notification_email( $setting, $setting_name, $id ) {
71
- if ( 'to' != $setting_name ) {
72
- return $setting;
73
- }
74
-
75
- $fake = array_search( 'no-reply@listingowner.com', $setting );
76
-
77
- if ( false === $fake ) {
78
- return $setting;
79
- }
80
-
81
- global $ninja_forms_processing;
82
-
83
- $form_id = $ninja_forms_processing->get_form_ID();
84
-
85
- $object = $field_id = null;
86
- $fields = $ninja_forms_processing;
87
-
88
- foreach ( $fields->data[ 'field_data' ] as $field ) {
89
- if ( 'Listing ID' == $field[ 'data' ][ 'label' ] ) {
90
- $field_id = $field[ 'id' ];
91
-
92
- break;
93
- }
94
- }
95
-
96
- $listing_ID = $ninja_forms_processing->get_field_value( $field_id );
97
-
98
- $object = get_post( $listing_ID );
99
-
100
- if ( ! is_a( $object, 'WP_Post' ) ) {
101
- return $setting;
102
- }
103
-
104
- if ( ! array_search( $form_id, $this->forms[ $object->post_type ] ) ) {
105
- return $setting;
106
- }
107
-
108
- $setting[ $fake ] = $object->_application ? $object->_application : $object->_candidate_email;
109
-
110
- //if we couldn't find the email by now, get it from the listing owner/author
111
- if ( empty( $setting[ $fake ] ) ) {
112
-
113
- //just get the email of the listing author
114
- $owner_ID = $object->post_author;
115
-
116
- //retrieve the owner user data to get the email
117
- $owner_info = get_userdata( $owner_ID );
118
-
119
- if ( false !== $owner_info ) {
120
- $setting[ $fake ] = $owner_info->user_email;
121
- }
122
- }
123
-
124
- return $setting;
125
- }
126
-
127
- /**
128
- * Get all forms and return in a simple array for output.
129
- *
130
- * @since WP Job Manager - Contact Listing 1.0.0
131
- *
132
- * @return void
133
- */
134
- public function get_forms() {
135
- $forms = array( 0 => __( 'Please select a form', 'wp-job-manager-contact-listing' ) );
136
- $_forms = array();
137
-
138
- if ( $this->is_pre_three ) {
139
- $f = Ninja_Forms()->forms()->get_all();
140
- $x = 0;
141
-
142
- foreach ( $f as $form_id ) {
143
- $_forms[] = array(
144
- 'id' => $form_id,
145
- 'title' => Ninja_Forms()->form( $form_id )->get_setting( 'form_title' )
146
- );
147
- }
148
- } else {
149
- $f = Ninja_Forms()->form()->get_forms();
150
-
151
- foreach ( $f as $form ) {
152
- $_forms[] = array(
153
- 'id' => $form->get_id(),
154
- 'title' => $form->get_setting( 'title' )
155
- );
156
- }
157
- }
158
-
159
- if ( ! empty( $_forms ) ) {
160
-
161
- foreach ( $_forms as $_form ) {
162
- $forms[ $_form[ 'id' ] ] = $_form[ 'title' ];
163
- }
164
-
165
- }
166
-
167
- return $forms;
168
- }
169
-
170
- }
171
-
172
- if ( class_exists( 'NF_Abstracts_MergeTags' ) ) :
173
- /**
174
- * Custom merge tag for Ninja Forms THREE.
175
- *
176
- * Simply create a hidden field with {contact-email} tag and use
177
- * the value of that field to send the email to.
178
- *
179
- * @since 1.3.0
180
- */
181
- class Astoundify_NF_MergeTags_WPJobManager extends NF_Abstracts_MergeTags {
182
-
183
- protected $id = 'wp-job-manager';
184
-
185
- public function __construct() {
186
- parent::__construct();
187
-
188
- $this->title = __( 'WP Job Manager', 'wp-job-manager-contact-listing' );
189
-
190
- $this->merge_tags = array(
191
- 'email' => array(
192
- 'id' => 'email',
193
- 'tag' => '{contact-email}',
194
- 'label' => __( 'Contact Email', 'wp-job-manager-contact-listing' ),
195
- 'callback' => 'contact_email'
196
- )
197
- );
198
- }
199
-
200
- protected function contact_email() {
201
- $post = get_post();
202
-
203
- // try the wp job manager fields
204
- $contact = $post->_application ? $post->_application : $post->_candidate_email;
205
-
206
- // use listing owner data
207
- if ( ! $contact ) {
208
- $owner_info = get_userdata( $post->post_author );
209
-
210
- if ( false !== $owner_info ) {
211
- $contact = $owner_info->user_email;
212
- }
213
- }
214
-
215
- return $contact;
216
- }
217
- }
 
 
 
218
  endif;
1
+ <?php
2
+ /**
3
+ * Ninja Forms support.
4
+ *
5
+ * @since WP Job Manager - Contact Listing 1.0.0
6
+ *
7
+ * @return void
8
+ */
9
+ class Astoundify_Job_Manager_Contact_Listing_Form_NinjaForms extends Astoundify_Job_Manager_Contact_Listing_Form {
10
+
11
+ /**
12
+ * Pre THREE release.
13
+ * @access protected
14
+ */
15
+ public $is_pre_three;
16
+
17
+ /**
18
+ * Load the base form class.
19
+ *
20
+ * @since WP Job Manager - Contact Listing 1.0.0
21
+ *
22
+ * @return void
23
+ */
24
+ public function __construct() {
25
+ $this->is_pre_three = version_compare( get_option( 'ninja_forms_version', '0.0.0' ), '3', '<' ) || get_option( 'ninja_forms_load_deprecated', false );
26
+
27
+ parent::__construct();
28
+ }
29
+
30
+ /**
31
+ * Hook into processing and attach our own things.
32
+ *
33
+ * @since WP Job Manager - Contact Listing 1.0.0
34
+ *
35
+ * @return void
36
+ */
37
+ public function setup_actions() {
38
+ add_action( 'job_manager_contact_listing_form_ninjaforms', array( $this, 'output_form' ) );
39
+ add_filter( 'nf_email_notification_process_setting', array( $this, 'notification_email' ), 10, 3 );
40
+
41
+ if ( ! $this->is_pre_three ) {
42
+ Ninja_forms()->merge_tags[ 'wp-job-manager' ] = new Astoundify_NF_MergeTags_WPJobManager();
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Output the shortcode.
48
+ *
49
+ * @since WP Job Manager - Contact Listing 1.0.0
50
+ *
51
+ * @return void
52
+ */
53
+ public function output_form($form) {
54
+ $args = apply_filters( 'job_manager_contact_listing_ninjaforms_apply_form_args', '' );
55
+
56
+ if ( $this->is_pre_three ) {
57
+ echo do_shortcode( sprintf( '[ninja_forms_display_form id="%s" %s]', $form, $args ) );
58
+ } else {
59
+ echo do_shortcode( sprintf( '[ninja_forms id="%s" %s]', $form, $args ) );
60
+ }
61
+ }
62
+
63
+ /**
64
+ * Set the notification email when sending an email.
65
+ *
66
+ * @since WP Job Manager - Contact Listing 1.0.0
67
+ *
68
+ * @return string The email to notify.
69
+ */
70
+ public function notification_email( $setting, $setting_name, $id ) {
71
+ if ( 'to' != $setting_name ) {
72
+ return $setting;
73
+ }
74
+
75
+ $fake = array_search( 'no-reply@listingowner.com', $setting );
76
+
77
+ if ( false === $fake ) {
78
+ return $setting;
79
+ }
80
+
81
+ global $ninja_forms_processing;
82
+
83
+ $form_id = $ninja_forms_processing->get_form_ID();
84
+
85
+ $object = $field_id = null;
86
+ $fields = $ninja_forms_processing;
87
+
88
+ foreach ( $fields->data[ 'field_data' ] as $field ) {
89
+ if ( 'Listing ID' == $field[ 'data' ][ 'label' ] ) {
90
+ $field_id = $field[ 'id' ];
91
+
92
+ break;
93
+ }
94
+ }
95
+
96
+ $listing_ID = $ninja_forms_processing->get_field_value( $field_id );
97
+
98
+ $object = get_post( $listing_ID );
99
+
100
+ if ( ! is_a( $object, 'WP_Post' ) ) {
101
+ return $setting;
102
+ }
103
+
104
+ if ( ! array_search( $form_id, $this->forms[ $object->post_type ] ) ) {
105
+ return $setting;
106
+ }
107
+
108
+ $setting[ $fake ] = $object->_application ? $object->_application : $object->_candidate_email;
109
+
110
+ //if we couldn't find the email by now, get it from the listing owner/author
111
+ if ( empty( $setting[ $fake ] ) ) {
112
+
113
+ //just get the email of the listing author
114
+ $owner_ID = $object->post_author;
115
+
116
+ //retrieve the owner user data to get the email
117
+ $owner_info = get_userdata( $owner_ID );
118
+
119
+ if ( false !== $owner_info ) {
120
+ $setting[ $fake ] = $owner_info->user_email;
121
+ }
122
+ }
123
+
124
+ return $setting;
125
+ }
126
+
127
+ /**
128
+ * Get all forms and return in a simple array for output.
129
+ *
130
+ * @since WP Job Manager - Contact Listing 1.0.0
131
+ *
132
+ * @return void
133
+ */
134
+ public function get_forms() {
135
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ){
136
+ return;
137
+ }
138
+ $forms = array( 0 => __( 'Please select a form', 'wp-job-manager-contact-listing' ) );
139
+ $_forms = array();
140
+
141
+ if ( $this->is_pre_three ) {
142
+ $f = Ninja_Forms()->forms()->get_all();
143
+ $x = 0;
144
+
145
+ foreach ( $f as $form_id ) {
146
+ $_forms[] = array(
147
+ 'id' => $form_id,
148
+ 'title' => Ninja_Forms()->form( $form_id )->get_setting( 'form_title' )
149
+ );
150
+ }
151
+ } else {
152
+ $f = Ninja_Forms()->form()->get_forms();
153
+
154
+ foreach ( $f as $form ) {
155
+ $_forms[] = array(
156
+ 'id' => $form->get_id(),
157
+ 'title' => $form->get_setting( 'title' )
158
+ );
159
+ }
160
+ }
161
+
162
+ if ( ! empty( $_forms ) ) {
163
+
164
+ foreach ( $_forms as $_form ) {
165
+ $forms[ $_form[ 'id' ] ] = $_form[ 'title' ];
166
+ }
167
+
168
+ }
169
+
170
+ return $forms;
171
+ }
172
+
173
+ }
174
+
175
+ if ( class_exists( 'NF_Abstracts_MergeTags' ) ) :
176
+ /**
177
+ * Custom merge tag for Ninja Forms THREE.
178
+ *
179
+ * Simply create a hidden field with {contact-email} tag and use
180
+ * the value of that field to send the email to.
181
+ *
182
+ * @since 1.3.0
183
+ */
184
+ class Astoundify_NF_MergeTags_WPJobManager extends NF_Abstracts_MergeTags {
185
+
186
+ protected $id = 'wp-job-manager';
187
+
188
+ public function __construct() {
189
+ parent::__construct();
190
+
191
+ $this->title = __( 'WP Job Manager', 'wp-job-manager-contact-listing' );
192
+
193
+ $this->merge_tags = array(
194
+ 'email' => array(
195
+ 'id' => 'email',
196
+ 'tag' => '{contact-email}',
197
+ 'label' => __( 'Contact Email', 'wp-job-manager-contact-listing' ),
198
+ 'callback' => 'contact_email'
199
+ )
200
+ );
201
+ }
202
+
203
+ protected function contact_email() {
204
+ $post = get_post();
205
+
206
+ // try the wp job manager fields
207
+ $contact = $post->_application ? $post->_application : $post->_candidate_email;
208
+
209
+ // use listing owner data
210
+ if ( ! $contact ) {
211
+ $owner_info = get_userdata( $post->post_author );
212
+
213
+ if ( false !== $owner_info ) {
214
+ $contact = $owner_info->user_email;
215
+ }
216
+ }
217
+
218
+ return $contact;
219
+ }
220
+ }
221
  endif;
languages/wp-job-manager-contact-listing.pot CHANGED
@@ -1,54 +1,54 @@
1
- # Copyright (C) 2016 Astoundify
2
- # This file is distributed under the same license as the WP Job Manager - Contact Listing package.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: WP Job Manager - Contact Listing 1.3.0\n"
6
- "Report-Msgid-Bugs-To: "
7
- "https://wordpress.org/support/plugin/wp-job-manager-contact-listing\n"
8
- "POT-Creation-Date: 2016-09-29 13:14:49+00:00\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=utf-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
13
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
- "Language-Team: LANGUAGE <LL@li.org>\n"
15
- "X-Generator: grunt-wp-i18n 0.5.4\n"
16
-
17
- #: includes/class-wp-job-manager-contact-listing-form.php:113
18
- msgid "%s a %s Form"
19
- msgstr ""
20
-
21
- #: includes/forms/cf7.php:107 includes/forms/gravityforms.php:104
22
- #: includes/forms/ninjaforms.php:135
23
- msgid "Please select a form"
24
- msgstr ""
25
-
26
- #: includes/forms/ninjaforms.php:188
27
- msgid "WP Job Manager"
28
- msgstr ""
29
-
30
- #: includes/forms/ninjaforms.php:194
31
- msgid "Contact Email"
32
- msgstr ""
33
-
34
- #. Plugin Name of the plugin/theme
35
- msgid "WP Job Manager - Contact Listing"
36
- msgstr ""
37
-
38
- #. Plugin URI of the plugin/theme
39
- msgid "http://wordpress.org/plugins/wp-job-manager-contact-listing/"
40
- msgstr ""
41
-
42
- #. Description of the plugin/theme
43
- msgid ""
44
- "Contact job listings or resume listings with your choice of Gravity Forms, "
45
- "Ninja Forms, or Contact Form 7"
46
- msgstr ""
47
-
48
- #. Author of the plugin/theme
49
- msgid "Astoundify"
50
- msgstr ""
51
-
52
- #. Author URI of the plugin/theme
53
- msgid "http://astoundify.com"
54
  msgstr ""
1
+ # Copyright (C) 2017 Astoundify
2
+ # This file is distributed under the same license as the Contact Listing for WP Job Manager package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Contact Listing for WP Job Manager 1.4.0\n"
6
+ "Report-Msgid-Bugs-To: "
7
+ "https://wordpress.org/support/plugin/wp-job-manager-contact-listing\n"
8
+ "POT-Creation-Date: 2017-04-12 14:05:07+00:00\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=utf-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+ "X-Generator: grunt-wp-i18n1.0.0\n"
16
+
17
+ #: includes/class-wp-job-manager-contact-listing-form.php:118
18
+ msgid "%s a %s Form"
19
+ msgstr ""
20
+
21
+ #: includes/forms/cf7.php:107 includes/forms/gravityforms.php:104
22
+ #: includes/forms/ninjaforms.php:138
23
+ msgid "Please select a form"
24
+ msgstr ""
25
+
26
+ #: includes/forms/ninjaforms.php:191
27
+ msgid "WP Job Manager"
28
+ msgstr ""
29
+
30
+ #: includes/forms/ninjaforms.php:197
31
+ msgid "Contact Email"
32
+ msgstr ""
33
+
34
+ #. Plugin Name of the plugin/theme
35
+ msgid "Contact Listing for WP Job Manager"
36
+ msgstr ""
37
+
38
+ #. Plugin URI of the plugin/theme
39
+ msgid "http://wordpress.org/plugins/wp-job-manager-contact-listing/"
40
+ msgstr ""
41
+
42
+ #. Description of the plugin/theme
43
+ msgid ""
44
+ "Contact job listings or resume listings with your choice of Gravity Forms, "
45
+ "Ninja Forms, or Contact Form 7"
46
+ msgstr ""
47
+
48
+ #. Author of the plugin/theme
49
+ msgid "Astoundify"
50
+ msgstr ""
51
+
52
+ #. Author URI of the plugin/theme
53
+ msgid "http://astoundify.com"
54
  msgstr ""
readme.txt CHANGED
@@ -1,131 +1,140 @@
1
- === WP Job Manager - Contact Listing ===
2
-
3
- Author URI: http://astoundify.com
4
- Plugin URI: https://wordpress.org/plugins/wp-job-manager-contact-listing/
5
- Donate link: https://www.paypal.me/astoundify
6
- 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.6
10
- Stable Tag: 1.3.0
11
- License: GPLv3
12
- License URI: http://www.gnu.org/licenses/gpl-3.0.html
13
-
14
- Allow sites using the WP Job Manager plugin to contact listings via their favorite form builder plugin.
15
-
16
- == Description ==
17
-
18
- Sites using the [WP Job Manager](http://wordpress.org/plugins/wp-job-manager/) plugin can use any of the supported plugins and allow visitors to contact the connected application email (or resume author) directly.
19
-
20
- **Supported Form Plugins**
21
-
22
- * Gravity Forms
23
- * Ninja Forms
24
- * Contact Form 7
25
-
26
- = Where can I use this? =
27
-
28
- Astoundify has released two themes that are fully integrated with the WP Job Manager plugin. Check out ["Jobify"](http://themeforest.net/item/jobify-job-board-wordpress-theme/5247604?ref=Astoundify) and our WordPress Directory theme ["Listify"](http://themeforest.net/item/listify-wordpress-directory-theme/9602611?ref=Astoundify)
29
-
30
- The plugin can also be used on any theme but no extra styling (outside the CSS that comes with the form plugins) is used.
31
-
32
- == Frequently Asked Questions ==
33
-
34
- = What settings do I need for Gravity Forms? =
35
-
36
- **Video Tutorial:** https://vimeo.com/85469722/
37
-
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
-
45
- **Next**, create a new form notification with the "Send To" field set to "Email" and "no-reply@listingowner.com" as the value. Fill the body with the information you want to send to the listing owner.
46
-
47
- = What settings do I need for Ninja Forms? =
48
-
49
- **Video Tutorial:** https://vimeo.com/89439524/
50
-
51
- You **must** create a *hidden* field with the following specific settings:
52
-
53
- * **Label:** `Contact Email`
54
- * **Default Value:** `{contact-email}`
55
-
56
- The Job/Resume listing must also have an email address associated with it, not a URL to a website.
57
-
58
- **Next**, create a new form *email* notification with the "To" field set to the value of the **Contact Email** hidden field you created. Fill the body with the information you want to send to the listing owner.
59
-
60
- = What settings do I need for Contact Form 7? =
61
-
62
- No special settings needed.
63
-
64
- = I am using Jobify and it's not working =
65
-
66
- **Please make sure you have the latest version of Jobify from ThemeForest**
67
-
68
- If you have purchased Jobify and still have questions, please post on our dedicated support forum: http://support.astoundify.com
69
-
70
- == Installation ==
71
-
72
- 1. Install and Activate
73
- 2. Go to "Job Listings > Settings" and choose the forms you would like to use.
74
- 3. Visit the FAQ for specifics on each form plugin.
75
-
76
- == Changelog ==
77
-
78
- = 1.3.0: September 29, 2016 =
79
-
80
- * New: Ninja Forms THREE merge tag for routing emails to the listing or candidate email address. Update your existing hidden field with the merge tag {contact-email} and update your "To" email notification field to be the value of your hidden field.
81
-
82
- See: http://docs.astoundify.com/article/81-ninja-form
83
-
84
- = 1.2.3: September 12, 2016 =
85
-
86
- * Ninja Forms compatibility.
87
-
88
- = 1.2.2: June 22, 2016 =
89
-
90
- * Ninja Forms compatibility.
91
-
92
- = 1.2.1: June 21, 2016 =
93
-
94
- * Ninja Forms compatibility.
95
-
96
- = 1.2.0: June 16, 2016 =
97
-
98
- * Ninja Forms compatibility.
99
-
100
- = 1.1.0: February 25, 2016 =
101
-
102
- * New: Fall back to the listing owner's user account email if no `_application` field value exists.
103
-
104
- = 1.0.5: April, 9, 2015 =
105
-
106
- * Fix: Don't override Contact Form 7 Mail (2) email notification.
107
-
108
- = 1.0.4: September 16, 2014 =
109
-
110
- * Fix: Compatibility with Ninja Forms 2.8.0+ notification system. Please review the README and documentation for changes needed.
111
-
112
- = 1.0.3.1: August 12, 2014 =
113
-
114
- * Fix: Make sure Ninja Forms add_action() abstract doesn't fail.
115
-
116
- = 1.0.3: August 12, 2014 =
117
-
118
- * Fix: Make sure Ninja Forms add_action() accepts all arguments
119
-
120
- = 1.0.2: August 5, 2014 =
121
-
122
- * Fix: Make sure the correct instance of Contact Form 7 submission form is always found.
123
- * Fix: Update README to reflect new field settings.
124
-
125
- = 1.0.1: July 24, 2014 =
126
-
127
- * Fix: Update for compatibility with older PHP versions to avoid errors.
128
-
129
- = 1.0.0: July 23, 2014 =
130
-
131
- * First official release!
 
 
 
 
 
 
 
 
 
1
+ === Contact Listing for WP Job Manager ===
2
+ Author URI: http://astoundify.com
3
+ Plugin URI: https://astoundify.com/products/wp-job-manager-contact-listing/
4
+ Donate link: https://www.paypal.me/astoundify
5
+ Contributors: Astoundify
6
+ Tags: job, job listing, job apply, gravity forms, wp job manager, gravity forms, gravityforms, ninja forms, ninjaforms, contact form 7, cf7
7
+ Requires at least: 4.7.0
8
+ Tested up to: 5.5.3
9
+ Stable Tag: 1.4.1
10
+ License: GPLv3
11
+ License URI: http://www.gnu.org/licenses/gpl-3.0.html
12
+
13
+ Allow sites using the WP Job Manager plugin to contact listings via their favorite form builder plugin.
14
+
15
+ == Description ==
16
+
17
+ Sites using the [WP Job Manager](http://wordpress.org/plugins/wp-job-manager/) plugin can use any of the supported plugins and allow visitors to contact the connected application email (or resume author) directly.
18
+
19
+ **Supported Form Plugins**
20
+
21
+ * Gravity Forms
22
+ * Ninja Forms
23
+ * Contact Form 7
24
+
25
+ = Where can I use this? =
26
+
27
+ Astoundify has released two themes that are fully integrated with the WP Job Manager plugin. Check out ["Jobify"](http://themeforest.net/item/jobify-job-board-wordpress-theme/5247604?ref=Astoundify) and our WordPress Directory theme ["Listify"](http://themeforest.net/item/listify-wordpress-directory-theme/9602611?ref=Astoundify)
28
+
29
+ The plugin can also be used on any theme but no extra styling (outside the CSS that comes with the form plugins) is used.
30
+
31
+ == Frequently Asked Questions ==
32
+
33
+ = What settings do I need for Gravity Forms? =
34
+
35
+ **Video Tutorial:** https://vimeo.com/85469722/
36
+
37
+ You **must** create a *hidden* field with the following specific settings:
38
+
39
+ * **Label:** Listing ID
40
+ * **Allow field to be dynamically populated:** `{embed_post:ID}`
41
+
42
+ The Job/Resume listing must also have an email address associated with it, not a URL to a website.
43
+
44
+ **Next**, create a new form notification with the "Send To" field set to "Email" and "no-reply@listingowner.com" as the value. Fill the body with the information you want to send to the listing owner.
45
+
46
+ = What settings do I need for Ninja Forms? =
47
+
48
+ **Video Tutorial:** https://vimeo.com/89439524/
49
+
50
+ You **must** create a *hidden* field with the following specific settings:
51
+
52
+ * **Label:** `Contact Email`
53
+ * **Default Value:** `{contact-email}`
54
+
55
+ The Job/Resume listing must also have an email address associated with it, not a URL to a website.
56
+
57
+ **Next**, create a new form *email* notification with the "To" field set to the value of the **Contact Email** hidden field you created. Fill the body with the information you want to send to the listing owner.
58
+
59
+ = What settings do I need for Contact Form 7? =
60
+
61
+ No special settings needed.
62
+
63
+ = I am using Jobify and it's not working =
64
+
65
+ **Please make sure you have the latest version of Jobify from ThemeForest**
66
+
67
+ If you have purchased Jobify and still have questions, please post on our dedicated support forum: http://support.astoundify.com
68
+
69
+ == Installation ==
70
+
71
+ 1. Install and Activate
72
+ 2. Go to "Job Listings > Settings" and choose the forms you would like to use.
73
+ 3. Visit the FAQ for specifics on each form plugin.
74
+
75
+ == Changelog ==
76
+
77
+ = 1.4.1: November 25, 2020 =
78
+
79
+ * Update: Compatibility check with latest WordPress v5.5.3.
80
+ * Update: Compatibility check with Latest WP Job Manager v1.34.3.
81
+ * Update: Compatibility check with the latest PHP v7.4.10.
82
+
83
+ = 1.4.0: April 12, 2017 =
84
+
85
+ * New: Update README
86
+
87
+ = 1.3.0: September 29, 2016 =
88
+
89
+ * New: Ninja Forms THREE merge tag for routing emails to the listing or candidate email address. Update your existing hidden field with the merge tag {contact-email} and update your "To" email notification field to be the value of your hidden field.
90
+
91
+ See: http://docs.astoundify.com/article/81-ninja-form
92
+
93
+ = 1.2.3: September 12, 2016 =
94
+
95
+ * Ninja Forms compatibility.
96
+
97
+ = 1.2.2: June 22, 2016 =
98
+
99
+ * Ninja Forms compatibility.
100
+
101
+ = 1.2.1: June 21, 2016 =
102
+
103
+ * Ninja Forms compatibility.
104
+
105
+ = 1.2.0: June 16, 2016 =
106
+
107
+ * Ninja Forms compatibility.
108
+
109
+ = 1.1.0: February 25, 2016 =
110
+
111
+ * New: Fall back to the listing owner's user account email if no `_application` field value exists.
112
+
113
+ = 1.0.5: April, 9, 2015 =
114
+
115
+ * Fix: Don't override Contact Form 7 Mail (2) email notification.
116
+
117
+ = 1.0.4: September 16, 2014 =
118
+
119
+ * Fix: Compatibility with Ninja Forms 2.8.0+ notification system. Please review the README and documentation for changes needed.
120
+
121
+ = 1.0.3.1: August 12, 2014 =
122
+
123
+ * Fix: Make sure Ninja Forms add_action() abstract doesn't fail.
124
+
125
+ = 1.0.3: August 12, 2014 =
126
+
127
+ * Fix: Make sure Ninja Forms add_action() accepts all arguments
128
+
129
+ = 1.0.2: August 5, 2014 =
130
+
131
+ * Fix: Make sure the correct instance of Contact Form 7 submission form is always found.
132
+ * Fix: Update README to reflect new field settings.
133
+
134
+ = 1.0.1: July 24, 2014 =
135
+
136
+ * Fix: Update for compatibility with older PHP versions to avoid errors.
137
+
138
+ = 1.0.0: July 23, 2014 =
139
+
140
+ * First official release!
wp-job-manager-contact-listing.php CHANGED
@@ -1,173 +1,173 @@
1
- <?php
2
- /**
3
- * Plugin Name: WP Job Manager - Contact Listing
4
- * Plugin URI: http://wordpress.org/plugins/wp-job-manager-contact-listing/
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.3.0
9
- * Text Domain: wp-job-manager-contact-listing
10
- * Domain Path: /languages
11
- */
12
-
13
- // Exit if accessed directly
14
- if ( ! defined( 'ABSPATH' ) ) exit;
15
-
16
- class Astoundify_Job_Manager_Contact_Listing {
17
-
18
- /**
19
- * @var $instance
20
- */
21
- private static $instance;
22
-
23
- /**
24
- * @var $active_plugin;
25
- */
26
- public static $active_plugin;
27
-
28
- /**
29
- * Make sure only one instance is only running.
30
- */
31
- public static function instance() {
32
- if ( ! isset ( self::$instance ) ) {
33
- self::$instance = new self;
34
- }
35
-
36
- return self::$instance;
37
- }
38
-
39
- /**
40
- * Start things up.
41
- *
42
- * @since WP Job Manager - Contact Listing 1.0.0
43
- */
44
- public function __construct() {
45
- $this->setup_globals();
46
- $this->load_textdomain();
47
-
48
- $this->find_plugin();
49
- }
50
-
51
- /**
52
- * Set some smart defaults to class variables. Allow some of them to be
53
- * filtered to allow for early overriding.
54
- *
55
- * @since WP Job Manager - Contact Listing 1.0.0
56
- *
57
- * @return void
58
- */
59
- private function setup_globals() {
60
- $this->file = __FILE__;
61
-
62
- $this->basename = plugin_basename( $this->file );
63
- $this->plugin_dir = plugin_dir_path( $this->file );
64
- $this->plugin_url = plugin_dir_url ( $this->file );
65
-
66
- $this->lang_dir = trailingslashit( $this->plugin_dir . 'languages' );
67
- $this->domain = 'wp-job-contact-listing';
68
- }
69
-
70
- /**
71
- * Loads the plugin language files
72
- *
73
- * @since WP Job Manager - Contact Listing 1.0.0
74
- */
75
- public function load_textdomain() {
76
- $locale = apply_filters( 'plugin_locale', get_locale(), $this->domain );
77
- $mofile = sprintf( '%1$s-%2$s.mo', $this->domain, $locale );
78
-
79
- $mofile_local = $this->lang_dir . $mofile;
80
- $mofile_global = WP_LANG_DIR . '/' . $this->domain . '/' . $mofile;
81
-
82
- if ( file_exists( $mofile_global ) ) {
83
- return load_textdomain( $this->domain, $mofile_global );
84
- } elseif ( file_exists( $mofile_local ) ) {
85
- return load_textdomain( $this->domain, $mofile_local );
86
- }
87
-
88
- return false;
89
- }
90
-
91
- /**
92
- * Find the plugin we are using to apply. It simply goes down the list
93
- * in order so the first active plugin that meets requirements will
94
- * be assumed the correct one.
95
- *
96
- * @since WP Job Manager - Contact Listing 1.0.0
97
- *
98
- * @return void
99
- */
100
- private function find_plugin() {
101
- $supported = $this->supported_plugins();
102
-
103
- foreach ( $supported as $key => $plugin ) {
104
- if ( $plugin[ 'dependancy' ] ) {
105
- self::$active_plugin = $key;
106
-
107
- break;
108
- }
109
- }
110
-
111
- $this->init_plugin();
112
- }
113
-
114
- /**
115
- * Load the base form class and the necessary form class for the active plugin.
116
- *
117
- * @since WP Job Manager - Contact Listing 1.0.0
118
- *
119
- * @return void
120
- */
121
- private function init_plugin() {
122
- if ( ! isset( self::$active_plugin ) ) {
123
- return;
124
- }
125
-
126
- $plugins = $this->supported_plugins();
127
- $plugin = $plugins[ self::$active_plugin ];
128
-
129
- $plugin_file = sprintf( $this->plugin_dir . 'includes/forms/%s.php', self::$active_plugin );
130
- $plugin_class = sprintf( 'Astoundify_Job_Manager_Contact_Listing_Form_%s', $plugin[ 'class' ] );
131
-
132
- if ( ! file_exists( $plugin_file ) ) {
133
- return false;
134
- }
135
-
136
- include_once( $this->plugin_dir . '/includes/class-wp-job-manager-contact-listing-form.php' );
137
- include_once( $plugin_file );
138
-
139
- if ( ! class_exists( $plugin_class ) ) {
140
- return false;
141
- }
142
-
143
- new $plugin_class;
144
- }
145
-
146
- /**
147
- * Retrieve a list of supported plugins.
148
- *
149
- * @since WP Job Manager - Contact Listing 1.0.0
150
- *
151
- * @return void
152
- */
153
- public function supported_plugins() {
154
- $supported = array(
155
- 'gravityforms' => array(
156
- 'dependancy' => class_exists( 'GFForms' ),
157
- 'class' => 'GravityForms'
158
- ),
159
- 'ninjaforms' => array(
160
- 'dependancy' => defined( 'NINJA_FORMS_DIR' ),
161
- 'class' => 'NinjaForms'
162
- ),
163
- 'cf7' => array(
164
- 'dependancy' => defined( 'WPCF7_VERSION' ),
165
- 'class' => 'CF7'
166
- )
167
- );
168
-
169
- return apply_filters( 'job_manager_contact_listing_supported_plugins', $supported );
170
- }
171
-
172
- }
173
- add_action( 'init', array( 'Astoundify_Job_Manager_Contact_Listing', 'instance' ) );
1
+ <?php
2
+ /**
3
+ * Plugin Name: Contact Listing for WP Job Manager
4
+ * Plugin URI: http://wordpress.org/plugins/wp-job-manager-contact-listing/
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.4.1
9
+ * Text Domain: wp-job-manager-contact-listing
10
+ * Domain Path: /languages
11
+ */
12
+
13
+ // Exit if accessed directly
14
+ if ( ! defined( 'ABSPATH' ) ) exit;
15
+
16
+ class Astoundify_Job_Manager_Contact_Listing {
17
+
18
+ /**
19
+ * @var $instance
20
+ */
21
+ private static $instance;
22
+
23
+ /**
24
+ * @var $active_plugin;
25
+ */
26
+ public static $active_plugin;
27
+
28
+ /**
29
+ * Make sure only one instance is only running.
30
+ */
31
+ public static function instance() {
32
+ if ( ! isset ( self::$instance ) ) {
33
+ self::$instance = new self;
34
+ }
35
+
36
+ return self::$instance;
37
+ }
38
+
39
+ /**
40
+ * Start things up.
41
+ *
42
+ * @since WP Job Manager - Contact Listing 1.0.0
43
+ */
44
+ public function __construct() {
45
+ $this->setup_globals();
46
+ $this->load_textdomain();
47
+
48
+ $this->find_plugin();
49
+ }
50
+
51
+ /**
52
+ * Set some smart defaults to class variables. Allow some of them to be
53
+ * filtered to allow for early overriding.
54
+ *
55
+ * @since WP Job Manager - Contact Listing 1.0.0
56
+ *
57
+ * @return void
58
+ */
59
+ private function setup_globals() {
60
+ $this->file = __FILE__;
61
+
62
+ $this->basename = plugin_basename( $this->file );
63
+ $this->plugin_dir = plugin_dir_path( $this->file );
64
+ $this->plugin_url = plugin_dir_url ( $this->file );
65
+
66
+ $this->lang_dir = trailingslashit( $this->plugin_dir . 'languages' );
67
+ $this->domain = 'wp-job-contact-listing';
68
+ }
69
+
70
+ /**
71
+ * Loads the plugin language files
72
+ *
73
+ * @since WP Job Manager - Contact Listing 1.0.0
74
+ */
75
+ public function load_textdomain() {
76
+ $locale = apply_filters( 'plugin_locale', get_locale(), $this->domain );
77
+ $mofile = sprintf( '%1$s-%2$s.mo', $this->domain, $locale );
78
+
79
+ $mofile_local = $this->lang_dir . $mofile;
80
+ $mofile_global = WP_LANG_DIR . '/' . $this->domain . '/' . $mofile;
81
+
82
+ if ( file_exists( $mofile_global ) ) {
83
+ return load_textdomain( $this->domain, $mofile_global );
84
+ } elseif ( file_exists( $mofile_local ) ) {
85
+ return load_textdomain( $this->domain, $mofile_local );
86
+ }
87
+
88
+ return false;
89
+ }
90
+
91
+ /**
92
+ * Find the plugin we are using to apply. It simply goes down the list
93
+ * in order so the first active plugin that meets requirements will
94
+ * be assumed the correct one.
95
+ *
96
+ * @since WP Job Manager - Contact Listing 1.0.0
97
+ *
98
+ * @return void
99
+ */
100
+ private function find_plugin() {
101
+ $supported = $this->supported_plugins();
102
+
103
+ foreach ( $supported as $key => $plugin ) {
104
+ if ( $plugin[ 'dependancy' ] ) {
105
+ self::$active_plugin = $key;
106
+
107
+ break;
108
+ }
109
+ }
110
+
111
+ $this->init_plugin();
112
+ }
113
+
114
+ /**
115
+ * Load the base form class and the necessary form class for the active plugin.
116
+ *
117
+ * @since WP Job Manager - Contact Listing 1.0.0
118
+ *
119
+ * @return void
120
+ */
121
+ private function init_plugin() {
122
+ if ( ! isset( self::$active_plugin ) ) {
123
+ return;
124
+ }
125
+
126
+ $plugins = $this->supported_plugins();
127
+ $plugin = $plugins[ self::$active_plugin ];
128
+
129
+ $plugin_file = sprintf( $this->plugin_dir . 'includes/forms/%s.php', self::$active_plugin );
130
+ $plugin_class = sprintf( 'Astoundify_Job_Manager_Contact_Listing_Form_%s', $plugin[ 'class' ] );
131
+
132
+ if ( ! file_exists( $plugin_file ) ) {
133
+ return false;
134
+ }
135
+
136
+ include_once( $this->plugin_dir . '/includes/class-wp-job-manager-contact-listing-form.php' );
137
+ include_once( $plugin_file );
138
+
139
+ if ( ! class_exists( $plugin_class ) ) {
140
+ return false;
141
+ }
142
+
143
+ new $plugin_class;
144
+ }
145
+
146
+ /**
147
+ * Retrieve a list of supported plugins.
148
+ *
149
+ * @since WP Job Manager - Contact Listing 1.0.0
150
+ *
151
+ * @return void
152
+ */
153
+ public function supported_plugins() {
154
+ $supported = array(
155
+ 'gravityforms' => array(
156
+ 'dependancy' => class_exists( 'GFForms' ),
157
+ 'class' => 'GravityForms'
158
+ ),
159
+ 'ninjaforms' => array(
160
+ 'dependancy' => defined( 'NINJA_FORMS_DIR' ),
161
+ 'class' => 'NinjaForms'
162
+ ),
163
+ 'cf7' => array(
164
+ 'dependancy' => defined( 'WPCF7_VERSION' ),
165
+ 'class' => 'CF7'
166
+ )
167
+ );
168
+
169
+ return apply_filters( 'job_manager_contact_listing_supported_plugins', $supported );
170
+ }
171
+
172
+ }
173
+ add_action( 'init', array( 'Astoundify_Job_Manager_Contact_Listing', 'instance' ) );