Example #1
0
    /**
     * Render the widget.
     *
     * @see WP_Widget::widget() for a description of parameters.
     *
     * @param array $args See {@WP_Widget::widget()}.
     * @param array $args See {@WP_Widget::widget()}.
     */
    public function widget($args, $instance)
    {
        if (!is_user_logged_in()) {
            return;
        }
        // Don't display the widget if there are no Notices to show
        $notices = BP_Messages_Notice::get_active();
        if (empty($notices)) {
            return;
        }
        extract($args);
        $title = !empty($instance['title']) ? $instance['title'] : '';
        $title = apply_filters('widget_title', $title, $instance);
        echo $before_widget;
        echo $before_title . $title . $after_title;
        ?>

		<div class="bp-site-wide-message">
			<?php 
        bp_message_get_notices();
        ?>
		</div>

		<?php 
        echo $after_widget;
    }
    /**
     * Render the widget.
     *
     * @see WP_Widget::widget() for a description of parameters.
     *
     * @param array $args     See {@WP_Widget::widget()}.
     * @param array $instance See {@WP_Widget::widget()}.
     */
    public function widget($args, $instance)
    {
        if (!is_user_logged_in()) {
            return;
        }
        // Don't display the widget if there are no Notices to show
        $notices = BP_Messages_Notice::get_active();
        if (empty($notices)) {
            return;
        }
        extract($args);
        $title = !empty($instance['title']) ? $instance['title'] : '';
        /**
         * Filters the title of the Messages 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 $before_widget;
        echo $before_title . $title . $after_title;
        ?>

		<div class="bp-site-wide-message">
			<?php 
        bp_message_get_notices();
        ?>
		</div>

		<?php 
        echo $after_widget;
    }
function shortcode_bp_notices($atts, $content = null)
{
    if (bp_plugin_is_active()) {
        if (function_exists('bp_message_get_notices') && is_user_logged_in()) {
            // turn on output buffering to capture output
            ob_start();
            // output the notice (stupid BP echo's and no option for return)
            bp_message_get_notices();
            /* Site wide notices to all users */
            // get ouwtput content
            $content = ob_get_clean();
            // return the content
            return '<div class="bp-notices">' . $content . '</div>';
        }
    }
}
</a>

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

		<?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');
    ?>

		<p id="login-text">
Example #5
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 
    }
}
 /**
  * Outputs sitewide notices markup in the footer.
  *
  * @since BuddyPress (1.7)
  *
  * @see https://buddypress.trac.wordpress.org/ticket/4802
  */
 public function sitewide_notices()
 {
     // Do not show notices if user is not logged in
     if (!is_user_logged_in()) {
         return;
     }
     // add a class to determine if the admin bar is on or not
     $class = did_action('admin_bar_menu') ? 'admin-bar-on' : 'admin-bar-off';
     echo '<div id="sitewide-notice" class="' . $class . '">';
     bp_message_get_notices();
     echo '</div>';
 }
    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;
    }
Example #8
0
    /**
     * Add wrapper around message notices
     */
    public function message_notices()
    {
        // render notification box
        ?>
		<div class="top-notification-box">
			<?php 
        if (is_user_logged_in() && bp_is_active('messages')) {
            bp_message_get_notices();
        }
        ?>
		</div><?php 
    }
Example #9
0
		<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', 'buddypress' ) ?></a>

			<?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 />