bp_activity_screen_single_activity_permalink ()

加载单个活动项的页面。

描述

返回

(bool |字符串)Boolean值为false,或单个活动项的模板值为成功。

文件:bp-activity /屏幕/ permalink.php

function bp_activity_screen_single_activity_permalink(){//没有显示用户或没有查看活动组件。如果(!Bp_is_activity_component()){返回false;} $action = bp_current_action();如果(!美元行动| | !Is_numeric ($action)){返回false;} //获取活动细节。$activity = bp_activity_get_specific(array('activity_ids' => $action, 'show_hidden' => true, 'spam' => 'ham_only',));// 404 if activity不存在if (empty($activity['activities'][0]) || bp_action_variables()) {bp_do_404(); return; } else { $activity = $activity['activities'][0]; } /** * Check user access to the activity item. * * @since BuddyPress 3.0.0 */ $has_access = bp_activity_user_can_read( $activity ); // If activity author does not match displayed user, block access. // More info:https://buddypress.trac.wordpress.org/ticket/7048#comment:28 if ( true === $has_access && bp_displayed_user_id() !== $activity->user_id ) { $has_access = false; } /** * Fires before the loading of a single activity template file. * * @since BuddyPress 1.2.0 * * @param BP_Activity_Activity $activity Object representing the current activity item being displayed. * @param bool $has_access Whether or not the current user has access to view activity. */ do_action( 'bp_activity_screen_single_activity_permalink', $activity, $has_access ); // Access is specifically disallowed. if ( false === $has_access ) { // If not logged in, prompt for login. if ( ! is_user_logged_in() ) { bp_core_no_access(); // Redirect away. } else { bp_core_add_message( __( 'You do not have access to this activity.', 'buddyboss' ), 'error' ); bp_core_redirect( bp_loggedin_user_domain() ); } } /** * Filters the template to load for a single activity screen. * * @since BuddyPress 1.0.0 * * @param string $template Path to the activity template to load. */ $template = apply_filters( 'bp_activity_template_profile_activity_permalink', 'members/single/activity/permalink' ); // Load the template. bp_core_load_template( $template ); }

更新日志

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

问题吗?

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