bp_get_activity_secondary_avatar (|字符串数组args美元''

返回执行动作的对象的化身。

描述

另请参阅

参数

args美元

数组|字符串(可选)有关参数的完整描述,请参见bp_core_fetch_avatar ()

  • “alt”
    (字符串)默认值根据当前活动项组件而变化。
  • “类型”
    (字符串)默认:'full'时,查看单一活动永久链接页面,否则'thumb'。
  • “类”
    (字符串)默认值:《阿凡达》。
  • “电子邮件”
    (字符串| bool)默认:活动用户的电子邮件。
  • “user_id”
    (int | bool)默认值:活动用户的ID。

默认值:“

返回

(字符串)二级《阿凡达》。

文件:bp-activity / bp-activity-template.php

函数bp_get_activity_secondary_avatar($args = ") {global $ activity_template;(r = wp_parse_args美元args,阵列(alt ' => '', ' ' = > '拇指类型”、“宽度”= > 20“高度”= > 20类”= >“阿凡达”、“link_class ' => '', ' 有关“= > true”,电子邮件' = > false));($r, EXTR_SKIP);//设置item_id和object(默认为user)。Switch ($activities_template->activity->component) {case 'groups': if (bp_disable_group_avatar_uploads()) {return false;} $object = 'group';item_id = activities_template美元- >活动> item_id;美元的链接= ";$ name = ";//仅当组是活动的。 if ( bp_is_active( 'groups' ) ) { $group = groups_get_group( $item_id ); $link = bp_get_group_permalink( $group ); $name = $group->name; } if ( empty( $alt ) ) { $alt = __( 'Group logo', 'buddyboss' ); if ( ! empty( $name ) ) { $alt = sprintf( __( 'Group logo of %s', 'buddyboss' ), $name ); } } break; case 'blogs' : $object = 'blog'; $item_id = $activities_template->activity->item_id; $link = home_url(); if ( empty( $alt ) ) { $alt = sprintf( __( 'Profile photo of the author of the site %s', 'buddyboss' ), get_blog_option( $item_id, 'blogname' ) ); } break; case 'friends' : $object = 'user'; $item_id = $activities_template->activity->secondary_item_id; $link = bp_core_get_userlink( $item_id, false, true ); if ( empty( $alt ) ) { $alt = sprintf( __( 'Profile photo of %s', 'buddyboss' ), bp_core_get_user_displayname( $activities_template->activity->secondary_item_id ) ); } break; default : $object = 'user'; $item_id = $activities_template->activity->user_id; $email = $activities_template->activity->user_email; $link = bp_core_get_userlink( $item_id, false, true ); if ( empty( $alt ) ) { $alt = sprintf( __( 'Profile photo of %s', 'buddyboss' ), $activities_template->activity->display_name ); } break; } /** * Filters the activity secondary avatar object based on current activity item component. * * This is a variable filter dependent on the component used. Possible hooks are * bp_get_activity_secondary_avatar_object_blog, bp_get_activity_secondary_avatar_object_group, * and bp_get_activity_secondary_avatar_object_user. * * @since BuddyPress 1.2.10 * * @param string $object Component being displayed. */ $object = apply_filters( 'bp_get_activity_secondary_avatar_object_' . $activities_template->activity->component, $object ); /** * Filters the activity secondary avatar item ID. * * @since BuddyPress 1.2.10 * * @param int $item_id ID for the secondary avatar item. */ $item_id = apply_filters( 'bp_get_activity_secondary_avatar_item_id', $item_id ); // If we have no item_id or object, there is no avatar to display. if ( empty( $item_id ) || empty( $object ) ) { return false; } // Get the avatar. $avatar = bp_core_fetch_avatar( array( 'item_id' => $item_id, 'object' => $object, 'type' => $type, 'alt' => $alt, 'class' => $class, 'width' => $width, 'height' => $height, 'email' => $email ) ); if ( !empty( $linked ) ) { /** * Filters the secondary avatar link for current activity. * * @since BuddyPress 1.7.0 * * @param string $link Link to wrap the avatar image in. * @param string $component Activity component being acted on. */ $link = apply_filters( 'bp_get_activity_secondary_avatar_link', $link, $activities_template->activity->component ); /** * Filters the determined avatar for the secondary activity item. * * @since BuddyPress 1.2.10 * * @param string $avatar Formatted HTML  element, or raw avatar URL. */ $avatar = apply_filters( 'bp_get_activity_secondary_avatar', $avatar ); return sprintf( '%s', $link, $link_class, $avatar ); } /** This filter is documented in bp-activity/bp-activity-template.php */ return apply_filters( 'bp_get_activity_secondary_avatar', $avatar ); }

更新日志

更新日志
版本 描述
BuddyPress 1.2.0 介绍了。

问题吗?

我们总是很乐意帮助您解决代码或其他问题!搜索我们的开发人员文档联络支持,或与我们联系销售团队