本文整理汇总了PHP中bp_core_load_template函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_core_load_template函数的具体用法?PHP bp_core_load_template怎么用?PHP bp_core_load_template使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_core_load_template函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_em_my_locations
/**
* Controller for the location views in BP (using mvc terms here)
*/
function bp_em_my_locations()
{
global $bp, $EM_Location;
if (!is_object($EM_Location) && !empty($_REQUEST['location_id'])) {
$EM_Location = new EM_Location($_REQUEST['location_id']);
}
do_action('bp_em_my_locations');
//plug into EM admin code (at least for now)
include_once EM_DIR . '/admin/em-admin.php';
em_admin_load_scripts();
add_action('wp_head', 'em_admin_general_script');
$template_title = 'bp_em_my_locations_title';
$template_content = 'bp_em_my_locations_content';
if (count($bp->action_variables) > 0) {
if (!empty($bp->action_variables[0])) {
switch ($bp->action_variables[0]) {
case 'edit':
$template_title = 'bp_em_my_locations_editor_title';
$template_content = 'bp_em_my_locations_editor_content';
break;
default:
$template_title = 'bp_em_my_locations_title';
$template_content = 'bp_em_my_locations_content';
break;
}
} else {
$template_title = 'bp_em_my_locations_title';
$template_content = 'bp_em_my_locations_content';
}
}
add_action('bp_template_title', $template_title);
add_action('bp_template_content', $template_content);
/* Finally load the plugin template file. */
bp_core_load_template(apply_filters('bp_core_template_plugin', 'members/single/plugins'));
}
示例2: 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'));
}
示例3: etivite_bp_activity_hashtags_screen_router
/**
* Screen router for activity hashtags.
*
* Determines if we're on a hashtag page. If so, sends things along their
* merry way!
*/
function etivite_bp_activity_hashtags_screen_router()
{
if (!bp_is_activity_component() || !bp_is_current_action(BP_ACTIVITY_HASHTAGS_SLUG)) {
return false;
}
if (!bp_action_variables()) {
return false;
}
// RSS feed support
if (bp_is_action_variable('feed', 1)) {
// the cool way (BP 1.8+)
if (class_exists('BP_Activity_Feed')) {
global $bp;
// setup the feed
$bp->activity->feed = new BP_Activity_Feed(array('id' => 'sitewide-hashtag', 'title' => sprintf(__('%1$s | #%2$s | Hashtag', 'bp-follow'), bp_get_site_name(), urldecode(esc_attr(bp_action_variable(0)))), 'link' => bp_get_activity_hashtags_permalink(esc_attr(bp_action_variable(0))), 'description' => sprintf(__("Activity feed for the hashtag, #%s.", 'buddypress'), urldecode(esc_attr(bp_action_variable(0)))), 'activity_args' => array('search_terms' => '#' . bp_action_variable(0) . '<', 'display_comments' => 'stream')));
// the ugly way
} else {
global $wp_query;
$wp_query->is_404 = false;
status_header(200);
include_once dirname(__FILE__) . '/feeds/bp-activity-hashtags-feed.php';
die;
}
} else {
// BP 1.7 - add theme compat
if (class_exists('BP_Theme_Compat')) {
new BP_Activity_Hashtags_Theme_Compat();
}
bp_core_load_template('activity/index');
}
}
示例4: bp_profile_cover_upload
function bp_profile_cover_upload()
{
global $bp;
if (isset($_POST['action']) && $_POST['action'] == 'bp_cover_upload') {
if (!isset($_POST['_wpnonce']) || !wp_verify_nonce($_POST['_wpnonce'], 'bp_cover_upload')) {
$this->message = '<div class="error message">' . __('Security check Failed. Contact Administrator.', 'bp-profile-cover') . '</div>';
} else {
if (!empty($_FILES['profile_cover']['name'])) {
$attachment = new BP_Profile_Cover();
$file = $attachment->upload($_FILES);
if (!empty($file['error'])) {
$this->message = '<div class="error message">' . $file['error'] . '</div>';
} else {
update_user_meta($bp->loggedin_user->id, 'cover', $file['url']);
$this->message = '<div class="success message">' . __('Cover image uploaded successfully', 'bp-profile-cover') . '</div>';
}
} else {
if (isset($_POST['delete_profile_cover'])) {
delete_user_meta($bp->loggedin_user->id, 'cover');
}
}
}
}
add_action('bp_template_content', array($this, 'bp_profile_cover_page_content'));
bp_core_load_template(apply_filters('bp_core_template_plugin', 'members/single/plugins'));
}
示例5: create_listings
function create_listings()
{
global $wpdb, $bp;
$current_user = wp_get_current_user();
//categories
$user_ID = $bp->displayed_user->id;
if (isset($_POST["save_bepro_listing"]) && !empty($_POST["save_bepro_listing"])) {
$success = false;
$success = bepro_listings_save();
if ($success) {
$message = urlencode("Success saving listing");
} else {
$message = urlencode("Error saving listing");
}
$current_user = wp_get_current_user();
$bp_profile_link = bp_core_get_user_domain($bp->displayed_user->id);
wp_redirect($bp_profile_link . BEPRO_LISTINGS_SLUG . "?message=" . $message);
exit;
} elseif (isset($bp->action_variables[0]) && $bp->current_action == BEPRO_LISTINGS_CREATE_SLUG) {
add_action('bp_template_content', 'update_listing_content');
} else {
add_action('bp_template_content', 'create_listing_content');
}
bp_core_load_template(apply_filters('bp_core_template_plugin', 'members/single/plugins'));
}
示例6: friends_screen_requests
/**
* Catch and process the Requests page.
*/
function friends_screen_requests()
{
if (bp_is_action_variable('accept', 0) && is_numeric(bp_action_variable(1))) {
// Check the nonce
check_admin_referer('friends_accept_friendship');
if (friends_accept_friendship(bp_action_variable(1))) {
bp_core_add_message(__('Friendship accepted', 'buddypress'));
} else {
bp_core_add_message(__('Friendship could not be accepted', 'buddypress'), 'error');
}
bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
} elseif (bp_is_action_variable('reject', 0) && is_numeric(bp_action_variable(1))) {
// Check the nonce
check_admin_referer('friends_reject_friendship');
if (friends_reject_friendship(bp_action_variable(1))) {
bp_core_add_message(__('Friendship rejected', 'buddypress'));
} else {
bp_core_add_message(__('Friendship could not be rejected', 'buddypress'), 'error');
}
bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
} elseif (bp_is_action_variable('cancel', 0) && is_numeric(bp_action_variable(1))) {
// Check the nonce
check_admin_referer('friends_withdraw_friendship');
if (friends_withdraw_friendship(bp_loggedin_user_id(), bp_action_variable(1))) {
bp_core_add_message(__('Friendship request withdrawn', 'buddypress'));
} else {
bp_core_add_message(__('Friendship request could not be withdrawn', 'buddypress'), 'error');
}
bp_core_redirect(trailingslashit(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action()));
}
do_action('friends_screen_requests');
bp_core_load_template(apply_filters('friends_template_requests', 'members/single/home'));
}
示例7: bp_em_my_events
/**
* Controller for the event views in BP (using mvc terms here)
*/
function bp_em_my_events()
{
global $bp, $EM_Event;
if (!is_object($EM_Event) && !empty($_REQUEST['event_id'])) {
$EM_Event = new EM_Event($_REQUEST['event_id']);
}
do_action('bp_em_my_events');
//plug into EM admin code (at least for now)
include_once EM_DIR . '/admin/em-admin.php';
em_admin_load_scripts();
add_action('wp_head', 'em_admin_general_script');
$template_title = 'bp_em_my_events_title';
$template_content = 'bp_em_my_events_content';
if (count($bp->action_variables) > 0) {
if (is_object($EM_Event) && !$EM_Event->can_manage('edit_events', 'edit_others_events')) {
return false;
}
if (!empty($bp->action_variables[0])) {
switch ($bp->action_variables[0]) {
case 'edit':
$template_title = 'bp_em_my_events_editor_title';
$template_content = 'bp_em_my_events_editor';
break;
}
}
}
add_action('bp_template_title', $template_title);
add_action('bp_template_content', $template_content);
/* Finally load the plugin template file. */
bp_core_load_template(apply_filters('bp_core_template_plugin', 'members/single/plugins'));
}
示例8: bp_reshare_screen_my_reshares
function bp_reshare_screen_my_reshares()
{
if (bp_reshare_is_user_profile_reshares()) {
do_action('bp_reshare_screen_my_reshares');
bp_core_load_template(apply_filters('bp_reshare_template_my_reshares', 'members/single/home'));
}
}
示例9: screen_change_cover_photo
public function screen_change_cover_photo()
{
global $bp;
if (!empty($_POST['cover-image-crop-submit'])) {
if (!wp_verify_nonce($_POST['_wpnonce'], 'bp_crop_cover_photo')) {
die(__('Security check failed', 'bppbg'));
}
if ($this->handle_crop()) {
bp_core_add_message(__('Cover photo cropped successfully!', 'buddypress'));
}
}
if (!empty($_POST['cover-photo-submit'])) {
if (!wp_verify_nonce($_POST['_wpnonce'], 'bp_crop_cover_photo')) {
die(__('Security check failed', 'bppbg'));
}
if ($this->handle_upload()) {
bp_core_add_message(__('Cover photo uploaded successfully!', 'buddypress'));
}
}
// do jcrop things
add_action('wp_print_scripts', array($this, 'add_jquery_cropper'));
add_action('bp_template_title', array($this, 'change_page_title'));
add_action('bp_template_content', array($this, 'upload_page_content'));
bp_core_load_template(apply_filters('bp_core_template_plugin', 'members/single/plugins'));
}
示例10: friends_screen_requests
function friends_screen_requests()
{
if (bp_is_action_variable('accept', 0) && is_numeric(bp_action_variable(1))) {
// Check the nonce
check_admin_referer('friends_accept_friendship');
if (friends_accept_friendship(bp_action_variable(1))) {
bp_core_add_message(__('Friendship accepted', 'buddypress'));
} else {
bp_core_add_message(__('Friendship could not be accepted', 'buddypress'), 'error');
}
bp_core_redirect(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action());
} elseif (bp_is_action_variable('reject', 0) && is_numeric(bp_action_variable(1))) {
// Check the nonce
check_admin_referer('friends_reject_friendship');
if (friends_reject_friendship(bp_action_variable(1))) {
bp_core_add_message(__('Friendship rejected', 'buddypress'));
} else {
bp_core_add_message(__('Friendship could not be rejected', 'buddypress'), 'error');
}
bp_core_redirect(bp_loggedin_user_domain() . bp_current_component() . '/' . bp_current_action());
}
do_action('friends_screen_requests');
if (isset($_GET['new'])) {
bp_core_delete_notifications_by_type(bp_loggedin_user_id(), 'friends', 'friendship_request');
}
bp_core_load_template(apply_filters('friends_template_requests', 'members/single/home'));
}
示例11: wplms_dashboard_template
function wplms_dashboard_template()
{
if (!is_user_logged_in()) {
wp_redirect(site_url());
}
$template = 'templates/dashboard';
global $bp;
if ($bp->current_component == 'dashboard') {
wp_enqueue_style('wplms-dashboard-css', WPLMS_DASHBOARD_URL . '/css/wplms-dashboard.css', array(), '1.0');
wp_enqueue_script('wplms-dashboard-js', WPLMS_DASHBOARD_URL . '/js/wplms-dashboard.js', array('jquery', 'jquery-ui-sortable'), '1.0');
if (is_active_widget(false, false, 'wplms_instructor_dash_stats', true) || is_active_widget(false, false, 'wplms_dash_stats', true)) {
wp_enqueue_script('wplms-sparkline', WPLMS_DASHBOARD_URL . '/js/jquery.sparkline.min.js', array('jquery'), true);
}
if (is_active_widget(false, false, 'wplms_instructor_stats', true) || is_active_widget(false, false, 'wplms_instructor_commission_stats', true) || is_active_widget(false, false, 'wplms_student_stats', true)) {
wp_enqueue_script('wplms-raphael', WPLMS_DASHBOARD_URL . '/js/raphael-min.js', array('jquery'), true);
wp_enqueue_script('wplms-morris', WPLMS_DASHBOARD_URL . '/js/morris.min.js', array('jquery'), true);
}
$translation_array = array('earnings' => __('Earnings', 'wplms-dashboard'), 'payout' => __('Payout', 'wplms-dashboard'), 'students' => __('# Students', 'wplms-dashboard'), 'saved' => __('SAVED', 'wplms-dashboard'), 'saving' => __('SAVING ...', 'wplms-dashboard'), 'stats_calculated' => __('Stats Calculated, reloading page ...', 'wplms-dashboard'));
wp_localize_script('wplms-dashboard-js', 'wplms_dashboard_strings', $translation_array);
}
$located_template = apply_filters('bp_located_template', locate_template($template, false), $template);
if ($located_template && $located_template != '') {
bp_get_template_part(apply_filters('bp_load_template', $located_template));
} else {
bp_core_load_template(apply_filters('bp_core_template_plugin', 'members/single/dashboard'));
}
}
示例12: bind_bp_not_attending_page
function bind_bp_not_attending_page()
{
add_action('bp_template_title', array($this, 'show_not_attending_title'));
add_action('bp_template_content', array($this, 'show_not_attending_body'));
add_action('bp_head', array($this, 'enqueue_dependencies'));
bp_core_load_template(apply_filters('bp_core_template_plugin', 'members/single/plugins'));
}
示例13: pending_articles_screen
/**
* draft_article_screen()
*
* Sets up and displays the screen output for the sub nav item "social-articles/screen-two"
*/
function pending_articles_screen()
{
global $bp;
bp_update_is_directory(true, 'pending_articles');
do_action('pending_articles_screen');
bp_core_load_template(apply_filters('pending_articles_screen', 'members/single/articles'));
}
示例14: buddyreshare_screen_user_reshares
/**
* Loads the templates for the user's profile reshare tab
*
* @package BP Reshare
* @since 1.0
*
* @uses buddyreshare_is_user_profile_reshares() to check we're on a user's profile reshare tab
* @uses bp_core_load_template() to load the template
*/
function buddyreshare_screen_user_reshares()
{
if (!buddyreshare_is_user_profile_reshares()) {
return;
}
do_action('bpuddyreshare_screen_my_reshares');
bp_core_load_template(apply_filters('buddyreshare_screen_user_reshares', 'members/single/home'));
}
示例15: bp_blogs_screen_index
function bp_blogs_screen_index()
{
if (is_multisite() && bp_is_blogs_component() && !bp_current_action()) {
bp_update_is_directory(true, 'blogs');
do_action('bp_blogs_screen_index');
bp_core_load_template(apply_filters('bp_blogs_screen_index', 'blogs/index'));
}
}