For some background, we use the plugin to share posts both to an individual profile, as well as an organisation profile. So two shares in total. The issue we were experiencing is that it was sharing twice to the organisation – 3 shares in total.
At first we thought this wasn’t occurring on manually posted posts, but this appears to be incorrect. It will occur whether it’s a ‘future’ scheduled post, or a manual post. Initially I was looking into the possibility of a duplication during publish, as the plugin utilises a number of related hooks, e.g. transition_post_status
and save_post
. However after adding some logging, what we found was that the primary function responsible for sharing the post to LinkedIn wp_linkedin_autopublish_post_to_linkedin_common
() wasn’t actually firing more than once. It was firing once, and sharing the post to the personal profile once, and then twice to the organisation.
After some more logging and debugging, we found that the “share profiles” that are stored in the plugin settings under wp_linkedin_autopublish_settings
are incorrect. In our case, the default share profile is set to the following example:
32101,n1f6wl6-Q5,urn:li:organization:32101
Despite the plugin settings reflecting the correct two profiles in the UI, the actual option data is a comma separated list of 3 IDs. The first is the org ID, the second is the profile ID, and the third is the org ID again – this is why in the publishing loop in wp_linkedin_autopublish_post_to_linkedin_common()
it is posting to the same organisation twice.
So after everything, the issue appears to be wp_linkedin_autopublish_get_companies()
isn’t handling the data from LinkedIn properly. Either something is unique to our account and the plugin isn’t expecting it, or the LinkedIn REST API has changed enough to break the way that the plugin is parsing the response. Besides parsing the response from LinkedIn and extracting the IDs, ideally if it ever gets to this point, duplicates could be filtered out at other points in the code as well, e.g. publishing or saving, or sharing the post. Note that re-authorising results in the same issue, so I don’t believe it’s a once-off.
Can you please have a look at the responses you’re getting from LinkedIn for the organisation IDs? It seems pretty unlikely that this is local to this specific LinkedIn account. For now we’ve just manually added a solution for our own case. Let me know if you need any further information. Thank you.
-
This reply was modified 8 months, 2 weeks ago by silvercode.