{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/WP-Job-Manager/issues/831","repository_url":"https://api.github.com/repos/Automattic/WP-Job-Manager","labels_url":"https://api.github.com/repos/Automattic/WP-Job-Manager/issues/831/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/WP-Job-Manager/issues/831/comments","events_url":"https://api.github.com/repos/Automattic/WP-Job-Manager/issues/831/events","html_url":"https://github.com/Automattic/WP-Job-Manager/issues/831","id":194578963,"number":831,"title":"Featered listings not handled properly","user":{"login":"sv1cec","id":23484039,"avatar_url":"https://avatars.githubusercontent.com/u/23484039?v=3","gravatar_id":"","url":"https://api.github.com/users/sv1cec","html_url":"https://github.com/sv1cec","followers_url":"https://api.github.com/users/sv1cec/followers","following_url":"https://api.github.com/users/sv1cec/following{/other_user}","gists_url":"https://api.github.com/users/sv1cec/gists{/gist_id}","starred_url":"https://api.github.com/users/sv1cec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sv1cec/subscriptions","organizations_url":"https://api.github.com/users/sv1cec/orgs","repos_url":"https://api.github.com/users/sv1cec/repos","events_url":"https://api.github.com/users/sv1cec/events{/privacy}","received_events_url":"https://api.github.com/users/sv1cec/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-12-09T11:54:47Z","updated_at":"2016-12-18T12:50:27Z","closed_at":"2016-12-09T15:45:34Z","body":"We are facing a serious issue in our site, for which we would appreciate your support.\r\n\r\nFirst, we are using the latest versions of WP, Listify, Polylang, FacetWP and WP Job Manager. We are using three different languages in our site (Greek, English and French).\r\n\r\nWe have discovered a serious issue with the cooperation of WP Job Manager and FacetWP. The issue is related to how WPJM handles the \"Featured\" checkbox and is described below:\r\n\r\nI have three job listings, which are translations of the same listing, Initially, they are all NOT featured. Their post_ids are 2472, 2473, 2474. In the database, I can verify that the menu_order field for all three listings is set to 0. Also, the _featured meta_key for all these posts is set to 0.  \r\n\r\nI use wp-admin to change the first listing (English, post_id 2472) to Featured. I can see in the database that the menu_order field for the English listing is set to -1 and the meta_key _featured is set to 1. (so far so good)\r\n\r\nI then select the Greek translation of the listing (post_id 2473) and I also check the Featured checkbox for the Greek listing. In the database, I can see that the meta_key _featured for both the English and the Greek versions are now set to 1. HOWEVER, the menu_order for the English listing (post_id 2472) is set to 0, while the menu_order for the Greek listing (post_id 2473) is set to -1. In other words, for some reason, while the Greek post gets the correct value for menu_order, at the same time, the English post menu_order is changed from its correct value of -1 to 0.\r\n\r\nIf I now select the French translation (post_id 2474) and check the Featured checkbox for it, then the menu_order in my listings change for the French transalation, from 0 to -1 (as it should), but also it changes from -1 to 0, for the Greek translation. \r\n\r\nIn other words, initially:\r\n\r\npost_id: 2472  menu_order: 0  meta_key _featured: 0\r\npost_id: 2473  menu_order: 0  meta_key _featured: 0\r\npost_id: 2474  menu_order: 0  meta_key _featured: 0\r\n\r\nAfter checking the Featured checkbox for 2472, things change as:\r\n\r\npost_id: 2472  menu_order: -1  meta_key _featured: 1\r\npost_id: 2473  menu_order: 0  meta_key _featured: 0\r\npost_id: 2474  menu_order: 0  meta_key _featured: 0\r\n\r\nAfter checking the Featured checkbox for 2473, things change as:\r\n\r\npost_id: 2472  menu_order: 0  meta_key _featured: 1\r\npost_id: 2473  menu_order: -1  meta_key _featured: 1\r\npost_id: 2474  menu_order: 0  meta_key _featured: 0\r\n\r\nAfter checking the Featured checkbox for 2474, things change as:\r\n\r\npost_id: 2472  menu_order: 0  meta_key _featured: 1\r\npost_id: 2473  menu_order: 0  meta_key _featured: 1\r\npost_id: 2474  menu_order: -1  meta_key _featured: 1\r\n\r\nRight now, all posts show the Featured checkbox as checked, but please note that the menu_order field is set to -1 ONLY for the last post.\r\n\r\nIf I now uncheck the Featured checkbox from one of the listings (say I uncheck it for post_id 2474), another interesting thing happens. \r\n\r\nThe contents of the database change to:\r\n\r\npost_id: 2472  menu_order: -1  meta_key _featured: 1\r\npost_id: 2473  menu_order: -1  meta_key _featured: 1\r\npost_id: 2474  menu_order: 0  meta_key _featured: 0\r\n\r\nWhich seens to indicate that the program checks for the meta_key _featured and sets the menu_order to -1 for those posts which have _featured = 1 (which makes sense). \r\n\r\nIn other words, if I change the Featured checkbox of a listing, from checked to unchecked, the program checks for the _featured meta_key and sets the menu_order field properly, for all three listings. If I change the Featured checkbox from unchecked to checked, the program does not check for the _featured meta_key and resets the menu_order field to 0, for the other two posts.\r\n\r\nWe would appreciate your help on these issues.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Automattic/WP-Job-Manager/issues/comments/267819430","html_url":"https://github.com/Automattic/WP-Job-Manager/issues/831#issuecomment-267819430","issue_url":"https://api.github.com/repos/Automattic/WP-Job-Manager/issues/831","id":267819430,"user":{"login":"sv1cec","id":23484039,"avatar_url":"https://avatars.githubusercontent.com/u/23484039?v=3","gravatar_id":"","url":"https://api.github.com/users/sv1cec","html_url":"https://github.com/sv1cec","followers_url":"https://api.github.com/users/sv1cec/followers","following_url":"https://api.github.com/users/sv1cec/following{/other_user}","gists_url":"https://api.github.com/users/sv1cec/gists{/gist_id}","starred_url":"https://api.github.com/users/sv1cec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sv1cec/subscriptions","organizations_url":"https://api.github.com/users/sv1cec/orgs","repos_url":"https://api.github.com/users/sv1cec/repos","events_url":"https://api.github.com/users/sv1cec/events{/privacy}","received_events_url":"https://api.github.com/users/sv1cec/received_events","type":"User","site_admin":false},"created_at":"2016-12-18T12:50:26Z","updated_at":"2016-12-18T12:50:26Z","body":"Hi Brandon,\n\nI think I have figured out what the problem is.\n\nFirst of all, it is not a WP Job Manager issue, so apologies are in order for bothering you people.\n\nSecond, the problem arises from Polylang. There are two things that affect the program, and which created the issue I reported to you.\n\nFirst, there is the issue of declaring _featured as a custom field in Polylang wpml-config.xml file. If you do declare _featured as a custom field, then Polylang gives the value of 1 to _featured, in all associated translations. However, it does not set the value of menu_order to -1, as one would expect. The field menu_order is set to -1 only for the post (job listing) you are updating.\n\nSecond, if you first set Featured in the first translated post and then try to update another translated post then the program changes menu_order from all other posts from -1 to 0. The code that does that is located in file /wp-content/plugins/polylang/modules/sync/admin-sync.php, where you need to change line 238 from :\n\nforeach ( array( 'comment_status', 'ping_status', 'menu_order', 'post_date' ) as $property ) {\n\nto:\n\nforeach ( array( 'comment_status', 'ping_status', 'post_date' ) as $property ) {\n\n\nWith this change and provided that you have ΝΟΤ defined _featured as a custom field, the program updates each translated post individually, setting menu_order to -1 and _featured to 1, as it should. A minor inconvenience being the fact that you have to check the Featured checkbox in every translated post, and update it. \n\nI can live with that!\n\nThanks for your patience and help on this issue.\n\n-------------------\nJohn Caradimas\nsv1cec@gmail.com\n\n\n\n\n> On 16 Dec 2016, at 22:23, Brandon Kraft <notifications@github.com> wrote:\n> \n> The default is set https://github.com/Automattic/WP-Job-Manager/blob/569d92d2711f8d655f4667c69a07c29d74477b5b/includes/forms/class-wp-job-manager-form-submit-job.php#L595 <https://github.com/Automattic/WP-Job-Manager/blob/569d92d2711f8d655f4667c69a07c29d74477b5b/includes/forms/class-wp-job-manager-form-submit-job.php#L595>\n> Then, based on the form fields set, they are all looped and set via https://github.com/Automattic/WP-Job-Manager/blob/569d92d2711f8d655f4667c69a07c29d74477b5b/includes/forms/class-wp-job-manager-form-submit-job.php#L618 <https://github.com/Automattic/WP-Job-Manager/blob/569d92d2711f8d655f4667c69a07c29d74477b5b/includes/forms/class-wp-job-manager-form-submit-job.php#L618>\n> The featured field is added to wp-admin via https://github.com/Automattic/WP-Job-Manager/blob/569d92d2711f8d655f4667c69a07c29d74477b5b/includes/admin/class-wp-job-manager-writepanels.php#L77 <https://github.com/Automattic/WP-Job-Manager/blob/569d92d2711f8d655f4667c69a07c29d74477b5b/includes/admin/class-wp-job-manager-writepanels.php#L77>\n> For featured posts, we check the menu order here https://github.com/Automattic/WP-Job-Manager/blob/0bf2658abca036bcc1c0c4fded2193ff42f6aaf7/includes/class-wp-job-manager-post-types.php#L558 <https://github.com/Automattic/WP-Job-Manager/blob/0bf2658abca036bcc1c0c4fded2193ff42f6aaf7/includes/class-wp-job-manager-post-types.php#L558>\n> which fires off https://github.com/Automattic/WP-Job-Manager/blob/0bf2658abca036bcc1c0c4fded2193ff42f6aaf7/includes/class-wp-job-manager-post-types.php#L558 <https://github.com/Automattic/WP-Job-Manager/blob/0bf2658abca036bcc1c0c4fded2193ff42f6aaf7/includes/class-wp-job-manager-post-types.php#L558>\n> I don't know where the issue lies. Frankly, it's a complicated enough setup that I don't know when we would have a time to attempt to duplicate it to determine where it is originating from.\n> \n> —\n> You are receiving this because you were mentioned.\n> Reply to this email directly, view it on GitHub <https://github.com/Automattic/WP-Job-Manager/issues/831#issuecomment-267687455>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AWZWh9gBlJxUlI360VIacZjADxdPoeNlks5rIvM6gaJpZM4LI3Mf>.\n> \n\n"}}
{"actor":{"display_login":"sv1cec"}}