Skip Navigation

[Resolved] WPML groups not working for users that are added manually (v2.7.5)

This support ticket is created 4 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 30 replies, has 2 voices.

Last updated by Nigel 4 years, 3 months ago.

Assisted by: Nigel.

Author
Posts
#1362103

This is a followup ticket for ticket: https://toolset.com/forums/topic/wpml-groups-not-working-for-users-that-are-added-manually-v2-7-5/

I'm able to prepare a reply for that topic but after submitting it I get an error message that the topic already closed.
Can it be re opened or can we continue in this topic?

I would like to discuss this ticket further with Nigel as he already dug into this issue earlier.

In both cases I should be able to send some private information to you, so can you please enable private reply for my next reply.

Best regards
Joren

#1362405

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Joren

Let me set up a private reply for you now...

#1362721

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Joren

On the site you created I could see the issue, even after disabling all plugins except WPML and Access.

I did note, though, that the WPML plugins are rather out-of-date.

I updated the WPML plugins and re-tested, and it appears to work correctly.

Could you please verify?

#1362759

Hi Nigel

Issue is still present but as you disabled most plugins it appears correct.
This is because the custom post types are no longer registered.

I enabled our custom plugins again to make sure that our post types are being registered. After that I can see the issue still being present as those post types don't show up for the local editor user.

Please note that due to other plugins not being enabled there might be some notices through the site.

Hope the issue that we are facing is clear to you, if not please let me know and I will try to re explain it from scratch 😉

Best regards
Joren

#1363157

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Which are the plugins that need to be active for the custom post types?

I could see the issue you described with standard posts, which was fixed after updating WPML.

Let me check again with the relevant post type: which is it?

#1364015

Hi Nigel

I already had these plugins activated again. However if you would like to play around with them the plugin names start with the site name. Our site name is XXXXXXXXX YYYYY, I can't enter the name in here due to NDA but you will have to look for the XXXXXXXXX part, all our plugins are prefixed with it.

Hope this helps

Best regards
Joren

#1364237

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Joren

Thanks. I've seen a similar problem when working with custom post types on my local test site. (It seems to work fine for standard posts.)

I've escalated that so that my colleagues can take a closer look, and I'll get back to you with their feedback.

#1365245

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

We are still looking at this.

Can I check with you, with my Finnish test user, which is the post type that they *should* be able to see and edit? (Currently the WPML Group settings are locked to standard posts only, when that is resolved I will want to test with the intended post type.)

I observe a number of warnings and errors in the PHP logs relating to your custom plugins, so I disabled those on the test site for the moment and added the Types plugin to register a custom post type ("Things") we can use in testing.

I tried to update to the latest version of WordPress, but could not because of file permission issues.

#1366145

Hi Nigel

Thank you for following up on this.

The following post types should be available for the Finnish user:
- post
- external_urls
- videos
- events
- contributions
- cta

Yeah I saw those few warnings as well, they popped up after upgrading plugins etc. I checked those and they have no impact for this issue. I'm resolving them in our current development release. But I kept it like this because otherwise the first thing you would have asked me was to upgrade everything to the latest version.

But your test case should be as good as the one with my custom post types.

Regarding the WP core update, that's correct the server doesn't allow core updates through the ui. They should happen locally and be pushed using git to our servers. This issue shouldn't be related to WP core but if you really need me to update it for resolving this ticket I can make that work by the end of this week.

Best regards
Joren

#1367169

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

I'm returning to the idea that it is related to how you custom post types are registered.

I added a "Things" custom post type and set up a WPML Group the same way you did with your own custom post types, adding the individual test user you provided to be able to publish, edit etc. Finnish Things.

And it works as expected, which is also what I find on my own test sites.

Remotely debugging why it's failing with your custom post types isn't easy.

Perhaps you can direct me to the code that is used to register the post types, and then we can do some local testing with that same code.

#1367523

Hi Nigel

The post types are being registered on the admin_init hook. This happens in:

plugins/site-name/admin/postTypes/postTypes.php, where you can find a method "registerPostTypes" which is triggering the action hooks.

All post type classes that are used in the method above can be found in this folder: wp-content/plugins/site-name/admin/PostTypes/Setup

replace site-name with the actual name of the site 😉

I find it strange that it would be related on how these post types are registered as it's been working fine for a few years already and we just register them using the guides from the WordPress documentation. Nothing fancy going on there.

Hopefully the above information helps you find the issue.

Best reagards
Joren

#1368967

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

I took a copy of that plugin and installed it on my local test site, and I was then able to reproduce the issue.

After setting up the WPML Groups as described previously, a user that has been granted permissions for these CPTs in some language cannot see them in the backend.

I'm not sure what the cause is, but it gives us something to work on now.

I'll pass these details to my colleague to investigate further, and I'll let you know what they find.

#1369795

Hi Nigel

Glad to hear that you where able to reproduce the issue. If you are referring to the local user that I gave you credentials for and you can't find it for all languages that is expected. The user is only granted access to wpml groups of the language "fi-fi".

Regarding the copy of the plugin you took, can you please remove that that again as it was not part of our agreement. We are under heavy NDA and giving access to a testing server was already an edge case scenario. So can you please remove all copies that you took? Thanks for understanding.
Below a reference of my private message where I granted you access to the test server:
The environment that I gave you access to is setup for you and your team, so you can do whatever you need to do with it. Except for taking a copy of the source code and/or database or distributing it due to NDA.
You can add/update plugins, update wp core, revert to previous version of the plugins/wordpress etc, this should help you tackle this issue.

Hopefully it helps you identify and fix the issue.

Best regards
Joren

#1370075

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Sorry, I didn't realise the plugin registering the CPTs was off limits.

I've deleted the copy I took and instructed my colleague that started to look at the problem to make sure they have done the same.

There's not really much else for us to do in that case.

The problem lies with how your CPTs are being registered, but I can't say any more than that without a copy of the code that does it.

In any case, you can simply resolve this problem by removing the code that registers the CPTs from your own plugin and using Types to register them instead (being sure to use the same slugs to register the post types). The WPML Groups will then work, as demonstrated on your site where I created a CPT with Types for testing.

#1370157

Hi Nigel

No worries, I was just mentioning it 😉

However if there is really no other way to debug this please do go ahead as this is blocking for us. We don't do anything special as we just register the post types as instructed in the WordPress documentation. It also worked completely fine with previous versions of the plugin and that code (that registers the post types) hasn't been touched for 4 year on our end.

But please do remove all copies as soon as we are ready with this ticket, I will also need a confirmation on e-mail or so if that's ok for you?

Best regards
Joren

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.