当前位置: 首页>>代码示例>>PHP>>正文


PHP BP_Messages_Thread::get_last_sender方法代码示例

本文整理汇总了PHP中BP_Messages_Thread::get_last_sender方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Messages_Thread::get_last_sender方法的具体用法?PHP BP_Messages_Thread::get_last_sender怎么用?PHP BP_Messages_Thread::get_last_sender使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BP_Messages_Thread的用法示例。


在下文中一共展示了BP_Messages_Thread::get_last_sender方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: messages_action_view_message

function messages_action_view_message()
{
    global $thread_id, $bp;
    if (!bp_is_messages_component() || !bp_is_current_action('view')) {
        return false;
    }
    $thread_id = (int) bp_action_variable(0);
    if (!$thread_id || !messages_is_valid_thread($thread_id) || !messages_check_thread_access($thread_id) && !is_super_admin()) {
        bp_core_redirect(bp_displayed_user_domain() . bp_get_messages_slug());
    }
    // Check if a new reply has been submitted
    if (isset($_POST['send'])) {
        // Check the nonce
        check_admin_referer('messages_send_message', 'send_message_nonce');
        // Send the reply
        if (messages_new_message(array('thread_id' => $thread_id, 'subject' => $_POST['subject'], 'content' => $_POST['content']))) {
            bp_core_add_message(__('Your reply was sent successfully', 'buddypress'));
        } else {
            bp_core_add_message(__('There was a problem sending your reply, please try again', 'buddypress'), 'error');
        }
        bp_core_redirect(bp_displayed_user_domain() . bp_get_messages_slug() . '/view/' . $thread_id . '/');
    }
    // Mark message read
    messages_mark_thread_read($thread_id);
    // Decrease the unread count in the nav before it's rendered
    $name = sprintf(__('Messages <span>%s</span>', 'buddypress'), bp_get_total_unread_messages_count());
    $bp->bp_nav[$bp->messages->slug]['name'] = $name;
    do_action('messages_action_view_message');
    bp_core_new_subnav_item(array('name' => sprintf(__('From: %s', 'buddypress'), BP_Messages_Thread::get_last_sender($thread_id)), 'slug' => 'view', 'parent_url' => trailingslashit(bp_displayed_user_domain() . bp_get_messages_slug()), 'parent_slug' => bp_get_messages_slug(), 'screen_function' => true, 'position' => 40, 'user_has_access' => bp_is_my_profile(), 'link' => bp_displayed_user_domain() . bp_get_messages_slug() . '/view/' . (int) $thread_id));
    bp_core_load_template(apply_filters('messages_template_view_message', 'members/single/home'));
}
开发者ID:hornetalcala,项目名称:trunk,代码行数:31,代码来源:bp-messages-actions.php

示例2: messages_action_view_message

function messages_action_view_message() {
	global $bp, $thread_id;

	if ( $bp->current_component != $bp->messages->slug || $bp->current_action != 'view' )
		return false;

	$thread_id = $bp->action_variables[0];

	if ( !$thread_id || !messages_is_valid_thread( $thread_id ) || ( !messages_check_thread_access($thread_id) && !is_super_admin() ) )
		bp_core_redirect( $bp->displayed_user->domain . $bp->current_component );

	/* Check if a new reply has been submitted */
	if ( isset( $_POST['send'] ) ) {

		/* Check the nonce */
		check_admin_referer( 'messages_send_message', 'send_message_nonce' );

		/* Send the reply */
		if ( messages_new_message( array( 'thread_id' => $thread_id, 'subject' => $_POST['subject'], 'content' => $_POST['content'] ) ) )
			bp_core_add_message( __( 'Your reply was sent successfully', 'buddypress' ) );
		else
			bp_core_add_message( __( 'There was a problem sending your reply, please try again', 'buddypress' ), 'error' );

		bp_core_redirect( $bp->displayed_user->domain . $bp->current_component . '/view/' . $thread_id . '/' );
	}

	/* Mark message read */
	messages_mark_thread_read( $thread_id );

	do_action( 'messages_action_view_message' );

	bp_core_new_subnav_item( array( 'name' => sprintf( __( 'From: %s', 'buddypress'), BP_Messages_Thread::get_last_sender($thread_id) ), 'slug' => 'view', 'parent_url' => $bp->loggedin_user->domain . $bp->messages->slug . '/', 'parent_slug' => $bp->messages->slug, 'screen_function' => true, 'position' => 40, 'user_has_access' => bp_is_my_profile() ) );
	bp_core_load_template( apply_filters( 'messages_template_view_message', 'members/single/home' ) );
}
开发者ID:n-sane,项目名称:zaroka,代码行数:34,代码来源:bp-messages.php

示例3: messages_action_view_message

function messages_action_view_message()
{
    global $bp, $thread_id;
    if ($bp->current_component != $bp->messages->slug || $bp->current_action != 'view') {
        return false;
    }
    $thread_id = $bp->action_variables[0];
    if (!$thread_id || !is_numeric($thread_id) || !BP_Messages_Thread::check_access($thread_id)) {
        bp_core_redirect($bp->displayed_user->domain . $bp->current_component);
    } else {
        $bp->bp_options_nav[$bp->messages->slug]['view'] = array('name' => sprintf(__('From: %s', 'buddypress'), BP_Messages_Thread::get_last_sender($thread_id)), 'link' => $bp->loggedin_user->domain . $bp->messages->slug . '/');
        bp_core_load_template(apply_filters('messages_template_view_message', 'messages/view'));
    }
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:14,代码来源:bp-messages.php


注:本文中的BP_Messages_Thread::get_last_sender方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。