bp_nouveau_actity_scope_newest_class($班级=''的)

按类型为最新活动添加类。

描述

来源

文件:bp-templates / bp-nouveau /包括/活动/函数.php

函数bp_nouveau_actity_scope_newest_class($ classes =''){if(!is_user_logging_in()){return $ classes;$ user_id = bp_loggedin_user_id();$ my_classes = array();/ * *心跳请求将运输范围。*请参阅bp_nouveau_ajax_querystring()。* / $ scope ='';if(!空($ _post ['data'] ['bp_heartbeat'] ['scope'])){$ scope = sanitize_key($ _post ['data'] ['bp_heartbeat'] ['scope']);} //添加特定类以在客户端执行特定操作。if($ scope && bp_actity_directory()){$ component = bp_get_actity_object_name();/ * *这些类将用于计算*“提到”,“我的群组”和“我的连接”标签* / if('所有'=== $ scope){if('组'=== $ component && bp_is_active($ component)){//是当前用户的一个组成员,活动附加到? if ( groups_is_user_member( $user_id, bp_get_activity_item_id() ) ) { $my_classes[] = 'bp-my-groups'; } } // Connections can post in groups the user is a member of if ( bp_is_active( 'friends' ) && (int) $user_id !== (int) bp_get_activity_user_id() ) { if ( friends_check_friendship( $user_id, bp_get_activity_user_id() ) ) { $my_classes[] = 'bp-my-friends'; } } // A mention can be posted by a friend within a group if ( true === bp_activity_do_mentions() ) { $new_mentions = bp_get_user_meta( $user_id, 'bp_new_mentions', true ); // The current activity is one of the new mentions if ( is_array( $new_mentions ) && in_array( bp_get_activity_id(), $new_mentions ) ) { $my_classes[] = 'bp-my-mentions'; } } /* * This class will be used to highlight the newest activities when * viewing the 'Mentions', 'My Groups' or the 'My Connections' tabs */ } elseif ( 'friends' === $scope || 'groups' === $scope || 'mentions' === $scope ) { $my_classes[] = 'newest_' . $scope . '_activity'; } // Leave other components do their specific stuff if needed. /** * Filters the classes to be applied to the newest activity item. * * Leave other components do their specific stuff if needed. * * @since BuddyPress 3.0.0 * * @param array $my_classes Array of classes to output to class attribute. * @param string $scope Current scope for the activity type. */ $my_classes = (array) apply_filters( 'bp_nouveau_activity_scope_newest_class', $my_classes, $scope ); if ( ! empty( $my_classes ) ) { $classes .= ' ' . join( ' ', $my_classes ); } } return $classes; }

变更乐

变更乐
版本 描述
Buddypress 3.0.0. 介绍。

问题?

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