تخطي الملاحة

Open

Reported for: إضافة WPML Multilingual CMS 4.6.4

Topic Tags: Compatibility

Overview of the issue

If you are using WooCommerce Membership, you will notice that if a page is added under the Restrict Content settings within a membership plan and subsequently deleted, WPML incorrectly applies the restriction to all pages across the site, not just those specified in the membership plan.

Workaround

Please, make sure of having a full backup of your site before proceeding.

  • Open …/wp-content/plugins/woocommerce-multilingual/compatibility/WcMemberships/class-wcml-wc-memberships.php file.
  • Look for line 134.
  • Replace this code:
    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;
    }
    

2 ردود إلى “WooCommerce Memberships - Restrict Content conditions applies to all pages across the site”

    • This is already in our devs roadmap, however I can’t provide you an ETA.
      We will keep this erratum updated once a fix is released.

ترك رد

يُرجى البقاء في الموضوع والتزام الاحترام للآخرين. إذا كنت بحاجة إلى مساعدة بشأن المشكلات التي لا تتعلق بهذا المنشور، فاستخدم منتدى الدعم لبدء محادثة أو إرسال تذكرة.

يمكنك استخدام هذه العلامات:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>