Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
When WPML is active, the Restricted Content setting were empty. After deleting the pages set previously in this area, restrictions applied on the whole site, instead of just the set pages.

Solution:
See this errata https://wpml.org/errata/woocommerce-memberships-restrict-content-conditions-applies-to-all-pages-across-the-site/

Relevant Documentation:

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 19 replies, has 2 voices.

Last updated by Waqas Bin Hasan 1 year, 5 months ago.

Assisted by: Waqas Bin Hasan.

Author Posts
July 31, 2023 at 9:45 am #14125395

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation. I was able to reproduce the issue and 've escalated the matter to our 2nd tier team.

I'll update you as soon as there's some progress.

August 1, 2023 at 5:23 am #14130337

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Just an update that issue has been escalated to our compatibility team.

I'll update you as soon as there's more progress.

August 2, 2023 at 6:09 am #14138891

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation.

Our team was able to identify and fix the problem, which has been escalated to relevant dev and compatibility teams.

For now you can resolve the issue with following workaround, which I've already tested in the sandbox:

IMPORTANT: Try this first in your staging/test site and make sure to take full backup before proceeding!!

- Open the "wp-content\plugins\woocommerce-multilingual\compatibility\WcMemberships\class-wcml-wc-memberships.php" file

- Replace the "WCML_WC_Memberships::add_translated_object_ids()" method (around line 134):

public function add_translated_object_ids( $object_ids ) {
	$result = [];
	foreach ( $object_ids as $object_id ) {
		$type         = apply_filters( 'wpml_element_type', get_post_type( $object_id ) );
		$trid         = apply_filters( 'wpml_element_trid', null, $object_id, $type );
		$translations = array_values( wp_list_pluck(
			apply_filters( 'wpml_get_element_translations', [], $trid, $type ),
			'element_id'
		) );

		$result = array_merge( $result, $translations );
	}

	return $result;
}

With:

public function add_translated_object_ids( $object_ids ) {
	$result = [];
	foreach ( $object_ids as $object_id ) {
		$type         = apply_filters( 'wpml_element_type', get_post_type( $object_id ) );
		$trid         = apply_filters( 'wpml_element_trid', null, $object_id, $type );
		$translations = array_values( wp_list_pluck(
			apply_filters( 'wpml_get_element_translations', [], $trid, $type ),
			'element_id'
		) );

		$result = array_merge( $result, $translations );
	}

	// Workaround for compsupp-6900
	if ( empty($result) ) {
		return $object_ids;
	}

	return $result;
}

Save the file, recheck the issue and let me know accordingly.

August 7, 2023 at 3:35 pm #14164993

geneK-2

Hi Waqas Bin Hasan,

The issue was fixed! please let me you know when this is going to be applied to the core version, to don't have this patch being applied manually

Thanks for your support

August 8, 2023 at 5:32 am #14166757

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for confirming.

There's no ETA so far, but hopefully in a future version. We 'll keep you updated.