Ejemplo n.º 1
0
/**
 * Enqueues CSS files.
 *
 * @since 2.0
 * @global object $bp BuddyPress global settings
 */
function dpa_add_css()
{
    global $bp;
    if (is_active_widget(false, false, 'achievements-sitewide') || is_active_widget(false, false, 'achievements-available-achievements') || is_active_widget(false, false, 'achievements-member-achievements') || is_active_widget(false, false, 'achievements-featured-achievement') || is_active_widget(false, false, 'achievements-member-achievements-available') || is_active_widget(false, false, 'achievements-member-points')) {
        nxt_enqueue_style('achievements-widget', plugins_url('/css/widget.css', __FILE__), array(), ACHIEVEMENTS_VERSION);
    }
    if (!bp_is_current_component($bp->achievements->slug)) {
        if (bp_is_active('activity') && bp_is_activity_component() && !bp_is_blog_page() || bp_is_component_front_page('activity') && bp_is_front_page()) {
            nxt_enqueue_style('achievements-directory', plugins_url('/css/directory.css', __FILE__), array(), ACHIEVEMENTS_VERSION);
        }
        nxt_print_styles();
        return;
    }
    if (DPA_SLUG_CREATE == $bp->current_action && dpa_permission_can_user_create() || DPA_SLUG_ACHIEVEMENT_EDIT == $bp->current_action && dpa_permission_can_user_edit() || DPA_SLUG_ACHIEVEMENT_CHANGE_PICTURE == $bp->current_action && dpa_permission_can_user_change_picture() || DPA_SLUG_ACHIEVEMENT_GRANT == $bp->current_action && dpa_permission_can_user_grant()) {
        nxt_enqueue_style('achievements-admin', plugins_url('/css/admin.css', __FILE__), array(), ACHIEVEMENTS_VERSION);
    }
    if ($bp->is_single_item) {
        nxt_enqueue_style('achievements-detail', plugins_url('/css/detail.css', __FILE__), array(), ACHIEVEMENTS_VERSION);
    } else {
        nxt_enqueue_style('achievements-directory', plugins_url('/css/directory.css', __FILE__), array(), ACHIEVEMENTS_VERSION);
    }
    nxt_print_styles();
}
Ejemplo n.º 2
0
/**
 * Handle the loading of the Activate screen.
 *
 * @todo Move the actual activation process into an action in bp-members-actions.php
 */
function bp_core_screen_activation()
{
    // Bail if not viewing the activation page
    if (!bp_is_current_component('activate')) {
        return false;
    }
    // If the user is already logged in, redirect away from here
    if (is_user_logged_in()) {
        // If activation page is also front page, set to members directory to
        // avoid an infinite loop. Otherwise, set to root domain.
        $redirect_to = bp_is_component_front_page('activate') ? bp_get_root_domain() . '/' . bp_get_members_root_slug() : bp_get_root_domain();
        // Trailing slash it, as we expect these URL's to be
        $redirect_to = trailingslashit($redirect_to);
        /**
         * Filters the URL to redirect logged in users to when visiting activation page.
         *
         * @since BuddyPress (1.9.0)
         *
         * @param string $redirect_to URL to redirect user to.
         */
        $redirect_to = apply_filters('bp_loggedin_activate_page_redirect_to', $redirect_to);
        // Redirect away from the activation page
        bp_core_redirect($redirect_to);
    }
    // grab the key (the old way)
    $key = isset($_GET['key']) ? $_GET['key'] : '';
    // grab the key (the new way)
    if (empty($key)) {
        $key = bp_current_action();
    }
    // Get BuddyPress
    $bp = buddypress();
    // we've got a key; let's attempt to activate the signup
    if (!empty($key)) {
        /**
         * Filters the activation signup.
         *
         * @since BuddyPress (1.1.0)
         *
         * @param bool|int $value Value returned by activation.
         *                        Integer on success, boolean on failure.
         */
        $user = apply_filters('bp_core_activate_account', bp_core_activate_signup($key));
        // If there were errors, add a message and redirect
        if (!empty($user->errors)) {
            bp_core_add_message($user->get_error_message(), 'error');
            bp_core_redirect(trailingslashit(bp_get_root_domain() . '/' . $bp->pages->activate->slug));
        }
        $hashed_key = wp_hash($key);
        // Check if the signup avatar folder exists. If it does, move the folder to
        // the BP user avatars directory
        if (file_exists(bp_core_avatar_upload_path() . '/avatars/signups/' . $hashed_key)) {
            @rename(bp_core_avatar_upload_path() . '/avatars/signups/' . $hashed_key, bp_core_avatar_upload_path() . '/avatars/' . $user);
        }
        bp_core_add_message(__('Your account is now active!', 'buddypress'));
        $bp->activation_complete = true;
    }
    /**
     * Filters the template to load for the Member activation page screen.
     *
     * @since BuddyPress (1.1.1)
     *
     * @param string $value Path to the Member activation template to load.
     */
    bp_core_load_template(apply_filters('bp_core_template_activate', array('activate', 'registration/activate')));
}
Ejemplo n.º 3
0
/**
 * Is the front page of the site set to the Activity component?
 *
 * @deprecated 1.5
 * @deprecated Use bp_is_component_front_page( 'activity' )
 * @return bool
 */
function bp_is_activity_front_page()
{
    _deprecated_function(__FUNCTION__, '1.5', "bp_is_component_front_page( 'activity' )");
    return bp_is_component_front_page('activity');
}
Ejemplo n.º 4
0
 function tk_get_bp_page_type($page_type)
 {
     global $bp;
     if (is_page() && $this->tk_is_buddypress() && $bp->current_component != '') {
         $slug = $bp->current_component;
         $action = $bp->current_action;
         if (isset($bp) && property_exists($bp, 'displayed_user') && property_exists($bp->displayed_user, 'id') && $bp->displayed_user->id != 0 && $slug == 'activity' && $action == 'just-me') {
             $slug = 'profile';
         }
         $component = $this->tk_get_bp_component_by_slug($slug);
         if ($component != '') {
             if ($action != '') {
                 if (bp_is_group_forum_topic()) {
                     $page_type = 'bp-component-' . $component . '-' . $action . '-topic';
                 } elseif (!bp_is_component_front_page('activity') && bp_is_activity_component() && $action != 'just-me') {
                     $page_type = 'bp-component-activity-activity';
                 } else {
                     $page_type = 'bp-component-' . $component . '-' . $action;
                 }
             } else {
                 $page_type = 'bp-component-' . $component;
             }
         }
     }
     return apply_filters('tk_get_bp_page_type', $page_type);
 }
Ejemplo n.º 5
0
function bp_core_screen_signup()
{
    global $bp, $wpdb;
    if (!bp_is_current_component('register')) {
        return;
    }
    // Not a directory
    bp_update_is_directory(false, 'register');
    // If the user is logged in, redirect away from here
    if (is_user_logged_in()) {
        if (bp_is_component_front_page('register')) {
            $redirect_to = bp_get_root_domain() . '/' . bp_get_members_root_slug();
        } else {
            $redirect_to = bp_get_root_domain();
        }
        bp_core_redirect(apply_filters('bp_loggedin_register_page_redirect_to', $redirect_to));
        return;
    }
    $bp->signup->step = 'request-details';
    if (!bp_get_signup_allowed()) {
        $bp->signup->step = 'registration-disabled';
    } elseif (isset($_POST['signup_submit'])) {
        // Check the nonce
        check_admin_referer('bp_new_signup');
        // Check the base account details for problems
        $account_details = bp_core_validate_user_signup($_POST['signup_username'], $_POST['signup_email']);
        // If there are errors with account details, set them for display
        if (!empty($account_details['errors']->errors['user_name'])) {
            $bp->signup->errors['signup_username'] = $account_details['errors']->errors['user_name'][0];
        }
        if (!empty($account_details['errors']->errors['user_email'])) {
            $bp->signup->errors['signup_email'] = $account_details['errors']->errors['user_email'][0];
        }
        // Check that both password fields are filled in
        if (empty($_POST['signup_password']) || empty($_POST['signup_password_confirm'])) {
            $bp->signup->errors['signup_password'] = __('Please make sure you enter your password twice', 'buddypress');
        }
        // Check that the passwords match
        if (!empty($_POST['signup_password']) && !empty($_POST['signup_password_confirm']) && $_POST['signup_password'] != $_POST['signup_password_confirm']) {
            $bp->signup->errors['signup_password'] = __('The passwords you entered do not match.', 'buddypress');
        }
        $bp->signup->username = $_POST['signup_username'];
        $bp->signup->email = $_POST['signup_email'];
        // Now we've checked account details, we can check profile information
        if (bp_is_active('xprofile')) {
            // Make sure hidden field is passed and populated
            if (isset($_POST['signup_profile_field_ids']) && !empty($_POST['signup_profile_field_ids'])) {
                // Let's compact any profile field info into an array
                $profile_field_ids = explode(',', $_POST['signup_profile_field_ids']);
                // Loop through the posted fields formatting any datebox values then validate the field
                foreach ((array) $profile_field_ids as $field_id) {
                    if (!isset($_POST['field_' . $field_id])) {
                        if (!empty($_POST['field_' . $field_id . '_day']) && !empty($_POST['field_' . $field_id . '_month']) && !empty($_POST['field_' . $field_id . '_year'])) {
                            $_POST['field_' . $field_id] = date('Y-m-d H:i:s', strtotime($_POST['field_' . $field_id . '_day'] . $_POST['field_' . $field_id . '_month'] . $_POST['field_' . $field_id . '_year']));
                        }
                    }
                    // Create errors for required fields without values
                    if (xprofile_check_is_required_field($field_id) && empty($_POST['field_' . $field_id])) {
                        $bp->signup->errors['field_' . $field_id] = __('This is a required field', 'buddypress');
                    }
                }
                // This situation doesn't naturally occur so bounce to website root
            } else {
                bp_core_redirect(bp_get_root_domain());
            }
        }
        // Finally, let's check the blog details, if the user wants a blog and blog creation is enabled
        if (isset($_POST['signup_with_blog'])) {
            $active_signup = $bp->site_options['registration'];
            if ('blog' == $active_signup || 'all' == $active_signup) {
                $blog_details = bp_core_validate_blog_signup($_POST['signup_blog_url'], $_POST['signup_blog_title']);
                // If there are errors with blog details, set them for display
                if (!empty($blog_details['errors']->errors['blogname'])) {
                    $bp->signup->errors['signup_blog_url'] = $blog_details['errors']->errors['blogname'][0];
                }
                if (!empty($blog_details['errors']->errors['blog_title'])) {
                    $bp->signup->errors['signup_blog_title'] = $blog_details['errors']->errors['blog_title'][0];
                }
            }
        }
        do_action('bp_signup_validate');
        // Add any errors to the action for the field in the template for display.
        if (!empty($bp->signup->errors)) {
            foreach ((array) $bp->signup->errors as $fieldname => $error_message) {
                add_action('bp_' . $fieldname . '_errors', create_function('', 'echo apply_filters(\'bp_members_signup_error_message\', "<div class=\\"error\\">' . $error_message . '</div>" );'));
            }
        } else {
            $bp->signup->step = 'save-details';
            // No errors! Let's register those deets.
            $active_signup = !empty($bp->site_options['registration']) ? $bp->site_options['registration'] : '';
            if ('none' != $active_signup) {
                // Let's compact any profile field info into usermeta
                $profile_field_ids = explode(',', $_POST['signup_profile_field_ids']);
                // Loop through the posted fields formatting any datebox values then add to usermeta
                foreach ((array) $profile_field_ids as $field_id) {
                    if (!isset($_POST['field_' . $field_id])) {
                        if (isset($_POST['field_' . $field_id . '_day'])) {
                            $_POST['field_' . $field_id] = date('Y-m-d H:i:s', strtotime($_POST['field_' . $field_id . '_day'] . $_POST['field_' . $field_id . '_month'] . $_POST['field_' . $field_id . '_year']));
                        }
                    }
                    if (!empty($_POST['field_' . $field_id])) {
                        $usermeta['field_' . $field_id] = $_POST['field_' . $field_id];
                    }
                }
                // Store the profile field ID's in usermeta
                $usermeta['profile_field_ids'] = $_POST['signup_profile_field_ids'];
                // Hash and store the password
                $usermeta['password'] = wp_hash_password($_POST['signup_password']);
                // If the user decided to create a blog, save those details to usermeta
                if ('blog' == $active_signup || 'all' == $active_signup) {
                    $usermeta['public'] = isset($_POST['signup_blog_privacy']) && 'public' == $_POST['signup_blog_privacy'] ? true : false;
                }
                $usermeta = apply_filters('bp_signup_usermeta', $usermeta);
                // Finally, sign up the user and/or blog
                if (isset($_POST['signup_with_blog']) && is_multisite()) {
                    bp_core_signup_blog($blog_details['domain'], $blog_details['path'], $blog_details['blog_title'], $_POST['signup_username'], $_POST['signup_email'], $usermeta);
                } else {
                    bp_core_signup_user($_POST['signup_username'], $_POST['signup_password'], $_POST['signup_email'], $usermeta);
                }
                $bp->signup->step = 'completed-confirmation';
            }
            do_action('bp_complete_signup');
        }
    }
    do_action('bp_core_screen_signup');
    bp_core_load_template(apply_filters('bp_core_template_register', 'registration/register'));
}
Ejemplo n.º 6
0
 /**
  *
  */
 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;
 }
Ejemplo n.º 7
0
/**
 * Handle the loading of the Activate screen.
 */
function bp_core_screen_activation()
{
    global $bp;
    if (!bp_is_current_component('activate')) {
        return false;
    }
    // If the user is logged in, redirect away from here
    if (is_user_logged_in()) {
        if (bp_is_component_front_page('activate')) {
            $redirect_to = trailingslashit(bp_get_root_domain() . '/' . bp_get_members_root_slug());
        } else {
            $redirect_to = trailingslashit(bp_get_root_domain());
        }
        bp_core_redirect(apply_filters('bp_loggedin_activate_page_redirect_to', $redirect_to));
        return;
    }
    // Check if an activation key has been passed
    if (isset($_GET['key'])) {
        // Activate the signup
        $user = apply_filters('bp_core_activate_account', bp_core_activate_signup($_GET['key']));
        // If there were errors, add a message and redirect
        if (!empty($user->errors)) {
            bp_core_add_message($user->get_error_message(), 'error');
            bp_core_redirect(trailingslashit(bp_get_root_domain() . '/' . $bp->pages->activate->slug));
        }
        $hashed_key = wp_hash($_GET['key']);
        // Check if the avatar folder exists. If it does, move rename it, move
        // it and delete the signup avatar dir
        if (file_exists(bp_core_avatar_upload_path() . '/avatars/signups/' . $hashed_key)) {
            @rename(bp_core_avatar_upload_path() . '/avatars/signups/' . $hashed_key, bp_core_avatar_upload_path() . '/avatars/' . $user);
        }
        bp_core_add_message(__('Your account is now active!', 'buddypress'));
        $bp->activation_complete = true;
    }
    bp_core_load_template(apply_filters('bp_core_template_activate', array('activate', 'registration/activate')));
}
Ejemplo n.º 8
0
 /**
  * header: add the top slider to the homepage, all pages, or just on specific pages
  *
  * !!! this function needs to be rewritten !!!
  *
  * located: header.php do_action( 'bp_after_header' )
  *
  * @package Custom Community
  * @since 1.8.3
  */
 function slideshow_home()
 {
     global $cap;
     $cc_page_options = cc_get_page_meta();
     if (defined('BP_VERSION')) {
         if ($cap->enable_slideshow_home == 'all' || $cap->enable_slideshow_home == __('all', 'cc') || ($cap->enable_slideshow_home == 'home' || $cap->enable_slideshow_home == __('home', 'cc')) && is_front_page() || ($cap->enable_slideshow_home == 'home' || $cap->enable_slideshow_home == __('home', 'cc')) && bp_is_component_front_page('activity') || is_page() && isset($cc_page_options) && isset($cc_page_options['cc_page_slider_on']) && $cc_page_options['cc_page_slider_on'] == 1) {
             echo cc_slidertop();
             // located under wp/templatetags
         }
     } elseif ($cap->enable_slideshow_home == 'all' || $cap->enable_slideshow_home == __('all', 'cc') || ($cap->enable_slideshow_home == 'home' || $cap->enable_slideshow_home == __('home', 'cc')) && is_front_page() || is_page() && isset($cc_page_options) && $cc_page_options['cc_page_slider_on'] == 1) {
         echo cc_slidertop();
         // located under wp/templatetags
     }
 }