WPML
状态
等待作者
报告针对
WPML Multilingual for BuddyPress and BuddyBoss 1.7.0
相关插件/主题
BuddyPress
主题标签
Compatibility

问题概述

BuddyPress 12.4.1 的近期更新引发了与 WPML 的兼容性问题,具体涉及群组说明的处理。这一更改导致在调用 BuddyPress 过滤器 bp_get_group_description_excerpt 时出现致命错误,因为它现在缺少以前所需的第二个必要参数:


[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

此问题已报告BuddyPress 团队。

临时解决方法

在继续操作之前,请确保对您的站点进行完整的站点备份


  • 打开 …/wp-content/plugins/buddypress-multilingual/includes/class.groups.php 文件。

  • 找到第 84 行。

  • 替换:
    	public function translateExcerpt( $excerpt, $group ) {
    		$getTranslation = $this->translate( 'description' );
    
    		return bp_create_excerpt( $getTranslation( $excerpt, $group ), strlen( $excerpt ) );
    	}

  • 替换为:
    	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 ) );
    	}

所有已知问题 →