示例#1
1
function bphelp_pbpp_redirect()
{
    global $bp;
    //IMPORTANT: Do not alter the following line.
    $bphelp_my_redirect_slug = get_option('bphelp-my-redirect-slug', 'register');
    if (bp_is_activity_component() || bp_is_groups_component() || bp_is_group_forum() || bbp_is_single_forum() || bbp_is_single_topic() || bp_is_forums_component() || bp_is_blogs_component() || bp_is_members_component() || bp_is_profile_component()) {
        if (!is_user_logged_in()) {
            bp_core_redirect(get_option('home') . '/' . $bphelp_my_redirect_slug);
        }
    }
}
示例#2
0
/**
 * Forces the BP Profile Pages to be 1 Column
 * 
 * @package lsx
 * @subpackage jetpack
 * @category infinite scroll
 */
function lsx_buddypress_page_columns($layout)
{
    if (bp_is_profile_component() || bp_is_settings_component() || bp_is_activity_component() || bp_is_group() || bp_is_messages_component() || bp_is_members_directory() || bp_is_groups_directory() || bp_is_groups_component() || bp_is_members_component()) {
        $layout = '1c';
    }
    return $layout;
}
function logged_out_redirect()
{
    global $bp;
    // BuddyPress components to lock
    if (bp_is_activity_component() || bp_is_groups_component() || bp_is_group_forum() || bp_is_forums_component() || bp_is_blogs_component() || bp_is_page(BP_MEMBERS_SLUG) || bp_is_profile_component()) {
        // Check if user is logged out
        if (!is_user_logged_in()) {
            // Check if a page was selected for redirection
            if (of_get_option('redirect')) {
                $redirect_page = get_permalink(of_get_option('redirect'));
                // If not redirect to login page
            } else {
                $redirect_page = site_url('/wp-login.php');
            }
            wp_redirect($redirect_page);
            exit;
        }
    }
}
 /**
  * Sets up the title for pages and <title>
  */
 public function setup_title()
 {
     if (bp_is_profile_component()) {
         $bp = buddypress();
         if (bp_is_my_profile()) {
             $bp->bp_options_title = _x('My Profile', 'Page title', 'buddypress');
         } else {
             $bp->bp_options_avatar = bp_core_fetch_avatar(array('item_id' => bp_displayed_user_id(), 'type' => 'thumb', 'alt' => sprintf(_x('Profile picture of %s', 'Avatar alt', 'buddypress'), bp_get_displayed_user_fullname())));
             $bp->bp_options_title = bp_get_displayed_user_fullname();
         }
     }
     parent::setup_title();
 }
function bp_is_user_change_avatar()
{
    if (bp_is_profile_component() && bp_is_current_action('change-avatar')) {
        return true;
    }
    return false;
}
/**
 * Returns the member activity feed link
 *
 * @since 1.2.0
 *
 * @uses bp_is_profile_component()
 * @uses bp_is_current_action()
 * @uses bp_displayed_user_domain()
 * @uses bp_get_activity_slug()
 * @uses bp_is_active()
 * @uses bp_get_friends_slug()
 * @uses bp_get_groups_slug()
 * @uses apply_filters() To call the 'bp_get_activities_member_rss_link' hook
 *
 * @return string $link The member activity feed link
 */
function bp_get_member_activity_feed_link()
{
    global $bp;
    if (bp_is_profile_component() || bp_is_current_action('just-me')) {
        $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/feed/';
    } elseif (bp_is_active('friends') && bp_is_current_action(bp_get_friends_slug())) {
        $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() . '/feed/';
    } elseif (bp_is_active('groups') && bp_is_current_action(bp_get_groups_slug())) {
        $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() . '/feed/';
    } elseif ('favorites' == $bp->current_action) {
        $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites/feed/';
    } elseif ('mentions' == $bp->current_action) {
        $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions/feed/';
    } else {
        $link = '';
    }
    return apply_filters('bp_get_activities_member_rss_link', $link);
}
示例#7
0
function uni_avatar_scripts()
{
    wp_enqueue_script('jquery');
    if (get_option('uni_upload_form_in_front')) {
        wp_enqueue_media();
    }
    if (function_exists('bp_is_active')) {
        if (bp_is_profile_component() && 'change-avatar' == bp_current_action() && get_option('uni_avatar_enable_buddypress_form_override')) {
            wp_enqueue_media();
        }
    }
    if (class_exists('bbPress')) {
        if (bbp_is_single_user_edit()) {
            wp_enqueue_media();
        }
    }
    wp_enqueue_script('jquery-ui-core');
    wp_enqueue_script('jquery-ui-widget');
    wp_enqueue_script('jcrop');
    wp_register_script('jquery.iframe-transport', UNI_AVATAR_WP_PLUGIN_URL . 'js/jquery.iframe-transport.js', array('jquery-ui-widget'), '1.8.3');
    wp_enqueue_script('jquery.iframe-transport');
    wp_register_script('jquery.fileupload', UNI_AVATAR_WP_PLUGIN_URL . 'js/jquery.fileupload.js', array('jquery-ui-widget'), '5.42.3');
    wp_enqueue_script('jquery.fileupload');
    wp_register_script('jquery.fileupload-process', UNI_AVATAR_WP_PLUGIN_URL . 'js/jquery.fileupload-process.js', array('jquery-ui-widget'), '5.42.3');
    wp_enqueue_script('jquery.fileupload-process');
    wp_register_script('jquery.fileupload-validate', UNI_AVATAR_WP_PLUGIN_URL . 'js/jquery.fileupload-validate.js', array('jquery-ui-widget'), '5.42.3');
    wp_enqueue_script('jquery.fileupload-validate');
    wp_register_script('uni-avatar-modal', UNI_AVATAR_WP_PLUGIN_URL . 'js/uni-avatar-modal.js', array('jquery.fileupload'), UNI_AVATAR_VERSION);
    wp_enqueue_script('uni-avatar-modal');
    $params = array('site_url' => get_bloginfo('url'), 'ajax_url' => admin_url('admin-ajax.php'), 'upload_form_in_front_on' => get_option('uni_upload_form_in_front') || function_exists('bp_is_active') && get_option('uni_avatar_enable_buddypress_form_override') && bp_is_profile_component() && 'change-avatar' == bp_current_action() || class_exists('bbPress') && bbp_is_single_user_edit() ? 1 : 0, 'select_avatars_on' => get_option('uni_avatar_custom_avatars') ? 1 : 0, 'uni_avatar_max' => get_option('uni_avatar_default_size') ? get_option('uni_avatar_default_size') * 1024 : UNI_AVATAR_DEFAULT_SIZE * 1024, 'modal_upload_title' => __('Upload Avatar', 'uni-avatar'), 'modal_select_title' => __('Select Avatar', 'uni-avatar'), 'file_not_allowed' => __('File type not allowed', 'uni-avatar'), 'file_too_large' => __('File is too large', 'uni-avatar'));
    wp_localize_script('uni-avatar-modal', 'uniavatarparams', $params);
    wp_enqueue_style('dashicons');
    wp_enqueue_style('admin-css', UNI_AVATAR_WP_PLUGIN_URL . 'css/uniavatar-styles-front.css');
}
 /**
  * Sets up the title for pages and <title>
  *
  * @global obj $bp
  */
 function setup_title()
 {
     global $bp;
     if (bp_is_profile_component()) {
         if (bp_is_my_profile()) {
             $bp->bp_options_title = __('My Profile', 'buddypress');
         } else {
             $bp->bp_options_avatar = bp_core_fetch_avatar(array('item_id' => $bp->displayed_user->id, 'type' => 'thumb'));
             $bp->bp_options_title = $bp->displayed_user->fullname;
         }
     }
     parent::setup_title();
 }
 function check_if_privacy_on()
 {
     global $bp;
     $privacy_enable = get_option('tn_wpmu_privacy_status');
     $privacy_redirect = get_option('tn_wpmu_privacy_redirect');
     if ($privacy_enable == "enable") {
         if (bp_is_profile_component() || bp_is_activity_component() || bp_is_page(BP_MEMBERS_SLUG) || bp_is_user()) {
             if (!is_user_logged_in()) {
                 if ($privacy_redirect == '') {
                     bp_core_redirect($bp->root_domain . '/' . bp_get_root_slug('register'));
                 } else {
                     bp_core_redirect($privacy_redirect);
                 }
             }
         }
     }
     //off
 }
 function inject_js()
 {
     if ((bp_is_my_profile() || is_super_admin()) && bp_is_profile_component() && bp_is_current_action('change-cover')) {
         wp_enqueue_script('bpcp-js', plugin_dir_url(__FILE__) . 'bpcp.js', array('jquery'));
     }
 }
/**
 * Return the member activity feed link.
 *
 * @since BuddyPress (1.2.0)
 *
 * @uses bp_is_profile_component()
 * @uses bp_is_current_action()
 * @uses bp_displayed_user_domain()
 * @uses bp_get_activity_slug()
 * @uses bp_is_active()
 * @uses bp_get_friends_slug()
 * @uses bp_get_groups_slug()
 * @uses apply_filters() To call the 'bp_get_activities_member_rss_link' hook.
 *
 * @return string $link The member activity feed link.
 */
function bp_get_member_activity_feed_link()
{
    // Single member activity feed link
    if (bp_is_profile_component() || bp_is_current_action('just-me')) {
        $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/feed/';
        // Friend feed link
    } elseif (bp_is_active('friends') && bp_is_current_action(bp_get_friends_slug())) {
        $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_friends_slug() . '/feed/';
        // Group feed link
    } elseif (bp_is_active('groups') && bp_is_current_action(bp_get_groups_slug())) {
        $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() . '/feed/';
        // Favorites activity feed link
    } elseif ('favorites' === bp_current_action()) {
        $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites/feed/';
        // Mentions activity feed link
    } elseif ('mentions' === bp_current_action() && bp_activity_do_mentions()) {
        $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions/feed/';
        // No feed link
    } else {
        $link = '';
    }
    /**
     * Filters the member activity feed link.
     *
     * @since BuddyPress (1.0.0)
     *
     * @param string $link URL for the member activity feed.
     */
    return apply_filters('bp_get_activities_member_rss_link', $link);
}
示例#12
0
function bp_is_user_change_avatar()
{
    return (bool) (bp_is_profile_component() && bp_is_current_action('change-avatar'));
}
/**
 * Get content width
 */
function get_content_width($site_width)
{
    global $cap, $post, $bp;
    if ($cap->cc_responsive_enable) {
        $cap->rightsidebar_width = 225;
        $cap->leftsidebar_width = 225;
    }
    $cap->archive_template = $cap->archive_template == 'full-width' && defined('is_pro') ? $cap->archive_template : $cap->sidebar_position;
    if (defined('BP_VERSION') && bp_is_user() && check_value($cap->bp_profile_sidebars, 'none', '==')) {
        return $site_width;
    } else {
        if (defined('BP_VERSION') && bp_is_user() && check_value($cap->bp_profile_sidebars, 'default', '!=')) {
            if (check_value($cap->bp_profile_sidebars, 'left', '==') || check_value($cap->bp_profile_sidebars, 'left and right', '==')) {
                $site_width -= $cap->leftsidebar_width;
            }
            if (check_value($cap->bp_profile_sidebars, 'right', '==') || check_value($cap->bp_profile_sidebars, 'left and right', '==')) {
                $site_width -= $cap->rightsidebar_width;
            }
            return $site_width;
        } else {
            if ((!is_page() || is_page('search') || is_search()) && !is_archive() || function_exists('is_bbpress') && is_bbpress() && !is_archive()) {
                $tpl = !empty($post) ? get_post_meta($post->ID, '_wp_page_template', TRUE) : FALSE;
                $tpl = empty($tpl) ? 'default' : $tpl;
                $affected = FALSE;
                if (check_value($cap->bp_profile_sidebars, 'default', '==') && $tpl == 'full-width.php') {
                    return $site_width;
                }
                if (check_value($cap->bp_profile_sidebars, 'default', '==') && ($tpl == '_pro/tpl-left-and-right-sidebar.php' || $tpl == '_pro/tpl-left-sidebar.php')) {
                    $site_width -= $cap->leftsidebar_width;
                    $affected = TRUE;
                }
                if (check_value($cap->bp_profile_sidebars, 'default', '==') && ($tpl == '_pro/tpl-left-and-right-sidebar.php' || $tpl == '_pro/tpl-right-sidebar.php')) {
                    $site_width -= $cap->rightsidebar_width;
                    $affected = TRUE;
                }
                if ($affected) {
                    return $site_width;
                }
                if (check_value($cap->bp_profile_sidebars, 'none', '==')) {
                    return $site_width;
                } elseif (check_value($cap->bp_profile_sidebars, 'left', '==') || check_value($cap->bp_profile_sidebars, 'default', '==') && check_value($cap->sidebar_position, 'left', '==')) {
                    $site_width -= $cap->leftsidebar_width;
                }
                if (check_value($cap->bp_profile_sidebars, 'right', '==') || check_value($cap->bp_profile_sidebars, 'default', '==') && check_value($cap->sidebar_position, 'right', '===')) {
                    $site_width -= $cap->rightsidebar_width;
                } else {
                    if (check_value($cap->bp_profile_sidebars, 'left and right', '==') || check_value($cap->bp_profile_sidebars, 'default', '==') && check_value($cap->sidebar_position, 'left and right', '==')) {
                        $site_width = $site_width - $cap->rightsidebar_width - $cap->leftsidebar_width;
                    }
                }
                return $site_width;
            } elseif (is_archive()) {
                if (defined('is_pro') && ($cap->archive_template == 'full-width' || check_value($cap->archive_template, 'full-width', '=='))) {
                    return $site_width;
                }
                if (is_archive() && ($cap->archive_template == 'left' || $cap->archive_template == 'left and right' || check_value($cap->archive_template, 'left', '==') || check_value($cap->archive_template, 'left and right', '=='))) {
                    $site_width -= $cap->leftsidebar_width;
                }
                if ($cap->archive_template == "right" || $cap->archive_template == "left and right" || check_value($cap->archive_template, 'right', '==') || check_value($cap->archive_template, 'left and right', '==')) {
                    $site_width -= $cap->rightsidebar_width;
                }
            } else {
                if (isset($post)) {
                    $detect = new TK_WP_Detect();
                    $component = explode('-', $detect->tk_get_page_type());
                    if (!empty($component[2])) {
                        if ($component[2] == 'groups' && !empty($component[3]) && (property_exists($bp, 'unfiltered_uri') && !empty($bp->unfiltered_uri[0]) && $bp->unfiltered_uri[0] != 'members')) {
                            if ($cap->bp_groups_sidebars == 'default' && check_value($cap->sidebar_position, 'left and right', '==') || $cap->bp_groups_sidebars == 'left' || $cap->bp_groups_sidebars == __('left', 'cc') || $cap->bp_groups_sidebars == 'left and right' || check_value($cap->bp_groups_sidebars, 'left and right', '==')) {
                                $site_width -= $cap->leftsidebar_width;
                            }
                            if ($cap->bp_groups_sidebars == 'default' || $cap->bp_groups_sidebars == 'right' || check_value($cap->bp_groups_sidebars, 'right', '==') || $cap->bp_groups_sidebars == 'left and right' || check_value($cap->bp_groups_sidebars, 'left and right', '==')) {
                                $site_width -= $cap->rightsidebar_width;
                            }
                            return $site_width;
                        } elseif (property_exists($bp, 'unfiltered_uri') && !empty($bp->unfiltered_uri[0]) && $bp->unfiltered_uri[0] == 'members' || bp_is_activity_component() || bp_is_profile_component() || bp_is_messages_component() || bp_is_friends_component() || bp_is_settings_component()) {
                            if (($cap->bp_profile_sidebars == 'default' || check_value($cap->sidebar_position, 'default', '==')) && ($cap->bp_profile_sidebars == 'left and right' || check_value($cap->sidebar_position, 'left and right', '==') || check_value($cap->sidebar_position, 'left', '==') || $cap->sidebar_position == 'left') || $cap->bp_profile_sidebars == 'left' || check_value($cap->bp_profile_sidebars, 'left', '==') || $cap->bp_profile_sidebars == 'left and right' || check_value($cap->bp_profile_sidebars, 'left and right', '==')) {
                                $site_width -= $cap->leftsidebar_width;
                            }
                            if (($cap->bp_profile_sidebars == "default" || check_value($cap->bp_profile_sidebars, 'default', '==')) && ($cap->sidebar_position == "right" || check_value($cap->sidebar_position, 'right', '==') || $cap->sidebar_position == "left and right" || check_value($cap->sidebar_position, 'left and right', '==')) || $cap->bp_profile_sidebars == 'right' || check_value($cap->bp_profile_sidebars, 'right', '==') || $cap->bp_profile_sidebars == 'left and right' || check_value($cap->bp_profile_sidebars, 'left and right', '==')) {
                                $site_width -= $cap->rightsidebar_width;
                            }
                            return $site_width;
                        } elseif ($component[2] == 'members') {
                            if (check_value($cap->sidebar_position, 'left and right', '==') || check_value($cap->sidebar_position, 'default', '==')) {
                                $site_width -= $cap->leftsidebar_width;
                            }
                            if (check_value($cap->sidebar_position, 'left and right', '==') || check_value($cap->sidebar_position, 'right', '==')) {
                                $site_width -= $cap->rightsidebar_width;
                            }
                            return $site_width;
                        } else {
                            if ($component[2] != 'forums') {
                                if (check_value($cap->sidebar_position, 'left and right', '==') || check_value($cap->sidebar_position, 'default', '==')) {
                                    $site_width -= $cap->leftsidebar_width;
                                }
                                if (check_value($cap->sidebar_position, 'left and right', '==') || check_value($cap->sidebar_position, 'right', '==')) {
                                    $site_width -= $cap->rightsidebar_width;
                                }
                                return $site_width;
                            }
                        }
                    }
                    $width_change = FALSE;
                    $tmp = get_post_meta($post->ID, '_wp_page_template', true);
                    if ($tmp == 'full-width.php') {
                        return $site_width;
                    }
                    // page template - if empty use "default" here...
                    if ($tmp == '') {
                        $tmp = 'default';
                    }
                    //page template
                    if ($tmp == '_pro/tpl-left-and-right-sidebar.php' || $tmp == '_pro/tpl-search-right-and-left-sidebar.php' || $tmp == '_pro/tpl-left-sidebar.php' || $tmp == '_pro/tpl-search-left-sidebar.php') {
                        $site_width -= $cap->leftsidebar_width;
                        $width_change = TRUE;
                    }
                    if ($tmp == '_pro/tpl-left-and-right-sidebar.php' || $tmp == '_pro/tpl-search-right-and-left-sidebar.php' || $tmp == '_pro/tpl-right-sidebar.php' || $tmp == '_pro/tpl-search-right-sidebar.php') {
                        $site_width -= $cap->rightsidebar_width;
                        $width_change = TRUE;
                    }
                    if ($width_change) {
                        return $site_width;
                    }
                    //global settings
                    if (check_value($cap->sidebar_position, 'left', '==') || check_value($cap->sidebar_position, 'left and right', '==')) {
                        $site_width -= $cap->leftsidebar_width;
                        $width_change = TRUE;
                    }
                    if (check_value($cap->sidebar_position, 'right', '===') || check_value($cap->sidebar_position, 'left and right', '==')) {
                        $site_width -= $cap->rightsidebar_width;
                        $width_change = TRUE;
                    }
                    if ($width_change) {
                        return $site_width;
                    }
                }
            }
        }
    }
    return $site_width;
}
 /**
  * footer: add the sidebar and their default widgets to the right sidebar
  *
  * located: footer.php do_action( 'sidebar_left' )
  *
  * @package Custom Community
  * @since 1.8.3
  */
 function sidebar_right()
 {
     global $cap, $post, $bp;
     $tmp = !empty($post) ? get_post_meta($post->ID, '_wp_page_template', true) : '';
     if (defined('BP_VERSION') && bp_is_user() && ($cap->bp_profile_sidebars == __('none', 'cc') || $cap->bp_profile_sidebars == __('left', 'cc'))) {
         return;
     }
     if (defined('BP_VERSION') && bp_is_group() && ($cap->bp_groups_sidebars == __('none', 'cc') || $cap->bp_groups_sidebars == __('left', 'cc'))) {
         return;
     }
     if (function_exists('is_bbpress') && (is_bbpress() && defined('BP_VERSION') && !bp_is_user() && !bp_is_group()) && ($cap->sidebar_position == __('left', 'cc') || $cap->sidebar_position == __('full-width', 'cc'))) {
         return;
     } else {
         if (function_exists('is_bbpress') && (is_bbpress() && defined('BP_VERSION') && !bp_is_user() && !bp_is_group()) && ($cap->sidebar_position == __('right', 'cc') || $cap->sidebar_position == __('left and right', 'cc'))) {
             locate_template(array('sidebar.php'), true);
             return;
         }
     }
     if ($tmp == 'full-width.php' || $tmp == 'tpl-search-full-width.php' || $tmp == 'left-sidebar.php' || $tmp == '_pro/tpl-left-sidebar.php') {
         return;
     }
     if ($tmp == 'left-and-right-sidebar.php' || $tmp == 'right-sidebar.php' || $tmp == '_pro/tpl-left-and-right-sidebar.php' || $tmp == '_pro/tpl-search-right-and-left-sidebar.php' || $tmp == '_pro/tpl-right-sidebar.php' || $tmp == '_pro/tpl-search-right-sidebar.php') {
         locate_template(array('sidebar.php'), true);
         return;
     }
     $component = explode('-', $this->detect->tk_get_page_type());
     if (!empty($component[2])) {
         if ($component[2] == 'groups' && !empty($component[3]) && $bp->unfiltered_uri[0] != 'members') {
             if ($cap->bp_groups_sidebars == 'right' || $cap->bp_groups_sidebars == __('right', 'cc') || $cap->bp_groups_sidebars == 'left and right' || $cap->bp_groups_sidebars == __('left and right', 'cc')) {
                 locate_template(array('groups/single/group-sidebar-right.php'), true);
             } elseif (($cap->bp_groups_sidebars == "default" || $cap->bp_groups_sidebars == __("default", 'cc')) && ($cap->sidebar_position == "right" || $cap->sidebar_position == __("right", 'cc')) || ($cap->sidebar_position == "left and right" || $cap->sidebar_position == __("left and right", 'cc')) && ($cap->bp_groups_sidebars == "default" || $cap->bp_groups_sidebars == __("default", 'cc'))) {
                 locate_template(array('sidebar.php'), true);
             }
             return;
         } elseif ($bp->unfiltered_uri[0] == 'members' || bp_is_activity_component() || bp_is_profile_component() || bp_is_messages_component() || bp_is_friends_component() || bp_is_settings_component()) {
             if ($cap->bp_profile_sidebars == 'right' || $cap->bp_profile_sidebars == __('right', 'cc') || $cap->bp_profile_sidebars == 'left and right' || $cap->bp_profile_sidebars == __('left and right', 'cc')) {
                 locate_template(array('members/single/member-sidebar-right.php'), true);
             } elseif (($cap->bp_profile_sidebars == "default" || $cap->bp_profile_sidebars == __("default", 'cc')) && ($cap->sidebar_position == "right" || $cap->sidebar_position == __("right", 'cc')) || ($cap->sidebar_position == "left and right" || $cap->sidebar_position == __("left and right", 'cc')) && ($cap->bp_profile_sidebars == "default" || $cap->bp_profile_sidebars == __("default", 'cc'))) {
                 locate_template(array('sidebar.php'), true);
             }
             return;
         } else {
             if ($cap->sidebar_position == "right" || $cap->sidebar_position == __("right", 'cc') || $cap->sidebar_position == "left and right" || $cap->sidebar_position == __("left and right", 'cc')) {
                 locate_template(array('sidebar.php'), true);
                 return;
             }
         }
     } elseif (empty($component[2]) && !is_archive() && !is_page()) {
         if ($cap->sidebar_position == "right" || $cap->sidebar_position == __("right", 'cc') || $cap->sidebar_position == "left and right" || $cap->sidebar_position == __("left and right", 'cc')) {
             locate_template(array('sidebar.php'), true);
             return;
         }
     }
     $cap->archive_template = $cap->archive_template == 'full-width' && defined('is_pro') ? $cap->archive_template : $cap->sidebar_position;
     if (is_archive() && ($cap->archive_template == "right" || $cap->archive_template == "left and right" || $cap->archive_template == __("right", 'cc') || $cap->archive_template == __("left and right", 'cc'))) {
         locate_template(array('sidebar.php'), true);
         return;
     } else {
         if (!is_page() && ($cap->archive_template == "left" || $cap->archive_template == __("left", 'cc') || $cap->archive_template == 'full-width' || $cap->archive_template == __('full-width', 'cc'))) {
             return;
         }
     }
     if ($cap->sidebar_position == __('left and right', 'cc') || $cap->sidebar_position == __('right', 'cc')) {
         locate_template(array('sidebar.php'), true);
         return;
     }
 }
示例#15
0
 /**
  * Similar to the post_class() function, but for BP. This is NOT used by core Suffusion, but is useful for child themes using BP.
  * This might be defined by the Suffusion BuddyPress Pack for BP users of Suffusion, but is included conditionally here so
  * that the theme and the plugin can be used independently of each other and so that one version of Suffusion can work with an older
  * version of the BP pack.
  *
  * @since 3.6.7
  * @param bool $custom
  * @param bool $echo
  * @return bool|string
  */
 function suffusion_bp_content_class($custom = false, $echo = true)
 {
     if (!function_exists('bp_is_group')) {
         return false;
     }
     $css = array();
     $css[] = 'post';
     if (function_exists('bp_is_profile_component') && bp_is_profile_component()) {
         $css[] = 'profile-component';
     }
     if (function_exists('bp_is_activity_component') && bp_is_activity_component()) {
         $css[] = 'activity-component';
     }
     if (function_exists('bp_is_blogs_component') && bp_is_blogs_component()) {
         $css[] = 'blogs-component';
     }
     if (function_exists('bp_is_messages_component') && bp_is_messages_component()) {
         $css[] = 'messages-component';
     }
     if (function_exists('bp_is_friends_component') && bp_is_friends_component()) {
         $css[] = 'friends-component';
     }
     if (function_exists('bp_is_groups_component') && bp_is_groups_component()) {
         $css[] = 'groups-component';
     }
     if (function_exists('bp_is_settings_component') && bp_is_settings_component()) {
         $css[] = 'settings-component';
     }
     if (function_exists('bp_is_member') && bp_is_member()) {
         $css[] = 'member';
     }
     if (function_exists('bp_is_user_activity') && bp_is_user_activity()) {
         $css[] = 'user-activity';
     }
     if (function_exists('bp_is_user_friends_activity') && bp_is_user_friends_activity()) {
         $css[] = 'user-friends-activity';
     }
     if (function_exists('bp_is_activity_permalink') && bp_is_activity_permalink()) {
         $css[] = 'activity-permalink';
     }
     if (function_exists('bp_is_user_profile') && bp_is_user_profile()) {
         $css[] = 'user-profile';
     }
     if (function_exists('bp_is_profile_edit') && bp_is_profile_edit()) {
         $css[] = 'profile-edit';
     }
     if (function_exists('bp_is_change_avatar') && bp_is_change_avatar()) {
         $css[] = 'change-avatar';
     }
     if (function_exists('bp_is_user_groups') && bp_is_user_groups()) {
         $css[] = 'user-groups';
     }
     if (function_exists('bp_is_group') && bp_is_group()) {
         $css[] = 'group';
     }
     if (function_exists('bp_is_group_home') && bp_is_group_home()) {
         $css[] = 'group-home';
     }
     if (function_exists('bp_is_group_create') && bp_is_group_create()) {
         $css[] = 'group-create';
     }
     if (function_exists('bp_is_group_admin_page') && bp_is_group_admin_page()) {
         $css[] = 'group-admin-page';
     }
     if (function_exists('bp_is_group_forum') && bp_is_group_forum()) {
         $css[] = 'group-forum';
     }
     if (function_exists('bp_is_group_activity') && bp_is_group_activity()) {
         $css[] = 'group-activity';
     }
     if (function_exists('bp_is_group_forum_topic') && bp_is_group_forum_topic()) {
         $css[] = 'group-forum-topic';
     }
     if (function_exists('bp_is_group_forum_topic_edit') && bp_is_group_forum_topic_edit()) {
         $css[] = 'group-forum-topic-edit';
     }
     if (function_exists('bp_is_group_members') && bp_is_group_members()) {
         $css[] = 'group-members';
     }
     if (function_exists('bp_is_group_invites') && bp_is_group_invites()) {
         $css[] = 'group-invites';
     }
     if (function_exists('bp_is_group_membership_request') && bp_is_group_membership_request()) {
         $css[] = 'group-membership-request';
     }
     if (function_exists('bp_is_group_leave') && bp_is_group_leave()) {
         $css[] = 'group-leave';
     }
     if (function_exists('bp_is_group_single') && bp_is_group_single()) {
         $css[] = 'group-single';
     }
     if (function_exists('bp_is_user_blogs') && bp_is_user_blogs()) {
         $css[] = 'user-blogs';
     }
     if (function_exists('bp_is_user_recent_posts') && bp_is_user_recent_posts()) {
         $css[] = 'user-recent-posts';
     }
     if (function_exists('bp_is_user_recent_commments') && bp_is_user_recent_commments()) {
         $css[] = 'user-recent-commments';
     }
     if (function_exists('bp_is_create_blog') && bp_is_create_blog()) {
         $css[] = 'create-blog';
     }
     if (function_exists('bp_is_user_friends') && bp_is_user_friends()) {
         $css[] = 'user-friends';
     }
     if (function_exists('bp_is_friend_requests') && bp_is_friend_requests()) {
         $css[] = 'friend-requests';
     }
     if (function_exists('bp_is_user_messages') && bp_is_user_messages()) {
         $css[] = 'user-messages';
     }
     if (function_exists('bp_is_messages_inbox') && bp_is_messages_inbox()) {
         $css[] = 'messages-inbox';
     }
     if (function_exists('bp_is_messages_sentbox') && bp_is_messages_sentbox()) {
         $css[] = 'messages-sentbox';
     }
     if (function_exists('bp_is_notices') && bp_is_notices()) {
         $css[] = 'notices';
     }
     if (function_exists('bp_is_messages_compose_screen') && bp_is_messages_compose_screen()) {
         $css[] = 'messages-compose-screen';
     }
     if (function_exists('bp_is_single_item') && bp_is_single_item()) {
         $css[] = 'single-item';
     }
     if (function_exists('bp_is_activation_page') && bp_is_activation_page()) {
         $css[] = 'activation-page';
     }
     if (function_exists('bp_is_register_page') && bp_is_register_page()) {
         $css[] = 'register-page';
     }
     $css[] = 'fix';
     if (is_array($custom)) {
         foreach ($custom as $class) {
             if (!in_array($class, $css)) {
                 $css[] = esc_attr($class);
             }
         }
     } else {
         if ($custom != false) {
             $css[] = $custom;
         }
     }
     $css_class = implode(' ', $css);
     if ($echo) {
         echo ' class="' . $css_class . '" ';
     }
     return ' class="' . $css_class . '" ';
 }
示例#16
0
 public function frontend_js()
 {
     wp_enqueue_script('bp-cover-photo', plugin_dir_url(__FILE__) . '/assets/js/cover-photo.js', array('jquery'), null, true);
     if (function_exists('bp_is_my_profile') && (bp_is_my_profile() && bp_is_profile_component() && bp_is_current_action('change-cover-photo'))) {
         if (!($image = get_transient('profile_cover_photo_' . bp_displayed_user_id()))) {
             return;
         }
         $image = getimagesize($image);
         $full_width = $this->width;
         // max cover photo width
         $full_height = $this->height;
         // max cover photo height
         // calculate aspect ratio
         $aspect_ratio = $full_width / $full_height;
         wp_localize_script('bp-cover-photo', 'bp_cover_photo_l10n', array('width' => $image[0], 'height' => $image[1], 'aspectRatio' => $aspect_ratio));
     }
 }
/**
 * Is the current page the a user's change cover image profile page?
 *
 * Eg http://example.com/members/joe/profile/change-cover-image/ (or a subpage thereof).
 *
 * @since 2.4.0
 *
 * @return bool True if the current page is a user's profile edit cover image page.
 */
function bp_is_user_change_cover_image()
{
    return (bool) (bp_is_profile_component() && bp_is_current_action('change-cover-image'));
}
示例#18
0
文件: app.php 项目: schiz/scrollax
 /**
  *
  */
 function miss_is_bp()
 {
     if (function_exists('bp_is_group') && (bp_is_blog_page() || bp_is_my_profile() || bp_is_my_profile() || is_front_page() || bp_is_component_front_page('activity') || bp_is_directory() || bp_is_profile_component() || bp_is_activity_component() || bp_is_blogs_component() || bp_is_messages_component() || bp_is_friends_component() || bp_is_groups_component() || bp_is_settings_component() || bp_is_user_activity() || bp_is_user_friends_activity() || bp_is_activity_permalink() || bp_is_user_profile() || bp_is_profile_edit() || bp_is_change_avatar() || bp_is_user_groups() || bp_is_group() || bp_is_group_home() || bp_is_group_create() || bp_is_group_admin_page() || bp_is_group_forum() || bp_is_group_activity() || bp_is_group_forum_topic() || bp_is_group_forum_topic_edit() || bp_is_group_members() || bp_is_group_invites() || bp_is_group_membership_request() || bp_is_group_leave() || bp_is_group_single() || bp_is_user_blogs() || bp_is_user_recent_posts() || bp_is_user_recent_commments() || bp_is_create_blog() || bp_is_user_friends() || bp_is_friend_requests() || bp_is_user_messages() || bp_is_messages_inbox() || bp_is_messages_sentbox() || bp_is_notices() || bp_is_messages_compose_screen() || bp_is_activation_page() || bp_is_register_page())) {
         return true;
     }
     return false;
 }