Esempio n. 1
0
/**
 * Add the "My Account" menu and all submenus.
 *
 * @since BuddyPress (r4151)
 */
function bp_members_admin_bar_my_account_menu()
{
    global $bp, $wp_admin_bar;
    // Bail if this is an ajax request
    if (defined('DOING_AJAX')) {
        return;
    }
    // Logged in user
    if (is_user_logged_in()) {
        // User avatar
        $avatar = bp_core_fetch_avatar(array('item_id' => $bp->loggedin_user->id, 'email' => $bp->loggedin_user->userdata->user_email, 'width' => 16, 'height' => 16));
        // Unique ID for the 'My Account' menu
        $bp->my_account_menu_id = !empty($avatar) ? 'my-account-with-avatar' : 'my-account';
        // Create the main 'My Account' menu
        $wp_admin_bar->add_menu(array('id' => $bp->my_account_menu_id, 'title' => $avatar . bp_get_loggedin_user_fullname(), 'href' => $bp->loggedin_user->domain));
        // Show login and sign-up links
    } elseif (!empty($wp_admin_bar)) {
        add_filter('show_admin_bar', '__return_true');
        // Create the main 'My Account' menu
        $wp_admin_bar->add_menu(array('id' => 'bp-login', 'title' => __('Log in', 'buddypress'), 'href' => wp_login_url()));
        // Sign up
        if (bp_get_signup_allowed()) {
            $wp_admin_bar->add_menu(array('id' => 'bp-register', 'title' => __('Register', 'buddypress'), 'href' => bp_get_signup_page()));
        }
    }
}
/**
 * Add the "My Account" menu and all submenus.
 *
 * @since 1.6.0
 *
 * @todo Deprecate WP 3.2 Toolbar compatibility when we drop 3.2 support
 */
function bp_members_admin_bar_my_account_menu()
{
    global $wp_admin_bar;
    // Bail if this is an ajax request
    if (defined('DOING_AJAX')) {
        return;
    }
    // Logged in user
    if (is_user_logged_in()) {
        $bp = buddypress();
        // Stored in the global so we can add menus easily later on
        $bp->my_account_menu_id = 'my-account-buddypress';
        // Create the main 'My Account' menu
        $wp_admin_bar->add_menu(array('id' => $bp->my_account_menu_id, 'group' => true, 'title' => __('Edit My Profile', 'buddypress'), 'href' => bp_loggedin_user_domain(), 'meta' => array('class' => 'ab-sub-secondary')));
        // Show login and sign-up links
    } elseif (!empty($wp_admin_bar)) {
        add_filter('show_admin_bar', '__return_true');
        // Create the main 'My Account' menu
        $wp_admin_bar->add_menu(array('id' => 'bp-login', 'title' => __('Log in', 'buddypress'), 'href' => wp_login_url(bp_get_requested_url())));
        // Sign up
        if (bp_get_signup_allowed()) {
            $wp_admin_bar->add_menu(array('id' => 'bp-register', 'title' => __('Register', 'buddypress'), 'href' => bp_get_signup_page()));
        }
    }
}
Esempio n. 3
0
function bp_adminbar_login_menu() {
	global $bp;

	if ( is_user_logged_in() )
		return false;

	echo '<li class="bp-login no-arrow"><a href="' . $bp->root_domain . '/wp-login.php?redirect_to=' . urlencode( $bp->root_domain ) . '">' . __( 'Log In', 'buddypress' ) . '</a></li>';

	// Show "Sign Up" link if user registrations are allowed
	if ( bp_get_signup_allowed() )
		echo '<li class="bp-signup no-arrow"><a href="' . bp_get_signup_page(false) . '">' . __( 'Sign Up', 'buddypress' ) . '</a></li>';
}
/**
 * Add the "My Account" menu and all submenus.
 *
 * @since BuddyPress (r4151)
 * @todo Deprecate WP 3.2 admin bar compatibility when we drop 3.2 support
 */
function bp_members_admin_bar_my_account_menu()
{
    global $bp, $wp_admin_bar, $wp_version;
    // Bail if this is an ajax request
    if (defined('DOING_AJAX')) {
        return;
    }
    // Logged in user
    if (is_user_logged_in()) {
        // User avatar
        $avatar = bp_core_fetch_avatar(array('item_id' => bp_loggedin_user_id(), 'email' => $bp->loggedin_user->userdata->user_email, 'width' => 16, 'height' => 16));
        // Some admin bar setup in WP 3.2 differs from WP 3.3+.
        // Backward-compatibility will be deprecated at some point.
        if (version_compare((double) $wp_version, '3.3', '>=')) {
            // Stored in the global so we can add menus easily later on
            $bp->my_account_menu_id = 'my-account-buddypress';
            $title = bp_get_loggedin_user_fullname() . $avatar;
            $class = 'opposite';
            if (!empty($avatar)) {
                $class .= ' with-avatar';
            }
            $meta = array('class' => $class);
        } else {
            $bp->my_account_menu_id = !empty($avatar) ? 'my-account-with-avatar' : 'my-account';
            $title = $avatar . bp_get_loggedin_user_fullname();
            $meta = array();
        }
        // Create the main 'My Account' menu
        $wp_admin_bar->add_menu(array('id' => $bp->my_account_menu_id, 'title' => $title, 'href' => $bp->loggedin_user->domain, 'meta' => $meta));
        // Show login and sign-up links
    } elseif (!empty($wp_admin_bar)) {
        add_filter('show_admin_bar', '__return_true');
        // Create the main 'My Account' menu
        $wp_admin_bar->add_menu(array('id' => 'bp-login', 'title' => __('Log in', 'buddypress'), 'href' => wp_login_url()));
        // Sign up
        if (bp_get_signup_allowed()) {
            $wp_admin_bar->add_menu(array('id' => 'bp-register', 'title' => __('Register', 'buddypress'), 'href' => bp_get_signup_page()));
        }
    }
}
 function widget($args, $instance)
 {
     extract($args, EXTR_SKIP);
     echo $before_widget;
     // set widget title when logged out
     if (!is_user_logged_in()) {
         $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
         if (!empty($title)) {
             echo $before_title . $title . $after_title;
         }
     }
     // start widget display code
     if (function_exists('bp_is_active')) {
         // check is user is logged in
         if (is_user_logged_in()) {
             echo "<div id='sidebarme'>";
             echo "<a href='" . bp_loggedin_user_domain() . "'>";
             echo bp_loggedin_user_avatar('type=thumb');
             echo "</a>";
             echo "<ul class='sidebarme-quicklinks'>";
             echo "<li class='sidebarme-username'>" . bp_core_get_userlink(bp_loggedin_user_id()) . "</li>";
             echo "<li class='sidebarme-profile'>";
             echo "<a href='" . bp_loggedin_user_domain() . "profile/edit'>" . __('Edit Profile', 'boss') . "</a>";
             echo " &middot; ";
             echo wp_loginout();
             echo "</li>";
             echo "</ul>";
             echo "</div>";
             // check if user is logged out
         } else {
             echo "<form name='login-form' id='sidebar-login-form' class='standard-form' action='" . site_url('wp-login.php', 'login_post') . "' method='post'>";
             echo "<label>" . __('Username', 'boss') . "</label>";
             $return = isset($_POST['value']) ? $_POST['value'] : '';
             $return .= "<input type='text' name='log' id='sidebar-user-login' class='input' value='";
             if (isset($user_login)) {
                 $return .= esc_attr(stripslashes($user_login));
             }
             $return .= "' tabindex='97' />";
             echo $return;
             echo "<label>" . __('Password', 'boss') . "</label>";
             echo "<input type='password' name='pwd' id='sidebar-user-pass' class='input' value='' tabindex='98' />";
             echo "<p class='forgetmenot'><input name='rememberme' type='checkbox' id='sidebar-rememberme' value='forever' tabindex='99' /> " . __('Remember Me', 'boss') . "</p>";
             echo do_action('bp_sidebar_login_form');
             echo "<input type='submit' name='wp-submit' id='sidebar-wp-submit' value='" . __('Log In', 'boss') . "' tabindex='100' />";
             if (bp_get_signup_allowed()) {
                 echo " <a class='sidebar-wp-register' href='" . bp_get_signup_page() . "'>" . __('Register', 'boss') . "</a>";
             }
             echo "</form>";
         }
     }
     // end widget display code
     echo $after_widget;
 }
Esempio n. 6
0
    ?>

	<?php 
} else {
    ?>

		<?php 
    do_action('bp_before_sidebar_login_form');
    ?>

		<p id="login-text">
			<?php 
    _e('To start connecting please log in first.', 'buddypress');
    ?>
			<?php 
    if (bp_get_signup_allowed()) {
        ?>
				<?php 
        printf(__(' You can also <a href="%s" title="Create an account">create an account</a>.', 'buddypress'), site_url(BP_REGISTER_SLUG . '/'));
        ?>
			<?php 
    }
    ?>
		</p>

		<form name="login-form" id="sidebar-login-form" class="standard-form" action="<?php 
    echo site_url('wp-login.php', 'login_post');
    ?>
" method="post">
			<label><?php 
    _e('Username', 'buddypress');
/**
 * Creates necessary directory pages.
 *
 * Directory pages are those WordPress pages used by BP components to display
 * content (eg, the 'groups' page created by BP).
 *
 * @since BuddyPress (1.7.0)
 *
 * @param array $components Components to create pages for.
 * @param string $existing 'delete' if you want to delete existing page
 *        mappings and replace with new ones. Otherwise existing page mappings
 *        are kept, and the gaps filled in with new pages. Default: 'keep'.
 */
function bp_core_add_page_mappings($components, $existing = 'keep')
{
    // If no value is passed, there's nothing to do.
    if (empty($components)) {
        return;
    }
    // Make sure that the pages are created on the root blog no matter which
    // dashboard the setup is being run on.
    if (!bp_is_root_blog()) {
        switch_to_blog(bp_get_root_blog_id());
    }
    $pages = bp_core_get_directory_page_ids('all');
    // Delete any existing pages
    if ('delete' === $existing) {
        foreach ((array) $pages as $page_id) {
            wp_delete_post($page_id, true);
        }
        $pages = array();
    }
    $page_titles = array('activity' => _x('Activity', 'Page title for the Activity directory.', 'buddypress'), 'groups' => _x('Groups', 'Page title for the Groups directory.', 'buddypress'), 'sites' => _x('Sites', 'Page title for the Sites directory.', 'buddypress'), 'members' => _x('Members', 'Page title for the Members directory.', 'buddypress'), 'activate' => _x('Activate', 'Page title for the user activation screen.', 'buddypress'), 'register' => _x('Register', 'Page title for the user registration screen.', 'buddypress'));
    $pages_to_create = array();
    foreach (array_keys($components) as $component_name) {
        if (!isset($pages[$component_name]) && isset($page_titles[$component_name])) {
            $pages_to_create[$component_name] = $page_titles[$component_name];
        }
    }
    // Register and Activate are not components, but need pages when
    // registration is enabled
    if (bp_get_signup_allowed()) {
        foreach (array('register', 'activate') as $slug) {
            if (!isset($pages[$slug])) {
                $pages_to_create[$slug] = $page_titles[$slug];
            }
        }
    }
    // No need for a Sites directory unless we're on multisite
    if (!is_multisite() && isset($pages_to_create['sites'])) {
        unset($pages_to_create['sites']);
    }
    // Members must always have a page, no matter what
    if (!isset($pages['members']) && !isset($pages_to_create['members'])) {
        $pages_to_create['members'] = $page_titles['members'];
    }
    // Create the pages
    foreach ($pages_to_create as $component_name => $page_name) {
        $exists = get_page_by_path($component_name);
        // If page already exists, use it
        if (!empty($exists)) {
            $pages[$component_name] = $exists->ID;
        } else {
            $pages[$component_name] = wp_insert_post(array('comment_status' => 'closed', 'ping_status' => 'closed', 'post_status' => 'publish', 'post_title' => $page_name, 'post_type' => 'page'));
        }
    }
    // Save the page mapping
    bp_update_option('bp-pages', $pages);
    // If we had to switch_to_blog, go back to the original site.
    if (!bp_is_root_blog()) {
        restore_current_blog();
    }
}
	/**
	 * The text shown when no items are found.
	 *
	 * Nice job, clean sheet!
	 *
	 * @since BuddyPress (2.0.0)
	 */
	public function no_items() {
		if ( bp_get_signup_allowed() ) {
			esc_html_e( 'No pending accounts found.', 'buddypress' );
		} else {
			$link = false;

			if ( current_user_can( 'manage_network_users' ) ) {
				$link = sprintf( '<a href="%1$s">%2$s</a>', esc_url( network_admin_url( 'settings.php' ) ), esc_html__( 'Edit settings', 'buddypress' ) );
			}

			printf( __( 'Registration is disabled. %s', 'buddypress' ), $link );
		}
	}
Esempio n. 9
0
                          <?php 
    _e('<strong>Reset password!</strong> A message will be sent to your email address.', 'cactusthemes');
    ?>
                        </div>
                      <?php 
}
?>
                    <?php 
$largs = array('echo' => true, 'redirect' => ot_get_option('login_redirect') ? get_permalink(ot_get_option('login_redirect')) : site_url(), 'form_id' => 'loginform', 'label_username' => __('Username', 'cactusthemes'), 'label_password' => __('Password', 'cactusthemes'), 'label_remember' => __('Remember Me', 'cactusthemes'), 'label_log_in' => __('Log In', 'cactusthemes'), 'id_username' => 'user_login', 'id_password' => 'user_pass', 'id_remember' => 'rememberme', 'id_submit' => 'wp-submit', 'remember' => true, 'value_username' => NULL, 'value_remember' => false);
?>
                    <div class="row"><div class="col-md-8">
                    <?php 
wp_login_form($largs);
?>
						<?php 
if (function_exists('bp_get_signup_allowed') && bp_get_signup_allowed()) {
    ?>
                            <?php 
    printf(__('<a href="%s" title="Register for a new account">Register</a>', 'buddypress'), bp_get_signup_page());
    ?>
                        <?php 
}
?>
                    </div></div>
                    <div class="clear"></div>
					<?php 
//content
if (have_posts()) {
    while (have_posts()) {
        the_post();
        get_template_part('content', 'single');
Esempio n. 10
0
    /**
     * Display the login widget.
     *
     * @see WP_Widget::widget() for description of parameters.
     *
     * @param array $args Widget arguments.
     * @param array $instance Widget settings, as saved by the user.
     */
    public function widget($args, $instance)
    {
        $title = isset($instance['title']) ? $instance['title'] : '';
        $title = apply_filters('widget_title', $title);
        echo $args['before_widget'];
        echo $args['before_title'] . esc_html($title) . $args['after_title'];
        ?>

		<?php 
        if (is_user_logged_in()) {
            ?>

			<?php 
            do_action('bp_before_login_widget_loggedin');
            ?>

			<div class="bp-login-widget-user-avatar">
				<a href="<?php 
            echo bp_loggedin_user_domain();
            ?>
">
					<?php 
            bp_loggedin_user_avatar('type=thumb&width=50&height=50');
            ?>
				</a>
			</div>

			<div class="bp-login-widget-user-links">
				<div class="bp-login-widget-user-link"><?php 
            echo bp_core_get_userlink(bp_loggedin_user_id());
            ?>
</div>
				<div class="bp-login-widget-user-logout"><a class="logout" href="<?php 
            echo wp_logout_url(bp_get_requested_url());
            ?>
"><?php 
            _e('Log Out', 'buddypress');
            ?>
</a></div>
			</div>

			<?php 
            do_action('bp_after_login_widget_loggedin');
            ?>

		<?php 
        } else {
            ?>

			<?php 
            do_action('bp_before_login_widget_loggedout');
            ?>

			<form name="bp-login-form" id="bp-login-widget-form" class="standard-form" action="<?php 
            echo esc_url(site_url('wp-login.php', 'login_post'));
            ?>
" method="post">
				<label for="bp-login-widget-user-login"><?php 
            _e('Username', 'buddypress');
            ?>
</label>
				<input type="text" name="log" id="bp-login-widget-user-login" class="input" value="" />

				<label for="bp-login-widget-user-pass"><?php 
            _e('Password', 'buddypress');
            ?>
</label>
				<input type="password" name="pwd" id="bp-login-widget-user-pass" class="input" value=""  />

				<div class="forgetmenot"><label><input name="rememberme" type="checkbox" id="bp-login-widget-rememberme" value="forever" /> <?php 
            _e('Remember Me', 'buddypress');
            ?>
</label></div>

				<input type="submit" name="wp-submit" id="bp-login-widget-submit" value="<?php 
            esc_attr_e('Log In', 'buddypress');
            ?>
" />

				<?php 
            if (bp_get_signup_allowed()) {
                ?>

					<span class="bp-login-widget-register-link"><?php 
                printf(__('<a href="%s" title="Register for a new account">Register</a>', 'buddypress'), bp_get_signup_page());
                ?>
</span>

				<?php 
            }
            ?>

			</form>

			<?php 
            do_action('bp_after_login_widget_loggedout');
            ?>

		<?php 
        }
        echo $args['after_widget'];
    }
/**
 * Creates reusable markup for page setup on the Components and Pages dashboard panel.
 *
 * @package BuddyPress
 * @since 1.6.0
 * @todo Use settings API
 */
function bp_core_admin_slugs_options()
{
    $bp = buddypress();
    // Get the existing WP pages
    $existing_pages = bp_core_get_directory_page_ids();
    // Set up an array of components (along with component names) that have directory pages.
    $directory_pages = bp_core_admin_get_directory_pages();
    if (!empty($directory_pages)) {
        ?>

		<h3><?php 
        _e('Directories', 'buddypress');
        ?>
</h3>

		<p><?php 
        _e('Associate a WordPress Page with each BuddyPress component directory.', 'buddypress');
        ?>
</p>

		<table class="form-table">
			<tbody>

				<?php 
        foreach ($directory_pages as $name => $label) {
            ?>

					<tr valign="top">
						<th scope="row">
							<label for="bp_pages[<?php 
            echo esc_attr($name);
            ?>
]"><?php 
            echo esc_html($label);
            ?>
</label>
						</th>

						<td>

							<?php 
            if (!bp_is_root_blog()) {
                switch_to_blog(bp_get_root_blog_id());
            }
            ?>

							<?php 
            echo wp_dropdown_pages(array('name' => 'bp_pages[' . esc_attr($name) . ']', 'echo' => false, 'show_option_none' => __('- None -', 'buddypress'), 'selected' => !empty($existing_pages[$name]) ? $existing_pages[$name] : false));
            ?>

							<?php 
            if (!empty($existing_pages[$name])) {
                ?>

								<a href="<?php 
                echo get_permalink($existing_pages[$name]);
                ?>
" class="button-secondary" target="_bp"><?php 
                _e('View', 'buddypress');
                ?>
</a>

							<?php 
            }
            ?>

							<?php 
            if (!bp_is_root_blog()) {
                restore_current_blog();
            }
            ?>

						</td>
					</tr>


				<?php 
        }
        ?>

				<?php 
        /**
         * Fires after the display of default directories.
         *
         * Allows plugins to add their own directory associations.
         *
         * @since 1.5.0
         */
        do_action('bp_active_external_directories');
        ?>

			</tbody>
		</table>

	<?php 
    }
    /** Static Display ********************************************************/
    $static_pages = bp_core_admin_get_static_pages();
    if (!empty($static_pages)) {
        ?>

		<h3><?php 
        _e('Registration', 'buddypress');
        ?>
</h3>

		<?php 
        if (bp_get_signup_allowed()) {
            ?>
			<p><?php 
            _e('Associate WordPress Pages with the following BuddyPress Registration pages.', 'buddypress');
            ?>
</p>
		<?php 
        } else {
            ?>
			<?php 
            if (is_multisite()) {
                ?>
				<p><?php 
                printf(__('Registration is currently disabled.  Before associating a page is allowed, please enable registration by selecting either the "User accounts may be registered" or "Both sites and user accounts can be registered" option on <a href="%s">this page</a>.', 'buddypress'), network_admin_url('settings.php'));
                ?>
</p>
			<?php 
            } else {
                ?>
				<p><?php 
                printf(__('Registration is currently disabled.  Before associating a page is allowed, please enable registration by clicking on the "Anyone can register" checkbox on <a href="%s">this page</a>.', 'buddypress'), admin_url('options-general.php'));
                ?>
</p>
			<?php 
            }
            ?>
		<?php 
        }
        ?>

		<table class="form-table">
			<tbody>

				<?php 
        if (bp_get_signup_allowed()) {
            foreach ($static_pages as $name => $label) {
                ?>

					<tr valign="top">
						<th scope="row">
							<label for="bp_pages[<?php 
                echo esc_attr($name);
                ?>
]"><?php 
                echo esc_html($label);
                ?>
</label>
						</th>

						<td>

							<?php 
                if (!bp_is_root_blog()) {
                    switch_to_blog(bp_get_root_blog_id());
                }
                ?>

							<?php 
                echo wp_dropdown_pages(array('name' => 'bp_pages[' . esc_attr($name) . ']', 'echo' => false, 'show_option_none' => __('- None -', 'buddypress'), 'selected' => !empty($existing_pages[$name]) ? $existing_pages[$name] : false));
                ?>

							<?php 
                if (!empty($existing_pages[$name])) {
                    ?>

								<a href="<?php 
                    echo get_permalink($existing_pages[$name]);
                    ?>
" class="button-secondary" target="_bp"><?php 
                    _e('View', 'buddypress');
                    ?>
</a>

							<?php 
                }
                ?>

							<?php 
                if (!bp_is_root_blog()) {
                    restore_current_blog();
                }
                ?>

						</td>
					</tr>

				<?php 
            }
        }
        ?>

				<?php 
        /**
         * Fires after the display of default static pages for BuddyPress setup.
         *
         * @since 1.5.0
         */
        do_action('bp_active_external_pages');
        ?>

			</tbody>
		</table>

		<?php 
    }
}
Esempio n. 12
0
    function metabox_registration()
    {
        if (!bp_get_signup_allowed()) {
            echo '<p>' . __('Registration is currently disabled', 'genesis-connect') . '</p>';
            foreach (array('custom_register', 'register_slug', 'register_title', 'register_time') as $field) {
                echo '<input type="hidden" name="' . $this->theme->settings_key . '[' . $field . ']" value="' . $this->get_option($field) . '" />';
            }
            return;
        }
        $custom_register = $this->get_option('custom_register');
        ?>
			<p><?php 
        _e('Custom Registration Permalink:', 'genesis-connect');
        ?>
			<select name="<?php 
        echo $this->theme->settings_key;
        ?>
[custom_register]">
				<option style="padding-right:10px;" value="none" <?php 
        selected('none', $custom_register);
        ?>
><?php 
        _e('None', 'genesis-connect');
        ?>
</option>
				<option style="padding-right:10px;" value="before_pages" <?php 
        selected('before_pages', $custom_register);
        ?>
><?php 
        _e('Before Pages', 'genesis-connect');
        ?>
</option>
				<option style="padding-right:10px;" value="after_pages" <?php 
        selected('after_pages', $custom_register);
        ?>
><?php 
        _e('After Pages', 'genesis-connect');
        ?>
</option>
				<option style="padding-right:10px;" value="adminbar" <?php 
        selected('adminbar', $custom_register);
        ?>
><?php 
        _e('On the Adminbar', 'genesis-connect');
        ?>
</option>
			</select></p>
			<small><strong><?php 
        _e('Using the custom registration disables the default BuddyPress registration page', 'genesis-connect');
        ?>
</strong></small></p>
			<p><?php 
        _e('Custom Permalink:', 'genesis-connect');
        ?>
<br />
			<input type="text" name="<?php 
        echo $this->theme->settings_key;
        ?>
[register_slug]" value="<?php 
        echo esc_attr($this->get_option('register_slug'));
        ?>
" size="40" /><br />
			<small><strong><?php 
        printf(__("Don't include the %s", 'genesis-connect'), get_option('siteurl'));
        ?>
</strong></small></p>

			<p><?php 
        _e("Custom Title:", 'genesis-connect');
        ?>
<br />
			<input type="text" name="<?php 
        echo $this->theme->settings_key;
        ?>
[register_title]" value="<?php 
        echo esc_attr($this->get_option('register_title'));
        ?>
" size="40" /><br />
			<small><strong><?php 
        _e("The title for the link", 'genesis-connect');
        ?>
</strong></small></p>

			<p><?php 
        _e("Registration Time:", 'genesis-connect');
        ?>
<br />
			<input type="text" name="<?php 
        echo $this->theme->settings_key;
        ?>
[register_time]" value="<?php 
        echo esc_attr($this->get_option('register_time'));
        ?>
" size="5" /><br />
			<small><strong><?php 
        _e("Minimum number of seconds for a human signup", 'genesis-connect');
        ?>
</strong></small></p>
<?php 
    }
Esempio n. 13
0
 function wp_list_pages($menu)
 {
     if ($this->theme->is_home() && bp_get_signup_allowed() && !empty($this->visitor)) {
         if ('before_pages' == $this->visitor->get_register()) {
             $menu = rabp_genesis_get_bp_signup() . $menu;
         } elseif ('after_pages' == $this->visitor->get_register()) {
             $menu .= rabp_genesis_get_bp_signup();
         }
     }
     return $menu;
 }
Esempio n. 14
0
function bp_core_screen_signup() {
	global $bp, $wpdb;

	if ( $bp->current_component != BP_REGISTER_SLUG )
		return false;

	/* If the user is logged in, redirect away from here */
	if ( is_user_logged_in() )
		bp_core_redirect( $bp->root_domain );

	/* If signups are disabled, just re-direct */
	if ( !bp_get_signup_allowed() )
		bp_core_redirect( $bp->root_domain );

	$bp->signup->step = 'request-details';

	/* If the signup page is submitted, validate and save */
	if ( isset( $_POST['signup_submit'] ) ) {

		/* Check the nonce */
		check_admin_referer( 'bp_new_signup' );

		require_once( ABSPATH . WPINC . '/registration.php' );

		/* 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 ( function_exists( 'xprofile_check_is_required_field' ) ) {

			/* 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 ( isset( $_POST['field_' . $field_id . '_day'] ) )
							$_POST['field_' . $field_id] = 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->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 "<div class=\"error\">' . $error_message . '</div>";' ) );
		} else {
			$bp->signup->step = 'save-details';

			/* No errors! Let's register those deets. */
			$active_signup = $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] = 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'] = ( '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'] ) && bp_core_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' );
		}

	}

	$bp->avatar_admin->step = 'upload-image';

	/* If user has uploaded a new avatar */
	if ( !empty( $_FILES ) ) {

		/* Check the nonce */
		check_admin_referer( 'bp_avatar_upload' );

		$bp->signup->step = 'completed-confirmation';

		if ( bp_core_is_multisite() ) {
			/* Get the activation key */
			if ( !$bp->signup->key = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $_POST[ 'signup_username' ], $_POST[ 'signup_email' ] ) ) ) {
				bp_core_add_message( __( 'There was a problem uploading your avatar, please try uploading it again', 'buddypress' ) );
			} else {
				/* Hash the key to create the upload folder (added security so people don't sniff the activation key) */
				$bp->signup->avatar_dir = wp_hash( $bp->signup->key );
			}
		} else {
			$user_id = bp_core_get_userid( $_POST['signup_username'] );
			$bp->signup->avatar_dir = wp_hash( $user_id );
		}

		/* Pass the file to the avatar upload handler */
		if ( bp_core_avatar_handle_upload( $_FILES, 'bp_core_signup_avatar_upload_dir' ) ) {
			$bp->avatar_admin->step = 'crop-image';

			/* Make sure we include the jQuery jCrop file for image cropping */
			add_action( 'wp', 'bp_core_add_jquery_cropper' );
		}
	}

	/* If the image cropping is done, crop the image and save a full/thumb version */
	if ( isset( $_POST['avatar-crop-submit'] ) ) {

		/* Check the nonce */
		check_admin_referer( 'bp_avatar_cropstore' );

		/* Reset the avatar step so we can show the upload form again if needed */
		$bp->signup->step = 'completed-confirmation';
		$bp->avatar_admin->step = 'upload-image';

		if ( !bp_core_avatar_handle_crop( array( 'original_file' => $_POST['image_src'], 'crop_x' => $_POST['x'], 'crop_y' => $_POST['y'], 'crop_w' => $_POST['w'], 'crop_h' => $_POST['h'] ) ) )
			bp_core_add_message( __( 'There was a problem cropping your avatar, please try uploading it again', 'buddypress' ), 'error' );
		else
			bp_core_add_message( __( 'Your new avatar was uploaded successfully', 'buddypress' ) );
	}
	bp_core_load_template( 'registration/register' );
}
Esempio n. 15
0
			<?php do_action( 'bp_sidebar_me' ) ?>
		</div>

		<?php do_action( 'bp_after_sidebar_me' ) ?>

		<?php if ( function_exists( 'bp_message_get_notices' ) ) : ?>
			<?php bp_message_get_notices(); /* Site wide notices to all users */ ?>
		<?php endif; ?>

	<?php else : ?>

		<?php do_action( 'bp_before_sidebar_login_form' ) ?>

		<p id="login-text">
			<?php _e( 'To start connecting please log in first.', 'buddypress' ) ?>
			<?php if ( bp_get_signup_allowed() ) : ?>
				<?php printf( __( ' You can also <a href="%s" title="Create an account">create an account</a>.', 'buddypress' ), site_url( BP_REGISTER_SLUG . '/' ) ) ?>
			<?php endif; ?>
		</p>

		<form name="login-form" id="sidebar-login-form" class="standard-form" action="<?php echo site_url( 'wp-login.php', 'login_post' ) ?>" method="post">
			<label><?php _e( 'Username', 'buddypress' ) ?><br />
			<input type="text" name="log" id="sidebar-user-login" class="input" value="<?php echo esc_attr(stripslashes($user_login)); ?>" tabindex="97" /></label>

			<label><?php _e( 'Password', 'buddypress' ) ?><br />
			<input type="password" name="pwd" id="sidebar-user-pass" class="input" value="" tabindex="98" /></label>

			<p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="sidebar-rememberme" value="forever" tabindex="99" /> <?php _e( 'Remember Me', 'buddypress' ) ?></label></p>

			<?php do_action( 'bp_sidebar_login_form' ) ?>
			<input type="submit" name="wp-submit" id="sidebar-wp-submit" value="<?php _e('Log In'); ?>" tabindex="100" />
Esempio n. 16
0
 function bp_adminbar_menus()
 {
     global $bp;
     if ($this->get_option('login_adminbar')) {
         echo '<li class="bp-login no-arrow"><a href="' . site_url('wp-login.php', 'login') . '?redirect_to=' . urlencode($bp->root_domain) . '">' . __('Log In', 'buddypress') . '</a></li>';
     }
     if (bp_get_signup_allowed() && 'adminbar' == $this->register) {
         $signup = $this->signup_url();
         if (strlen($signup) > 3) {
             echo substr($signup, 0, 3) . ' class="bp-signup no-arrow"' . substr($signup, 3);
         }
     }
     remove_action('bp_adminbar_menus', 'bp_adminbar_login_menu', 2);
 }
Esempio n. 17
0
        function widget($args, $instance)
        {
            extract($args);
            echo $before_widget;
            if (is_user_logged_in()) {
                do_action('bp_before_sidebar_me');
                ?>
				<div id="sidebar-me">
					<div id="bpavatar">
						<?php 
                bp_loggedin_user_avatar('type=full');
                ?>
					</div>
					<ul>
						<li id="username"><a
								href="<?php 
                bp_loggedin_user_link();
                ?>
"><?php 
                bp_loggedin_user_fullname();
                ?>
</a></li>
						<li><a href="<?php 
                echo bp_loggedin_user_domain() . BP_XPROFILE_SLUG;
                ?>
/"
						       title="<?php 
                _e('View profile', 'vibe');
                ?>
"><?php 
                _e('View profile', 'vibe');
                ?>
</a>
						</li>
						<li id="vbplogout"><a href="<?php 
                echo wp_logout_url(get_permalink());
                ?>
"
						                      id="destroy-sessions" rel="nofollow" class="logout"
						                      title="<?php 
                _e('Log Out', 'vibe');
                ?>
"><i
									class="icon-close-off-2"></i> <?php 
                _e('LOGOUT', 'vibe');
                ?>
</a></li>
						<li id="admin_panel_icon"><?php 
                if (current_user_can("edit_posts")) {
                    echo '<a href="' . vibe_site_url() . 'wp-admin/" title="' . __('Access admin panel', 'vibe') . '"><i class="icon-settings-1"></i></a>';
                }
                ?>
						</li>
					</ul>
					<ul>
						<?php 
                $loggedin_menu = array('courses' => array('icon' => 'icon-book-open-1', 'label' => __('Courses', 'vibe'), 'link' => bp_loggedin_user_domain() . BP_COURSE_SLUG), 'stats' => array('icon' => 'icon-analytics-chart-graph', 'label' => __('Stats', 'vibe'), 'link' => bp_loggedin_user_domain() . BP_COURSE_SLUG . '/' . BP_COURSE_STATS_SLUG));
                if (bp_is_active('messages')) {
                    $loggedin_menu['messages'] = array('icon' => 'icon-letter-mail-1', 'label' => __('Inbox', 'vibe') . (messages_get_unread_count() ? ' <span>' . messages_get_unread_count() . '</span>' : ''), 'link' => bp_loggedin_user_domain() . BP_MESSAGES_SLUG);
                    $n = vbp_current_user_notification_count();
                    $loggedin_menu['notifications'] = array('icon' => 'icon-exclamation', 'label' => __('Notifications', 'vibe') . ($n ? ' <span>' . $n . '</span>' : ''), 'link' => bp_loggedin_user_domain() . BP_NOTIFICATIONS_SLUG);
                }
                if (bp_is_active('groups')) {
                    $loggedin_menu['groups'] = array('icon' => 'icon-myspace-alt', 'label' => __('Groups', 'vibe'), 'link' => bp_loggedin_user_domain() . BP_GROUPS_SLUG);
                }
                $loggedin_menu['settings'] = array('icon' => 'icon-settings', 'label' => __('Settings', 'vibe'), 'link' => bp_loggedin_user_domain() . BP_SETTINGS_SLUG);
                $loggedin_menu = apply_filters('wplms_logged_in_top_menu', $loggedin_menu);
                foreach ($loggedin_menu as $item) {
                    echo '<li><a href="' . $item['link'] . '"><i class="' . $item['icon'] . '"></i>' . $item['label'] . '</a></li>';
                }
                ?>
					</ul>

					<?php 
                do_action('bp_sidebar_me');
                ?>
				</div>
				<?php 
                do_action('bp_after_sidebar_me');
                /***** If the user is not logged in, show the log form and account creation link *****/
            } else {
                if (!isset($user_login)) {
                    $user_login = '';
                }
                do_action('bp_before_sidebar_login_form');
                ?>


				<form name="login-form" id="vbp-login-form" class="standard-form"
				      action="<?php 
                echo apply_filters('wplms_login_widget_action', vibe_site_url('wp-login.php', 'login-post'));
                ?>
" method="post">
					<label><?php 
                _e('Username', 'vibe');
                ?>
<br/>
						<input type="text" name="log" id="side-user-login" class="input" tabindex="1"
						       value="<?php 
                echo esc_attr(stripslashes($user_login));
                ?>
"/></label>

					<label><?php 
                _e('Password', 'vibe');
                ?>
 <a
							href="<?php 
                echo wp_lostpassword_url(get_permalink());
                ?>
" tabindex="5" class="tip"
							title="<?php 
                _e('Forgot Password', 'vibe');
                ?>
"><i class="icon-question"></i></a><br/>
						<input type="password" tabindex="2" name="pwd" id="sidebar-user-pass" class="input"
						       value=""/></label>

					<p class=""><label><input name="rememberme" tabindex="3" type="checkbox" id="sidebar-rememberme"
					                          value="forever"/><?php 
                _e('Remember Me', 'vibe');
                ?>
</label></p>

					<?php 
                do_action('bp_sidebar_login_form');
                ?>
					<input type="submit" name="user-submit" id="sidebar-wp-submit"
					       value="<?php 
                _e('Log In', 'vibe');
                ?>
" tabindex="100"/>
					<input type="hidden" name="user-cookie" value="1"/>
					<?php 
                if (bp_get_signup_allowed()) {
                    printf(__('<a href="%s" class="vbpregister" title="' . __('Create an account', 'vibe') . '" tabindex="5" >' . __('Sign Up', 'vibe') . '</a> ', 'vibe'), site_url(BP_REGISTER_SLUG . '/'));
                }
                ?>
					<?php 
                do_action('login_form');
                //BruteProtect FIX
                ?>
				</form>


				<?php 
                do_action('bp_after_sidebar_login_form');
            }
            echo $after_widget;
        }
Esempio n. 18
0
/**
 * Verify that some BP prerequisites are set up properly, and notify the admin if not
 *
 * On every Dashboard page, this function checks the following:
 *   - that pretty permalinks are enabled
 *   - that a BP-compatible theme is activated
 *   - that every BP component that needs a WP page for a directory has one
 *   - that no WP page has multiple BP components associated with it
 * The administrator will be shown a notice for each check that fails.
 *
 * @package BuddyPress Core
 */
function bp_core_activation_notice()
{
    global $wp_rewrite, $wpdb, $bp;
    // Only the super admin gets warnings
    if (!bp_current_user_can('bp_moderate')) {
        return;
    }
    // On multisite installs, don't load on a non-root blog, unless do_network_admin is
    // overridden
    if (is_multisite() && bp_core_do_network_admin() && !bp_is_root_blog()) {
        return;
    }
    // Don't show these messages during setup or upgrade
    if (!empty($bp->maintenance_mode)) {
        return;
    }
    /**
     * Check to make sure that the blog setup routine has run. This can't happen during the
     * wizard because of the order which the components are loaded. We check for multisite here
     * on the off chance that someone has activated the blogs component and then disabled MS
     */
    if (bp_is_active('blogs')) {
        $count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$bp->blogs->table_name}"));
        if (empty($count)) {
            bp_blogs_record_existing_blogs();
        }
    }
    /**
     * Are pretty permalinks enabled?
     */
    if (isset($_POST['permalink_structure'])) {
        return false;
    }
    if (empty($wp_rewrite->permalink_structure)) {
        bp_core_add_admin_notice(sprintf(__('<strong>BuddyPress is almost ready</strong>. You must <a href="%s">update your permalink structure</a> to something other than the default for it to work.', 'buddypress'), admin_url('options-permalink.php')));
    }
    /**
     * Are you using a BP-compatible theme?
     */
    // Get current theme info
    $ct = wp_get_theme();
    // Make sure tags is an array to suppress notices
    if (!isset($ct->tags)) {
        $ct->tags = array();
    } else {
        $ct->tags = (array) $ct->tags;
    }
    // The best way to remove this notice is to add a "buddypress" tag to
    // your active theme's CSS header.
    if (!defined('BP_SILENCE_THEME_NOTICE') && !in_array('buddypress', $ct->tags)) {
        bp_core_add_admin_notice(sprintf(__("You'll need to <a href='%s'>activate a <strong>BuddyPress-compatible theme</strong></a> to take advantage of all of BuddyPress's features. We've bundled a default theme, but you can always <a href='%s'>install some other compatible themes</a> or <a href='%s'>update your existing WordPress theme</a>.", 'buddypress'), admin_url('themes.php'), network_admin_url('theme-install.php?type=tag&s=buddypress&tab=search'), network_admin_url('plugin-install.php?type=term&tab=search&s=%22bp-template-pack%22')));
    }
    /**
     * Check for orphaned BP components (BP component is enabled, no WP page exists)
     */
    $orphaned_components = array();
    $wp_page_components = array();
    // Only components with 'has_directory' require a WP page to function
    foreach ($bp->loaded_components as $component_id => $is_active) {
        if (!empty($bp->{$component_id}->has_directory)) {
            $wp_page_components[] = array('id' => $component_id, 'name' => isset($bp->{$component_id}->name) ? $bp->{$component_id}->name : ucwords($bp->{$component_id}->id));
        }
    }
    // Activate and Register are special cases. They are not components but they need WP pages.
    // If user registration is disabled, we can skip this step.
    if (bp_get_signup_allowed()) {
        $wp_page_components[] = array('id' => 'activate', 'name' => __('Activate', 'buddypress'));
        $wp_page_components[] = array('id' => 'register', 'name' => __('Register', 'buddypress'));
    }
    foreach ($wp_page_components as $component) {
        if (!isset($bp->pages->{$component['id']})) {
            $orphaned_components[] = $component['name'];
        }
    }
    // Special case: If the Forums component is orphaned, but the bbPress 1.x installation is
    // not correctly set up, don't show a nag. (In these cases, it's probably the case that the
    // user is using bbPress 2.x; see https://buddypress.trac.wordpress.org/ticket/4292
    if (isset($bp->forums->name) && in_array($bp->forums->name, $orphaned_components) && !bp_forums_is_installed_correctly()) {
        $forum_key = array_search($bp->forums->name, $orphaned_components);
        unset($orphaned_components[$forum_key]);
        $orphaned_components = array_values($orphaned_components);
    }
    if (!empty($orphaned_components)) {
        $admin_url = bp_get_admin_url(add_query_arg(array('page' => 'bp-page-settings'), 'admin.php'));
        $notice = sprintf(__('The following active BuddyPress Components do not have associated WordPress Pages: %2$s. <a href="%1$s" class="button-secondary">Repair</a>', 'buddypress'), $admin_url, '<strong>' . implode('</strong>, <strong>', $orphaned_components) . '</strong>');
        bp_core_add_admin_notice($notice);
    }
    /**
     * BP components cannot share a single WP page. Check for duplicate assignments, and post
     * a message if found.
     */
    $dupe_names = array();
    $page_ids = (array) bp_core_get_directory_page_ids();
    $dupes = array_diff_assoc($page_ids, array_unique($page_ids));
    if (!empty($dupes)) {
        foreach ($dupes as $dupe_component => $dupe_id) {
            $dupe_names[] = $bp->pages->{$dupe_component}->title;
        }
        // Make sure that there are no duplicate duplicates :)
        $dupe_names = array_unique($dupe_names);
    }
    // If there are duplicates, post a message about them
    if (!empty($dupe_names)) {
        $admin_url = bp_get_admin_url(add_query_arg(array('page' => 'bp-page-settings'), 'admin.php'));
        $notice = sprintf(__('Each BuddyPress Component needs its own WordPress page. The following WordPress Pages have more than one component associated with them: %2$s. <a href="%1$s" class="button-secondary">Repair</a>', 'buddypress'), $admin_url, '<strong>' . implode('</strong>, <strong>', $dupe_names) . '</strong>');
        bp_core_add_admin_notice($notice);
    }
}
Esempio n. 19
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'));
}
    function widget($args, $instance)
    {
        if (!parent::widget($args, $instance)) {
            return;
        }
        extract($args);
        echo $before_widget;
        $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : false);
        if ($title) {
            echo $before_title, $title, $after_title;
        }
        ?>

<?php 
        if (is_user_logged_in()) {
            ?>

	<?php 
            do_action('bp_before_sidebar_me');
            ?>

	<div id="sidebar-me" class="widget clearfix">
		<h3 class="widget-title">Welcome <?php 
            echo bp_core_get_userlink(bp_loggedin_user_id());
            ?>
</h3>
		<a href="<?php 
            echo bp_loggedin_user_domain();
            ?>
">
			<?php 
            bp_loggedin_user_avatar('type=thumb&width=40&height=40');
            ?>
		</a>

		<a class="button logout" href="<?php 
            echo wp_logout_url(wp_guess_url());
            ?>
"><?php 
            _e('Log Out', 'buddypress');
            ?>
</a>

		<?php 
            do_action('bp_sidebar_me');
            ?>
	</div>

	<?php 
            do_action('bp_after_sidebar_me');
            ?>

	<?php 
            if (bp_is_active('messages')) {
                ?>
		<?php 
                bp_message_get_notices();
                /* Site wide notices to all users */
                ?>
	<?php 
            }
            ?>

<?php 
        } else {
            ?>

	<?php 
            do_action('bp_before_sidebar_login_form');
            ?>

	<?php 
            if (bp_get_signup_allowed()) {
                ?>
	
		<p id="login-text">

			<?php 
                printf(__('<a href="%s" title="Create account" class="btn btn-primary btn-large">Create account to join community</a>', 'buddypress'), bp_get_signup_page());
                ?>

		</p>

	<?php 
            }
            ?>

	<form name="login-form" id="sidebar-login-form" class="standard-form widget" action="<?php 
            echo site_url('wp-login.php', 'login_post');
            ?>
" method="post">
		<h3 class="widget-title"><?php 
            _e('Login', 'bre-bootstrap-ecommerce');
            ?>
</h3>
		<label><?php 
            _e('Username', 'buddypress');
            ?>
<br />
		<input type="text" name="log" id="sidebar-user-login" class="input" value="<?php 
            if (isset($user_login)) {
                echo esc_attr(stripslashes($user_login));
            }
            ?>
" tabindex="97" /></label>

		<label><?php 
            _e('Password', 'buddypress');
            ?>
<br />
		<input type="password" name="pwd" id="sidebar-user-pass" class="input" value="" tabindex="98" /></label>

		<p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="sidebar-rememberme" value="forever" tabindex="99" /> <?php 
            _e('Remember Me', 'buddypress');
            ?>
</label></p>

		<?php 
            do_action('bp_sidebar_login_form');
            ?>
		<input type="submit" name="wp-submit" id="sidebar-wp-submit" value="<?php 
            _e('Log In', 'buddypress');
            ?>
" tabindex="100" />
		<input type="hidden" name="redirect_to" value="<?php 
            echo $_SERVER['REQUEST_URI'];
            ?>
" />
		<input type="hidden" name="testcookie" value="1" />
	</form>

	<?php 
            do_action('bp_after_sidebar_login_form');
            ?>

<?php 
        }
        ?>

<?php 
        echo $after_widget;
    }
buddyboss_adminbar_myaccount();
?>

				<?php 
if (!is_page_template('page-no-buddypanel.php') && !(!boss_get_option('boss_panel_hide') && !is_user_logged_in())) {
    wp_nav_menu(array('theme_location' => 'header-my-account', 'container_class' => 'boss-mobile-porfile-menu', 'fallback_cb' => '', 'menu_class' => 'links', 'depth' => 2, 'walker' => new BuddybossWalker()));
}
?>

				<!-- Register/Login links for logged out users -->
				<?php 
if (!is_user_logged_in() && buddyboss_is_bp_active() && !bp_hide_loggedout_adminbar(false)) {
    ?>

					<?php 
    if (buddyboss_is_bp_active() && bp_get_signup_allowed()) {
        ?>
						<a href="<?php 
        echo bp_get_signup_page();
        ?>
" class="register-link screen-reader-shortcut"><?php 
        _e('Register', 'boss');
        ?>
</a>
					<?php 
    }
    ?>

					<a href="<?php 
    echo wp_login_url();
    ?>
Esempio n. 22
0
    /**
     * Display the login widget.
     *
     * @see WP_Widget::widget() for description of parameters.
     *
     * @param array $args     Widget arguments.
     * @param array $instance Widget settings, as saved by the user.
     */
    public function widget($args, $instance)
    {
        $title = isset($instance['title']) ? $instance['title'] : '';
        /**
         * Filters the title of the Login widget.
         *
         * @since 1.9.0
         * @since 2.3.0 Added 'instance' and 'id_base' to arguments passed to filter.
         *
         * @param string $title    The widget title.
         * @param array  $instance The settings for the particular instance of the widget.
         * @param string $id_base  Root ID for all widgets of this type.
         */
        $title = apply_filters('widget_title', $title, $instance, $this->id_base);
        echo $args['before_widget'];
        echo $args['before_title'] . esc_html($title) . $args['after_title'];
        ?>

		<?php 
        if (is_user_logged_in()) {
            ?>

			<?php 
            /**
             * Fires before the display of widget content if logged in.
             *
             * @since 1.9.0
             */
            do_action('bp_before_login_widget_loggedin');
            ?>

			<div class="bp-login-widget-user-avatar">
				<a href="<?php 
            echo bp_loggedin_user_domain();
            ?>
">
					<?php 
            bp_loggedin_user_avatar('type=thumb&width=50&height=50');
            ?>
				</a>
			</div>

			<div class="bp-login-widget-user-links">
				<div class="bp-login-widget-user-link"><?php 
            echo bp_core_get_userlink(bp_loggedin_user_id());
            ?>
</div>
				<div class="bp-login-widget-user-logout"><a class="logout" href="<?php 
            echo wp_logout_url(bp_get_requested_url());
            ?>
"><?php 
            _e('Log Out', 'buddypress');
            ?>
</a></div>
			</div>

			<?php 
            /**
             * Fires after the display of widget content if logged in.
             *
             * @since 1.9.0
             */
            do_action('bp_after_login_widget_loggedin');
            ?>

		<?php 
        } else {
            ?>

			<?php 
            /**
             * Fires before the display of widget content if logged out.
             *
             * @since 1.9.0
             */
            do_action('bp_before_login_widget_loggedout');
            ?>

			<form name="bp-login-form" id="bp-login-widget-form" class="standard-form" action="<?php 
            echo esc_url(site_url('wp-login.php', 'login_post'));
            ?>
" method="post">
				<label for="bp-login-widget-user-login"><?php 
            _e('Username', 'buddypress');
            ?>
</label>
				<input type="text" name="log" id="bp-login-widget-user-login" class="input" value="" />

				<label for="bp-login-widget-user-pass"><?php 
            _e('Password', 'buddypress');
            ?>
</label>
				<input type="password" name="pwd" id="bp-login-widget-user-pass" class="input" value="" <?php 
            bp_form_field_attributes('password');
            ?>
 />

				<div class="forgetmenot"><label for="bp-login-widget-rememberme"><input name="rememberme" type="checkbox" id="bp-login-widget-rememberme" value="forever" /> <?php 
            _e('Remember Me', 'buddypress');
            ?>
</label></div>

				<input type="submit" name="wp-submit" id="bp-login-widget-submit" value="<?php 
            esc_attr_e('Log In', 'buddypress');
            ?>
" />

				<?php 
            if (bp_get_signup_allowed()) {
                ?>

					<span class="bp-login-widget-register-link"><?php 
                printf(__('<a href="%s" title="Register for a new account">Register</a>', 'buddypress'), bp_get_signup_page());
                ?>
</span>

				<?php 
            }
            ?>

				<?php 
            /**
             * Fires inside the display of the login widget form.
             *
             * @since 2.4.0
             */
            do_action('bp_login_widget_form');
            ?>

			</form>

			<?php 
            /**
             * Fires after the display of widget content if logged out.
             *
             * @since 1.9.0
             */
            do_action('bp_after_login_widget_loggedout');
            ?>

		<?php 
        }
        echo $args['after_widget'];
    }
/**
 * Output whether signup is allowed.
 *
 * @todo Remove this function. Echoing a bool is pointless.
 */
function bp_signup_allowed()
{
    echo bp_get_signup_allowed();
}
 /**
  * The text shown when no items are found.
  *
  * Nice job, clean sheet!
  *
  * @since 2.0.0
  */
 public function no_items()
 {
     if (bp_get_signup_allowed()) {
         esc_html_e('No pending accounts found.', 'buddypress');
     } else {
         $link = false;
         // Specific case when BuddyPress is not network activated.
         if (is_multisite() && current_user_can('manage_network_users')) {
             $link = sprintf('<a href="%1$s">%2$s</a>', esc_url(network_admin_url('settings.php')), esc_html__('Edit settings', 'buddypress'));
         } elseif (current_user_can('manage_options')) {
             $link = sprintf('<a href="%1$s">%2$s</a>', esc_url(bp_get_admin_url('options-general.php')), esc_html__('Edit settings', 'buddypress'));
         }
         printf(__('Registration is disabled. %s', 'buddypress'), $link);
     }
 }
/**
 * Verify that some BP prerequisites are set up properly, and notify the admin if not.
 *
 * On every Dashboard page, this function checks the following:
 *   - that pretty permalinks are enabled.
 *   - that every BP component that needs a WP page for a directory has one.
 *   - that no WP page has multiple BP components associated with it.
 * The administrator will be shown a notice for each check that fails.
 *
 * @global WPDB $wpdb WordPress DB object
 * @global WP_Rewrite $wp_rewrite
 *
 * @since 1.2.0
 */
function bp_core_activation_notice()
{
    global $wp_rewrite, $wpdb;
    // Only the super admin gets warnings.
    if (!bp_current_user_can('bp_moderate')) {
        return;
    }
    // Bail in user admin.
    if (is_user_admin()) {
        return;
    }
    // On multisite installs, don't load on a non-root blog, unless do_network_admin is overridden.
    if (is_multisite() && bp_core_do_network_admin() && !bp_is_root_blog()) {
        return;
    }
    // Bail if in network admin, and BuddyPress is not network activated.
    if (is_network_admin() && !bp_is_network_activated()) {
        return;
    }
    /**
     * Check to make sure that the blog setup routine has run. This can't
     * happen during the wizard because of the order which the components
     * are loaded.
     */
    if (bp_is_active('blogs')) {
        $bp = buddypress();
        $count = $wpdb->get_var("SELECT COUNT(*) FROM {$bp->blogs->table_name}");
        if (empty($count)) {
            bp_blogs_record_existing_blogs();
        }
    }
    // Add notice if no rewrite rules are enabled.
    if (empty($wp_rewrite->permalink_structure)) {
        bp_core_add_admin_notice(sprintf(__('<strong>BuddyPress is almost ready</strong>. You must <a href="%s">update your permalink structure</a> to something other than the default for it to work.', 'buddypress'), admin_url('options-permalink.php')), 'error');
    }
    // Get BuddyPress instance.
    $bp = buddypress();
    /**
     * Check for orphaned BP components (BP component is enabled, no WP page exists).
     */
    $orphaned_components = array();
    $wp_page_components = array();
    // Only components with 'has_directory' require a WP page to function.
    foreach (array_keys($bp->loaded_components) as $component_id) {
        if (!empty($bp->{$component_id}->has_directory)) {
            $wp_page_components[] = array('id' => $component_id, 'name' => isset($bp->{$component_id}->name) ? $bp->{$component_id}->name : ucwords($bp->{$component_id}->id));
        }
    }
    // Activate and Register are special cases. They are not components but they need WP pages.
    // If user registration is disabled, we can skip this step.
    if (bp_get_signup_allowed()) {
        $wp_page_components[] = array('id' => 'activate', 'name' => __('Activate', 'buddypress'));
        $wp_page_components[] = array('id' => 'register', 'name' => __('Register', 'buddypress'));
    }
    // On the first admin screen after a new installation, this isn't set, so grab it to suppress
    // a misleading error message.
    if (empty($bp->pages->members)) {
        $bp->pages = bp_core_get_directory_pages();
    }
    foreach ($wp_page_components as $component) {
        if (!isset($bp->pages->{$component['id']})) {
            $orphaned_components[] = $component['name'];
        }
    }
    // Special case: If the Forums component is orphaned, but the bbPress 1.x installation is
    // not correctly set up, don't show a nag. (In these cases, it's probably the case that the
    // user is using bbPress 2.x; see https://buddypress.trac.wordpress.org/ticket/4292.
    if (isset($bp->forums->name) && in_array($bp->forums->name, $orphaned_components) && !bp_forums_is_installed_correctly()) {
        $forum_key = array_search($bp->forums->name, $orphaned_components);
        unset($orphaned_components[$forum_key]);
        $orphaned_components = array_values($orphaned_components);
    }
    if (!empty($orphaned_components)) {
        $admin_url = bp_get_admin_url(add_query_arg(array('page' => 'bp-page-settings'), 'admin.php'));
        $notice = sprintf(__('The following active BuddyPress Components do not have associated WordPress Pages: %2$s. <a href="%1$s">Repair</a>', 'buddypress'), esc_url($admin_url), '<strong>' . implode('</strong>, <strong>', $orphaned_components) . '</strong>');
        bp_core_add_admin_notice($notice);
    }
    // BP components cannot share a single WP page. Check for duplicate assignments, and post a message if found.
    $dupe_names = array();
    $page_ids = (array) bp_core_get_directory_page_ids();
    $dupes = array_diff_assoc($page_ids, array_unique($page_ids));
    if (!empty($dupes)) {
        foreach (array_keys($dupes) as $dupe_component) {
            $dupe_names[] = $bp->pages->{$dupe_component}->title;
        }
        // Make sure that there are no duplicate duplicates :).
        $dupe_names = array_unique($dupe_names);
    }
    // If there are duplicates, post a message about them.
    if (!empty($dupe_names)) {
        $admin_url = bp_get_admin_url(add_query_arg(array('page' => 'bp-page-settings'), 'admin.php'));
        $notice = sprintf(__('Each BuddyPress Component needs its own WordPress page. The following WordPress Pages have more than one component associated with them: %2$s. <a href="%1$s">Repair</a>', 'buddypress'), esc_url($admin_url), '<strong>' . implode('</strong>, <strong>', $dupe_names) . '</strong>');
        bp_core_add_admin_notice($notice);
    }
}
Esempio n. 26
0
        function widget($args, $instance)
        {
            extract($args);
            echo $before_widget;
            if (is_user_logged_in()) {
                do_action('bp_before_sidebar_me');
                ?>
                <div id="sidebar-me">
                    <div id="bpavatar">
                        <a href="<?php 
                echo bp_loggedin_user_domain() . BP_XPROFILE_SLUG;
                ?>
/" title="<?php 
                _e('Thông tin cá nhân', 'vibe');
                ?>
"><?php 
                bp_loggedin_user_avatar('type=full');
                ?>
</a>
                    </div>
                    <ul style="width: 145px">
                        <li id="username"><a href="<?php 
                bp_loggedin_user_link();
                ?>
"><?php 
                bp_loggedin_user_fullname();
                ?>
</a></li>
                        <li><a href="<?php 
                echo bp_loggedin_user_domain() . BP_XPROFILE_SLUG;
                ?>
/" title="<?php 
                _e('Thông tin cá nhân', 'vibe');
                ?>
"><?php 
                _e('Thông tin cá nhân', 'vibe');
                ?>
</a></li>
                        <li id="vbplogout"><a href="<?php 
                echo wp_logout_url(get_permalink());
                ?>
" id="destroy-sessions" rel="nofollow" class="logout" title="<?php 
                _e('Đăng xuất', 'vibe');
                ?>
"><?php 
                _e('Đăng xuất', 'vibe');
                ?>
</a></li>
                        <li id="admin_panel_icon"><?php 
                if (current_user_can("edit_posts")) {
                    echo '<a href="' . vibe_site_url() . 'wp-admin/" title="' . __('Access admin panel', 'vibe') . '"><i class="icon-settings-1"></i></a>';
                }
                ?>
                        </li>
                    </ul>
                    <ul>
                        <?php 
                function child_wplms_get_mycred_link()
                {
                    $mycred = get_option('mycred_pref_core');
                    if (isset($mycred['buddypress']) && isset($mycred['buddypress']['history_url']) && isset($mycred['buddypress']['history_location']) && $mycred['buddypress']['history_location']) {
                        $link = bp_get_loggedin_user_link() . $mycred['buddypress']['history_url'];
                    } else {
                        $link = '#';
                    }
                    return $link;
                }
                $loggedin_menu = array('taikhoan' => array('icon' => 'icon-book-open-1', 'label' => __('Tài khoản: ' . apply_filters('get_point_user', ''), 'vibe'), 'link' => child_wplms_get_mycred_link()), 'naptientaokhoan' => array('icon' => 'icon-book-open-1', 'label' => __('Nạp tiền tài khoản', 'vibe'), 'link' => get_home_url() . '/thanh-toan-khoa-hoc/'), 'courses' => array('icon' => 'icon-book-open-1', 'label' => __('Khóa học của tôi', 'vibe'), 'link' => bp_loggedin_user_domain() . BP_COURSE_SLUG));
                if (bp_is_active('messages')) {
                    $loggedin_menu['messages'] = array('icon' => 'icon-letter-mail-1', 'label' => __('Hộp thư đến', 'vibe') . (messages_get_unread_count() ? ' <span>' . messages_get_unread_count() . '</span>' : ''), 'link' => bp_loggedin_user_domain() . BP_MESSAGES_SLUG);
                    $n = vbp_current_user_notification_count();
                    //                            $loggedin_menu['notifications']=array(
                    //                                'icon' => 'icon-exclamation',
                    //                                'label' => __('Thông báo','vibe').(($n)?' <span>'.$n.'</span>':''),
                    //                                'link' => bp_loggedin_user_domain().BP_NOTIFICATIONS_SLUG
                    //                            );
                }
                if (bp_is_active('groups')) {
                    $loggedin_menu['groups'] = array('icon' => 'icon-myspace-alt', 'label' => __('Nhóm', 'vibe'), 'link' => bp_loggedin_user_domain() . BP_GROUPS_SLUG);
                }
                $loggedin_menu = apply_filters('wplms_logged_in_top_menu', $loggedin_menu);
                foreach ($loggedin_menu as $item) {
                    echo '<li><a href="' . $item['link'] . '"><i class="' . $item['icon'] . '"></i>' . $item['label'] . '</a></li>';
                }
                ?>
                    </ul>

                    <?php 
                do_action('bp_sidebar_me');
                ?>
                </div>
                <?php 
                do_action('bp_after_sidebar_me');
                /***** If the user is not logged in, show the log form and account creation link *****/
            } else {
                if (!isset($user_login)) {
                    $user_login = '';
                }
                do_action('bp_before_sidebar_login_form');
                ?>


                <h2 class="box-heading">Đăng nhập ITClass !</h2>

                <form name="login-form" id="vbp-login-form" class="standard-form" action="<?php 
                echo apply_filters('wplms_login_widget_action', vibe_site_url('wp-login.php', 'login-post'));
                ?>
" method="post">
                    <div class="col-md-6" style="padding: 0px 20px 10px">
                        <label><?php 
                _e('Đăng nhập với tài khoản ItClass', 'dangnhapitclass');
                ?>
</label>
                        <label><?php 
                _e('Tên đăng nhập', 'vibe');
                ?>
<br />
                            <input type="text" name="log" id="side-user-login" class="input" tabindex="1" value="<?php 
                echo esc_attr(stripslashes($user_login));
                ?>
" /></label>

                        <label><?php 
                _e('Mật khẩu', 'vibe');
                ?>
 <a href="<?php 
                echo wp_lostpassword_url(get_permalink());
                ?>
" tabindex="5" class="tip" title="<?php 
                _e('Forgot Password', 'vibe');
                ?>
"><i class="icon-question"></i></a><br />
                            <input type="password" tabindex="2" name="pwd" id="sidebar-user-pass" class="input" value="" /></label>

                        <p class="quenmatkhau"><label><input name="rememberme" tabindex="3" type="checkbox" id="sidebar-rememberme" value="forever" /><?php 
                _e('Ghi nhớ', 'vibe');
                ?>
   <a href="<?php 
                echo wp_lostpassword_url();
                ?>
"> Quên mật khẩu </a></label>

                        </p>

                        <?php 
                do_action('bp_sidebar_login_form');
                ?>
                        <!--                        <input type="submit" name="wp-submit" id="sidebar-wp-submit" tabindex="4" value="--><?php 
                //_e( 'Đăng nhập','vibe' );
                ?>
<!--" tabindex="100" /><p></p>-->
                        <span class="error-login">Tài khoản hoặc mật khẩu không đúng !</span>
                        <span class="btn btn-danger" id="id-dangnhap-it"><i style="display: none" class="noidungthongbaoloading icon-refresh glyphicon-refresh-animate"></i><?php 
                _e('Đăng nhập', 'vibe');
                ?>
</span><br/>
                        <input type="hidden" name="testcookie" value="1" />
                        <?php 
                if (bp_get_signup_allowed()) {
                    _e('Bạn chưa có tài khoản ? ', 'vibe');
                    printf(__('<a href="%s" class="vbpregister" title="' . __('Create an account', 'vibe') . '" tabindex="5" >' . __('Đăng ký', 'vibe') . '</a> ', 'vibe'), site_url(BP_REGISTER_SLUG . '/'));
                }
                ?>
                    </div>
                    <div class="box-separator"></div>
                    <div class="box-right">
                        <?php 
                //do_action( 'login_form' ); //BruteProtect FIX
                ?>
			<p class="comment-form-social-connect">
                           <label>Đăng nhập với mạng xã hội</label>
                        </p>
			<a href="http://it.myclass.vn/wp-login.php?loginFacebook=1&redirect=http://it.myclass.vn" onclick="window.location = 'http://it.myclass.vn/wp-login.php?loginFacebook=1&redirect='+window.location.href; return false;"><div class="social-btn"><i class="icon-facebook social-icon"></i><span class="btn-text">Đăng nhập bằng Facebook</span></div></a>
                    </div>

                </form>


                <?php 
                do_action('bp_after_sidebar_login_form');
            }
            echo $after_widget;
        }
Esempio n. 27
0
/**
 *  buddypress login widget
 *
 * @package Custom Community
 * @since 1.8.3
 */
function cc_login_widget()
{
    ?>
	<?php 
    global $cap;
    ?>
		<?php 
    do_action('bp_inside_before_sidebar');
    ?>
	
		<?php 
    if (is_user_logged_in()) {
        ?>
	
			<?php 
        do_action('bp_before_sidebar_me');
        ?>
			<div class="widget">
			<div id="sidebar-me">
				<a href="<?php 
        echo bp_loggedin_user_domain();
        ?>
">
					<?php 
        bp_loggedin_user_avatar('type=thumb&width=40&height=40');
        ?>
				</a>
	
				<h4><?php 
        echo bp_core_get_userlink(bp_loggedin_user_id());
        ?>
</h4>
				<a class="button logout" href="<?php 
        echo wp_logout_url(bp_get_root_domain());
        ?>
"><?php 
        _e('Log Out', 'cc');
        ?>
</a>
	
				<?php 
        do_action('bp_sidebar_me');
        ?>
			</div>
			</div>
			<?php 
        do_action('bp_after_sidebar_me');
        ?>
	
			<?php 
        if (function_exists('bp_message_get_notices')) {
            ?>
				<?php 
            bp_message_get_notices();
            /* Site wide notices to all users */
            ?>
			<?php 
        }
        ?>
	
		<?php 
    } else {
        ?>
	
			<?php 
        do_action('bp_before_sidebar_login_form');
        ?>
			<div class="widget">
			<p id="login-text">
			<?php 
        if (!$cap->bp_login_sidebar_text) {
            ?>
				<?php 
            _e('To start connecting please log in first.', 'cc');
            ?>
			<?php 
        } else {
            ?>
				<?php 
            echo $cap->bp_login_sidebar_text;
            ?>
			<?php 
        }
        ?>
				<?php 
        if (bp_get_signup_allowed()) {
            ?>
					<?php 
            printf(__(' You can also <a href="%s" title="Create an account">create an account</a>.', 'cc'), site_url(BP_REGISTER_SLUG . '/'));
            ?>
				<?php 
        }
        ?>
			</p>
	
			<form name="login-form" id="sidebar-login-form" class="standard-form" action="<?php 
        echo site_url('wp-login.php', 'login_post');
        ?>
" method="post">
				<label><?php 
        _e('Username', 'cc');
        ?>
<br />
				<input type="text" name="log" id="sidebar-user-login" class="input" value="" /></label>
	
				<label><?php 
        _e('Password', 'cc');
        ?>
<br />
				<input type="password" name="pwd" id="sidebar-user-pass" class="input" value="" /></label>
	
				<p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="sidebar-rememberme" value="forever" /> <?php 
        _e('Remember Me', 'cc');
        ?>
</label></p>
	
				<?php 
        do_action('bp_sidebar_login_form');
        ?>
				<input type="submit" name="wp-submit" id="sidebar-wp-submit" value="<?php 
        _e('Log In', 'cc');
        ?>
" tabindex="100" />
				<input type="hidden" name="testcookie" value="1" />
			</form>
			</div>
			<?php 
        do_action('bp_after_sidebar_login_form');
        ?>
		<?php 
    }
}
 function x_buddypress_navbar_menu($items, $args)
 {
     if (X_BUDDYPRESS_IS_ACTIVE && x_get_option('x_buddypress_header_menu_enable', '') == '1') {
         $top_level_link = is_user_logged_in() ? bp_loggedin_user_domain() : bp_get_activity_directory_permalink();
         $submenu_items = '';
         if (bp_is_active('activity')) {
             $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_activity_directory_permalink() . '" class="cf"><i class="x-icon-thumbs-up" data-x-icon="&#xf164;"></i> <span>' . x_get_option('x_buddypress_activity_title', __('Activity', '__x__')) . '</span></a></li>';
         }
         if (bp_is_active('groups')) {
             $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_groups_directory_permalink() . '" class="cf"><i class="x-icon-sitemap" data-x-icon="&#xf0e8;"></i> <span>' . x_get_option('x_buddypress_groups_title', __('Groups', '__x__')) . '</span></a></li>';
         }
         if (is_multisite() && bp_is_active('blogs')) {
             $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_blogs_directory_permalink() . '" class="cf"><i class="x-icon-file" data-x-icon="&#xf15b;"></i> <span>' . x_get_option('x_buddypress_blogs_title', __('Blogs', '__x__')) . '</span></a></li>';
         }
         $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_members_directory_permalink() . '" class="cf"><i class="x-icon-male" data-x-icon="&#xf183;"></i> <span>' . x_get_option('x_buddypress_members_title', __('Members', '__x__')) . '</span></a></li>';
         if (!is_user_logged_in()) {
             if (bp_get_signup_allowed()) {
                 $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_signup_page() . '" class="cf"><i class="x-icon-pencil" data-x-icon="&#xf040;"></i> <span>' . x_get_option('x_buddypress_register_title', __('Create an Account', '__x__')) . '</span></a></li>';
                 $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_activation_page() . '" class="cf"><i class="x-icon-key" data-x-icon="&#xf084;"></i> <span>' . x_get_option('x_buddypress_activate_title', __('Activate Your Account', '__x__')) . '</span></a></li>';
             }
             $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . wp_login_url() . '" class="cf"><i class="x-icon-sign-in" data-x-icon="&#xf090;"></i> <span>' . __('Log in', '__x__') . '</span></a></li>';
         } else {
             $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_loggedin_user_domain() . '" class="cf"><i class="x-icon-cog" data-x-icon="&#xf013;"></i> <span>' . __('Profile', '__x__') . '</span></a></li>';
         }
         if ($args->theme_location == 'primary') {
             $items .= '<li class="menu-item current-menu-parent menu-item-has-children x-menu-item x-menu-item-buddypress">' . '<a href="' . $top_level_link . '" class="x-btn-navbar-buddypress">' . '<span><i class="x-icon-user" data-x-icon="&#xf007;"></i><span class="x-hidden-desktop"> ' . __('Social', '__x__') . '</span></span>' . '</a>' . '<ul class="sub-menu">' . $submenu_items . '</ul>' . '</li>';
         }
     }
     return $items;
 }
Esempio n. 29
0
/**
 * Handle the loading of the signup screen.
 */
function bp_core_screen_signup()
{
    global $bp;
    if (!bp_is_current_component('register') || bp_current_action()) {
        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 = trailingslashit(bp_get_root_domain() . '/' . bp_get_members_root_slug());
        } else {
            $redirect_to = bp_get_root_domain();
        }
        /**
         * Filters the URL to redirect logged in users to when visiting registration page.
         *
         * @since BuddyPress (1.5.1)
         *
         * @param string $redirect_to URL to redirect user to.
         */
        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';
        // If the signup page is submitted, validate and save
    } elseif (isset($_POST['signup_submit']) && bp_verify_nonce_request('bp_new_signup')) {
        /**
         * Fires before the validation of a new signup.
         *
         * @since BuddyPress (2.0.0)
         */
        do_action('bp_signup_pre_validate');
        // 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];
                }
            }
        }
        /**
         * Fires after the validation of a new signup.
         *
         * @since BuddyPress (1.1.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) {
                // addslashes() and stripslashes() to avoid create_function()
                // syntax errors when the $error_message contains quotes
                /**
                 * Filters the error message in the loop.
                 *
                 * @since BuddyPress (1.5.0)
                 *
                 * @param string $value Error message wrapped in html.
                 */
                add_action('bp_' . $fieldname . '_errors', create_function('', 'echo apply_filters(\'bp_members_signup_error_message\', "<div class=\\"error\\">" . stripslashes( \'' . addslashes($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) {
                // Make sure the extended profiles module is enabled
                if (bp_is_active('xprofile')) {
                    // 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 - @todo This logic should be shared with the same in xprofile_screen_edit_profile()
                    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'])) {
                                // Concatenate the values
                                $date_value = $_POST['field_' . $field_id . '_day'] . ' ' . $_POST['field_' . $field_id . '_month'] . ' ' . $_POST['field_' . $field_id . '_year'];
                                // Turn the concatenated value into a timestamp
                                $_POST['field_' . $field_id] = date('Y-m-d H:i:s', strtotime($date_value));
                            }
                        }
                        if (!empty($_POST['field_' . $field_id])) {
                            $usermeta['field_' . $field_id] = $_POST['field_' . $field_id];
                        }
                        if (!empty($_POST['field_' . $field_id . '_visibility'])) {
                            $usermeta['field_' . $field_id . '_visibility'] = $_POST['field_' . $field_id . '_visibility'];
                        }
                    }
                    // 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;
                }
                /**
                 * Filters the user meta used for signup.
                 *
                 * @since BuddyPress (1.1.0)
                 *
                 * @param array $usermeta Array of user meta to add to signup.
                 */
                $usermeta = apply_filters('bp_signup_usermeta', $usermeta);
                // Finally, sign up the user and/or blog
                if (isset($_POST['signup_with_blog']) && is_multisite()) {
                    $wp_user_id = bp_core_signup_blog($blog_details['domain'], $blog_details['path'], $blog_details['blog_title'], $_POST['signup_username'], $_POST['signup_email'], $usermeta);
                } else {
                    $wp_user_id = bp_core_signup_user($_POST['signup_username'], $_POST['signup_password'], $_POST['signup_email'], $usermeta);
                }
                if (is_wp_error($wp_user_id)) {
                    $bp->signup->step = 'request-details';
                    bp_core_add_message($wp_user_id->get_error_message(), 'error');
                } else {
                    $bp->signup->step = 'completed-confirmation';
                }
            }
            /**
             * Fires after the completion of a new signup.
             *
             * @since BuddyPress (1.1.0)
             */
            do_action('bp_complete_signup');
        }
    }
    /**
     * Fires right before the loading of the Member registration screen template file.
     *
     * @since BuddyPress (1.5.0)
     */
    do_action('bp_core_screen_signup');
    /**
     * Filters the template to load for the Member registration page screen.
     *
     * @since BuddyPress (1.5.0)
     *
     * @param string $value Path to the Member registration template to load.
     */
    bp_core_load_template(apply_filters('bp_core_template_register', array('register', 'registration/register')));
}
Esempio n. 30
0
File: 2.1.php Progetto: eresyyl/mk
/**
 * Output the "Log In" and "Sign Up" names to the BuddyBar.
 *
 * Visible only to visitors who are not logged in.
 *
 * @deprecated BuddyPress (2.1.0)
 *
 * @return bool|null Returns false if the current user is logged in.
 */
function bp_adminbar_login_menu()
{
    if (is_user_logged_in()) {
        return false;
    }
    echo '<li class="bp-login no-arrow"><a href="' . wp_login_url() . '">' . __('Log In', 'buddypress') . '</a></li>';
    // Show "Sign Up" link if user registrations are allowed
    if (bp_get_signup_allowed()) {
        echo '<li class="bp-signup no-arrow"><a href="' . bp_get_signup_page() . '">' . __('Sign Up', 'buddypress') . '</a></li>';
    }
}