ข้ามการนำทาง

Waiting for author

Reported for: BuddyPress Multilingual 1.7.0

Topic Tags: Compatibility

Overview of the issue

A recent update to BuddyPress 12.4.1 has introduced a compatibility issue with WPML, specifically concerning the handling of group descriptions. This change has led to a fatal error when the BuddyPress filter bp_get_group_description_excerpt is called, as it now lacks a necessary second argument that was previously expected:

[06-May-2024 15:51:02 UTC] PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function WPML\\BuddyPress\\Groups::translateExcerpt(), 1 passed in ..../wp-includes/class-wp-hook.php on line 324 and exactly 2 expected in .../wp-content/plugins/buddypress-multilingual/includes/class.groups.php:84

This issue has been already reported to BuddyPress team.

Workaround

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

  • Open …/wp-content/plugins/buddypress-multilingual/includes/class.groups.php file.
  • Look for line 84.
  • Replace:
    	public function translateExcerpt( $excerpt, $group ) {
    		$getTranslation = $this->translate( 'description' );
    
    		return bp_create_excerpt( $getTranslation( $excerpt, $group ), strlen( $excerpt ) );
    	}
    
  • With:
    	public function translateExcerpt( $excerpt, $group = null ) {
    		if( is_null($group ) ){
    				return $excerpt;
    		}
    
    		$getTranslation = $this->translate( 'description' );
    
    		return bp_create_excerpt( $getTranslation( $excerpt, $group ), strlen( $excerpt ) );
    	}
    

ทิ้งคำตอบไว้

โปรดอยู่ในหัวข้อและเคารพผู้อื่น หากคุณต้องการความช่วยเหลือเกี่ยวกับปัญหาที่ไม่เกี่ยวข้องกับโพสต์นี้ โปรดใช้ฟอรัมสนับสนุนของเราเพื่อเริ่มการสนทนาหรือส่งตั๋ว.

คุณสามารถใช้แท็กเหล่านี้:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>