Esempio n. 1
5
/**
 * 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'));
}
Esempio n. 2
0
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'));
}
/**
 * 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');
    }
}
Esempio n. 4
0
 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'));
 }
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'));
}
Esempio n. 6
0
/**
 * 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'));
}
Esempio n. 7
0
/**
 * 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'));
}
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'));
    }
}
 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'));
 }
Esempio n. 10
0
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'));
}
Esempio n. 11
0
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'));
    }
}
 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'));
 }
/**
 * 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'));
}
Esempio n. 14
0
/**
 * 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'));
}
Esempio n. 15
0
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'));
    }
}
Esempio n. 16
0
/**
 * Handle the display of the mediapress directory index.
 */
function mpp_gallery_screen_directory()
{
    if (mpp_is_gallery_directory()) {
        bp_update_is_directory(true, 'mediapress');
        do_action('mpp_gallery_screen_directory');
        bp_core_load_template(apply_filters('mpp_gallery_screen_directory', 'mediapress/directory/index-full'));
    }
}
Esempio n. 17
0
/**
 * Handles the display of the members directory index
 *
 * @global object $bp
 *
 * @uses bp_is_user()
 * @uses bp_is_current_component()
 * @uses do_action()
 * @uses bp_core_load_template()
 * @uses apply_filters()
 */
function bp_members_screen_index()
{
    if (!bp_is_user() && bp_is_members_component()) {
        bp_update_is_directory(true, 'members');
        do_action('bp_members_screen_index');
        bp_core_load_template(apply_filters('bp_members_screen_index', 'members/index'));
    }
}
Esempio n. 18
0
/**
 * Load the top-level Blogs directory.
 */
function bp_blogs_screen_index()
{
    if (bp_is_blogs_directory()) {
        bp_update_is_directory(true, 'blogs');
        do_action('bp_blogs_screen_index');
        bp_core_load_template(apply_filters('bp_blogs_screen_index', 'blogs/index'));
    }
}
Esempio n. 19
0
/**
 * Hook the "my achievements" template into BP's plugins template
 *
 * This function requires BuddyPress.
 *
 * @since Achievements (3.2)
 */
function dpa_bp_members_my_achievements()
{
    // Inelegant hack to disable our theme compat if we're using BP's "bp_template_content" filter.
    remove_filter('dpa_template_include', 'dpa_template_include_theme_supports', 2, 1);
    remove_filter('dpa_template_include', 'dpa_template_include_theme_compat', 4, 2);
    add_action('bp_template_content', 'dpa_bp_members_my_achievements_content');
    bp_core_load_template(apply_filters('dpa_bp_members_my_achievements', 'members/single/plugins'));
}
Esempio n. 20
0
function bp_show_activation_page()
{
    global $bp, $current_blog;
    require BP_PLUGIN_DIR . '/bp-core/bp-core-activation.php';
    if ($bp->current_component == BP_ACTIVATION_SLUG && $bp->current_action == '') {
        bp_core_activation_set_headers();
        bp_core_load_template('activate', true);
    }
}
 function screen_handler()
 {
     global $bp;
     if (bp_is_current_component($bp->search->slug)) {
         //really? yup, we don't care about others vars set or not
         bp_core_load_template(apply_filters('bp_unified_search_template', 'search-single'), true);
     }
     //use this filter to change the main template file of search which lists the search
 }
Esempio n. 22
0
 function tab_template()
 {
     global $_qa_core;
     add_action('bp_template_content', array(&$this, 'tab_content'));
     add_action('bp_member_plugin_options_nav', array(&$this, 'tab_nav'));
     add_filter('is_qa_page', array(&$this, 'is_qa_page'), 10, 2);
     $_qa_core->load_default_style();
     bp_core_load_template('members/single/plugins');
 }
/**
 * Show the capabilities settings template
 *
 * @since BuddyPress (1.6)
 *
 * @return If we shouldn't be here
 */
function bp_settings_screen_capabilities()
{
    if (bp_action_variables()) {
        bp_do_404();
        return;
    }
    // Load the template
    bp_core_load_template(apply_filters('bp_settings_screen_capabilities', 'members/single/settings/capabilities'));
}
Esempio n. 24
0
/**
 * Controller for the event views in BP (using mvc terms here)
 */
function bp_em_my_group_events()
{
    global $bp;
    do_action('bp_em_my_group_events');
    add_action('bp_template_title', 'bp_em_my_group_events_title');
    add_action('bp_template_content', 'bp_em_my_group_events_content');
    /* Finally load the plugin template file. */
    bp_core_load_template(apply_filters('bp_core_template_plugin', 'members/single/plugins'));
}
function buddyforms_bp_sensei_create_courses_page()
{
    global $buddyforms, $buddyforms_bp_sensei;
    $buddyforms_bp_sensei = get_option('buddyforms_bp_sensei');
    if (isset($buddyforms_bp_sensei['courses']) && $buddyforms_bp_sensei['courses'] != 'none') {
        add_action('bp_template_title', 'bf_bp_sensei_completed_courses_page_title');
        add_action('bp_template_content', 'bf_bp_sensei_completed_courses_page_content');
        bp_core_load_template(apply_filters('bp_core_template_plugin', 'members/single/plugins'));
    }
}
Esempio n. 26
0
/**
 * Catch the 'friends' screen.
 *
 * @since 1.0.0
 */
function bp_mute_friends_screen()
{
    /**
     * Fires before loading the 'friends' screen template.
     *
     * @since 1.0.0
     */
    do_action('bp_mute_friends_screen');
    bp_mute_load_template_content();
    bp_core_load_template('members/single/plugins');
}
/**
 * Controller for the event views in BP (using mvc terms here)
 */
function bp_em_group_events()
{
    global $bp;
    do_action('bp_em_group_events');
    //plug into EM admin code (at least for now)
    include_once EM_DIR . '/admin/em-admin.php';
    add_action('bp_template_title', 'bp_em_group_events_title');
    add_action('bp_template_content', 'bp_em_group_events_content');
    /* Finally load the plugin template file. */
    bp_core_load_template(apply_filters('bp_core_template_plugin', 'groups/single/plugins'));
}
/**
 * Loads template for the user compliments tab.
 *
 * @since 0.0.1
 * @package BuddyPress_Compliments
 *
 * @global object $bp BuddyPress instance.
 */
function bp_compliments_screen_compliments()
{
    global $bp;
    /**
     * Functions hooked to this action will be processed before loading compliments page screen .
     *
     * @since 0.0.1
     * @package BuddyPress_Compliments
     */
    do_action('bp_compliments_screen_compliments');
    bp_core_load_template('members/single/compliments');
}
Esempio n. 29
0
/**
 * bp_em_screen_two()
 *
 * Sets up and displays the screen output for the sub nav item "em/screen-two"
 */
function bp_em_attending()
{
    global $bp;
    /**
     * If the user has not Accepted or Rejected anything, then the code above will not run,
     * we can continue and load the template.
     */
    do_action('bp_em_attending');
    add_action('bp_template_title', 'bp_em_attending_title');
    add_action('bp_template_content', 'bp_em_attending_content');
    /* Finally load the plugin template file. */
    bp_core_load_template(apply_filters('bp_core_template_plugin', 'members/single/plugins'));
}
Esempio n. 30
0
/**
 * bp_em_screen_one()
 *
 * Sets up and displays the screen output for the sub nav item "em/screen-one"
 */
function bp_em_events()
{
    global $bp, $EM_Notices;
    if (bp_is_my_profile()) {
        $EM_Notices->add_info(__('You are currently viewing your public page, this is what other users will see.', 'dbem'));
    }
    /* Add a do action here, so your component can be extended by others. */
    do_action('bp_em_events');
    add_action('bp_template_title', 'bp_em_events_title');
    add_action('bp_template_content', 'bp_em_events_content');
    bp_core_load_template(apply_filters('bp_core_template_plugin', 'members/single/plugins'));
    //bp_core_load_template( apply_filters( 'bp_em_template_screen_one', 'em/screen-one' ) );
}