function bp_adminbar_account_menu() { global $bp; if (!$bp->bp_nav || !is_user_logged_in()) { return false; } echo '<li id="bp-adminbar-account-menu"><a href="' . bp_loggedin_user_domain() . '">'; echo __('My Account', 'buddypress') . '</a>'; echo '<ul>'; // Loop through each navigation item $counter = 0; foreach ((array) $bp->bp_nav as $nav_item) { $alt = 0 == $counter % 2 ? ' class="alt"' : ''; if (-1 == $nav_item['position']) { continue; } echo '<li' . $alt . '>'; echo '<a id="bp-admin-' . $nav_item['css_id'] . '" href="' . $nav_item['link'] . '">' . $nav_item['name'] . '</a>'; if (isset($bp->bp_options_nav[$nav_item['slug']]) && is_array($bp->bp_options_nav[$nav_item['slug']])) { echo '<ul>'; $sub_counter = 0; foreach ((array) $bp->bp_options_nav[$nav_item['slug']] as $subnav_item) { $link = $subnav_item['link']; $name = $subnav_item['name']; if (isset($bp->displayed_user->domain)) { $link = str_replace($bp->displayed_user->domain, $bp->loggedin_user->domain, $subnav_item['link']); } if (isset($bp->displayed_user->userdata->user_login)) { $name = str_replace($bp->displayed_user->userdata->user_login, $bp->loggedin_user->userdata->user_login, $subnav_item['name']); } $alt = 0 == $sub_counter % 2 ? ' class="alt"' : ''; echo '<li' . $alt . '><a id="bp-admin-' . $subnav_item['css_id'] . '" href="' . $link . '">' . $name . '</a></li>'; $sub_counter++; } echo '</ul>'; } echo '</li>'; $counter++; } $alt = 0 == $counter % 2 ? ' class="alt"' : ''; echo '<li' . $alt . '><a id="bp-admin-logout" class="logout" href="' . nxt_logout_url(home_url()) . '">' . __('Log Out', 'buddypress') . '</a></li>'; echo '</ul>'; echo '</li>'; }
} ?> <br> <div class="login"> <?php if (is_user_logged_in()) { ?> <?php global $current_user, $bp; get_currentuserinfo(); ?> <div class="fields"><p><?php printf(__('<br><h4>Welcome %s', 'woothemes'), '<a href="' . $bp->loggedin_user->domain . '">' . $bp->loggedin_user->fullname . '</a>'); ?> . <a href="<?php echo nxt_logout_url(); ?> "><?php _e('Logout', 'woothemes'); ?> </a></h4></p></div> <?php } else { ?> <div class="fields"> <form action="<?php echo site_url(); ?> /nxt-login.php" method="post"> <input type="text" class="user-login" name="log" placeholder="<?php _e('Username', 'woothemes');
/** * Add the "My Account" submenu items. * * @since 3.1.0 */ function nxt_admin_bar_my_account_menu($nxt_admin_bar) { $user_id = get_current_user_id(); $current_user = nxt_get_current_user(); $profile_url = get_edit_profile_url($user_id); if (!$user_id) { return; } $nxt_admin_bar->add_group(array('parent' => 'my-account', 'id' => 'user-actions')); $user_info = get_avatar($user_id, 64); $user_info .= "<span class='display-name'>{$current_user->display_name}</span>"; if ($current_user->display_name !== $current_user->user_nicename) { $user_info .= "<span class='username'>{$current_user->user_nicename}</span>"; } $nxt_admin_bar->add_menu(array('parent' => 'user-actions', 'id' => 'user-info', 'title' => $user_info, 'href' => $profile_url, 'meta' => array('tabindex' => -1))); $nxt_admin_bar->add_menu(array('parent' => 'user-actions', 'id' => 'edit-profile', 'title' => __('Edit My Profile'), 'href' => $profile_url)); $nxt_admin_bar->add_menu(array('parent' => 'user-actions', 'id' => 'logout', 'title' => __('Log Out'), 'href' => nxt_logout_url())); }
/** * Generate a link to log out. Last used in BP 1.2-beta. You should be using nxt_logout_url(). * * @deprecated 1.5 * @deprecated Use nxt_logout_url() * @since 1.0 */ function bp_log_out_link() { _deprecated_function(__FUNCTION__, '1.5', 'nxt_logout_url()'); $logout_link = '<a href="' . nxt_logout_url(bp_get_root_domain()) . '">' . __('Log Out', 'buddypress') . '</a>'; echo apply_filters('bp_logout_link', $logout_link); }
function widget($args, $instance) { //Get args and output the title extract($args); echo $before_widget; $title = apply_filters('widget_title', $instance['title']); if ($title) { echo $before_title . $title . $after_title; } //If logged in, show "Welcome, User!" if (is_user_logged_in()) { ?> <div style='text-align:center'> <?php $userdata = nxt_get_current_user(); echo __('Welcome') . ', ' . $userdata->display_name; ?> !<br /> <small> <a href="<?php echo get_option('siteurl'); ?> /nxt-admin/profile.php"><?php _e("Edit Profile"); ?> </a> | <a href=" <?php echo nxt_logout_url($_SERVER['REQUEST_URI']); ?> "><?php _e("Logout"); ?> </a> </small> </div> <?php //Otherwise, show the login form (with Facebook Connect button) } else { ?> <form name='loginform' id='loginform' action='<?php echo get_option('siteurl'); ?> /nxt-login.php' method='post'> <label>User:</label><br /> <input type='text' name='log' id='user_login' class='input' tabindex='20' /><input type='submit' name='nxt-submit' id='nxt-submit' value='Login' tabindex='23' /><br /> <label>Pass:</label><br /> <input type='password' name='pwd' id='user_pass' class='input' tabindex='21' /> <span id="forgotText"><a href="<?php echo get_option('siteurl'); ?> /nxt-login.php?action=lostpassword" rel="nofollow" ><?php _e('Forgot'); ?> ?</a></span><br /> <?php //echo "<input name='rememberme' type='hidden' id='rememberme' value='forever' />"; ?> <?php echo nxt_register('', ''); ?> <input type='hidden' name='redirect_to' value='<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?> ' /> </form> <?php global $opt_jfb_hide_button; if (!get_option($opt_jfb_hide_button)) { jfb_output_facebook_btn(); //jfb_output_facebook_init(); This is output in nxt_footer as of 1.5.4 //jfb_output_facebook_callback(); This is output in nxt_footer as of 1.9.0 } } echo $after_widget; }
/** * Uses the $bp->bp_nav global to render out the navigation within a BuddyPress install. * Each component adds to this navigation array within its own [component_name]setup_nav() function. * * This navigation array is the top level navigation, so it contains items such as: * [Blog, Profile, Messages, Groups, Friends] ... * * The function will also analyze the current component the user is in, to determine whether * or not to highlight a particular nav item. * * @package BuddyPress Core * @todo Move to a back-compat file? * @deprecated Does not seem to be called anywhere in the core * @global object $bp Global BuddyPress settings object */ function bp_get_loggedin_user_nav() { global $bp; // Loop through each navigation item foreach ((array) $bp->bp_nav as $nav_item) { // If the current component matches the nav item id, then add a highlight CSS class. if (!bp_is_directory() && $bp->active_components[$bp->current_component] == $nav_item['css_id']) { $selected = ' class="current selected"'; } else { $selected = ''; } /* If we are viewing another person (current_userid does not equal loggedin_user->id) then check to see if the two users are friends. if they are, add a highlight CSS class to the friends nav item if it exists. */ if (!bp_is_my_profile() && $bp->displayed_user->id) { $selected = ''; if (bp_is_active('friends')) { if ($nav_item['css_id'] == $bp->friends->id) { if (friends_check_friendship($bp->loggedin_user->id, $bp->displayed_user->id)) { $selected = ' class="current selected"'; } } } } // echo out the final list item echo apply_filters_ref_array('bp_get_loggedin_user_nav_' . $nav_item['css_id'], array('<li id="li-nav-' . $nav_item['css_id'] . '" ' . $selected . '><a id="my-' . $nav_item['css_id'] . '" href="' . $nav_item['link'] . '">' . $nav_item['name'] . '</a></li>', &$nav_item)); } // Always add a log out list item to the end of the navigation $logout_link = '<li><a id="nxt-logout" href="' . nxt_logout_url(bp_get_root_domain()) . '">' . __('Log Out', 'buddypress') . '</a></li>'; echo apply_filters('bp_logout_nav_link', $logout_link); }
/** * Display "Are You Sure" message to confirm the action being taken. * * If the action has the nonce explain message, then it will be displayed along * with the "Are you sure?" message. * * @package NXTClass * @subpackage Security * @since 2.0.4 * * @param string $action The nonce action. */ function nxt_nonce_ays($action) { $title = __('NXTClass Failure Notice'); $html = esc_html(nxt_explain_nonce($action)); if ('log-out' == $action) { $html .= "</p><p>" . sprintf(__("Do you really want to <a href='%s'>log out</a>?"), nxt_logout_url()); } elseif (nxt_get_referer()) { $html .= "</p><p><a href='" . esc_url(remove_query_arg('updated', nxt_get_referer())) . "'>" . __('Please try again.') . "</a>"; } nxt_die($html, $title, array('response' => 403)); }
?> <form action="<?php echo get_option('siteurl'); ?> /nxt-comments-post.php" method="post" id="commentform"> <?php if (is_user_logged_in()) { ?> <p><?php printf(__('Logged in as <a href="%1$s">%2$s</a>.'), get_option('siteurl') . '/nxt-admin/profile.php', $user_identity); ?> <a href="<?php echo nxt_logout_url(get_permalink()); ?> " title="<?php esc_attr_e('Log out of this account'); ?> "><?php _e('Log out »'); ?> </a></p> <?php } else { ?> <p><input type="text" name="author" id="author" value="<?php echo esc_attr($comment_author);
/** * Make sure the logout link is at the bottom of the "My Account" menu * * @since BuddyPress (r4151) * * @global obj $bp * @global obj $nxt_admin_bar */ function bp_members_admin_bar_my_account_logout() { global $bp, $nxt_admin_bar; // Bail if this is an ajax request if (defined('DOING_AJAX')) { return; } if (is_user_logged_in()) { // Log out $nxt_admin_bar->add_menu(array('parent' => $bp->my_account_menu_id, 'id' => $bp->my_account_menu_id . '-logout', 'title' => __('Log Out', 'buddypress'), 'href' => nxt_logout_url())); } }
/** * Display the Log In/Out link. * * Displays a link, which allows users to navigate to the Log In page to log in * or log out depending on whether they are currently logged in. * * @since 1.5.0 * @uses apply_filters() Calls 'loginout' hook on HTML link content. * * @param string $redirect Optional path to redirect to on login/logout. * @param boolean $echo Default to echo and not return the link. */ function nxt_loginout($redirect = '', $echo = true) { if (!is_user_logged_in()) { $link = '<a href="' . esc_url(nxt_login_url($redirect)) . '">' . __('Log in') . '</a>'; } else { $link = '<a href="' . esc_url(nxt_logout_url($redirect)) . '">' . __('Log out') . '</a>'; } if ($echo) { echo apply_filters('loginout', $link); } else { return apply_filters('loginout', $link); } }
<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 nxt_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'); ?>
// this is displayed if there are no comments so far ?> <?php if (comments_open()) { ?> <!-- If comments are open, but there are no comments. --> <?php } else { // comments are closed ?> <!-- If comments are closed. --> <?php } } ?> <?php add_action('comment_form', 'huddle_comment_submit_btn'); function huddle_comment_submit_btn($post_id) { ?> <p><button><?php _e('Submit Comment <span>→</span>', 'huddle'); ?> </button></p> <?php } global $aria_req; comment_form(array('comment_field' => '<textarea name="comment" id="comment" tabindex="4" rows="7" cols="10"></textarea><label for="comment"></label><br><br>', 'comment_notes_before' => '', 'comment_notes_after' => '', 'logged_in_as' => '<p class="logged-in-as">' . sprintf(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>'), admin_url('profile.php'), $user_identity, nxt_logout_url(apply_filters('the_permalink', get_permalink($post->ID)))) . '</p><br />', 'title_reply' => __('Add Your Comment', 'huddle'), 'title_reply_to' => __('Add Your Comment', 'huddle'), 'cancel_reply_link' => __('Cancel Reply To Comment →', 'huddle'), 'label_submit' => __('Submit Comment →', 'huddle'), 'id_submit' => 'comment-submit', 'fields' => array('author' => '<input id="author" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" placeholder="' . __('Name', 'huddle') . '" ' . $aria_req . ' />' . '' . ($req ? '<span class="required"><span>*</span> ' . __('Required', 'huddle') . '</span>' : '') . '<br><br>', 'email' => '<input id="email" name="email" type="text" value="' . esc_attr($commenter['comment_author_email']) . '" placeholder="' . __('Email', 'huddle') . '" ' . $aria_req . ' />' . '' . ($req ? '<span class="required"><span>*</span> ' . __('Required', 'huddle') . '</span>' : '') . '<br><br>', 'url' => '<input id="url" name="url" type="text" value="' . esc_attr($commenter['comment_author_url']) . '" placeholder="' . __('Website', 'huddle') . '" />' . '<br><br>')));
/** * Outputs a complete commenting form for use within a template. * Most strings and form fields may be controlled through the $args array passed * into the function, while you may also choose to use the comment_form_default_fields * filter to modify the array of default fields if you'd just like to add a new * one or remove a single field. All fields are also individually passed through * a filter of the form comment_form_field_$name where $name is the key used * in the array of fields. * * @since 3.0.0 * @param array $args Options for strings, fields etc in the form * @param mixed $post_id Post ID to generate the form for, uses the current post if null * @return void */ function comment_form($args = array(), $post_id = null) { global $id; if (null === $post_id) { $post_id = $id; } else { $id = $post_id; } $commenter = nxt_get_current_commenter(); $user = nxt_get_current_user(); $user_identity = !empty($user->ID) ? $user->display_name : ''; $req = get_option('require_name_email'); $aria_req = $req ? " aria-required='true'" : ''; $fields = array('author' => '<p class="comment-form-author">' . '<label for="author">' . __('Name') . '</label> ' . ($req ? '<span class="required">*</span>' : '') . '<input id="author" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $aria_req . ' /></p>', 'email' => '<p class="comment-form-email"><label for="email">' . __('Email') . '</label> ' . ($req ? '<span class="required">*</span>' : '') . '<input id="email" name="email" type="text" value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $aria_req . ' /></p>', 'url' => '<p class="comment-form-url"><label for="url">' . __('Website') . '</label>' . '<input id="url" name="url" type="text" value="' . esc_attr($commenter['comment_author_url']) . '" size="30" /></p>'); $required_text = sprintf(' ' . __('Required fields are marked %s'), '<span class="required">*</span>'); $defaults = array('fields' => apply_filters('comment_form_default_fields', $fields), 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x('Comment', 'noun') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>', 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.'), nxt_login_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'logged_in_as' => '<p class="logged-in-as">' . sprintf(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>'), admin_url('profile.php'), $user_identity, nxt_logout_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'comment_notes_before' => '<p class="comment-notes">' . __('Your email address will not be published.') . ($req ? $required_text : '') . '</p>', 'comment_notes_after' => '<p class="form-allowed-tags">' . sprintf(__('You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s'), ' <code>' . allowed_tags() . '</code>') . '</p>', 'id_form' => 'commentform', 'id_submit' => 'submit', 'title_reply' => __('Leave a Reply'), 'title_reply_to' => __('Leave a Reply to %s'), 'cancel_reply_link' => __('Cancel reply'), 'label_submit' => __('Post Comment')); $args = nxt_parse_args($args, apply_filters('comment_form_defaults', $defaults)); ?> <?php if (comments_open()) { ?> <?php do_action('comment_form_before'); ?> <div id="respond"> <h3 id="reply-title"><?php comment_form_title($args['title_reply'], $args['title_reply_to']); ?> <small><?php cancel_comment_reply_link($args['cancel_reply_link']); ?> </small></h3> <?php if (get_option('comment_registration') && !is_user_logged_in()) { ?> <?php echo $args['must_log_in']; ?> <?php do_action('comment_form_must_log_in_after'); ?> <?php } else { ?> <form action="<?php echo site_url('/nxt-comments-post.php'); ?> " method="post" id="<?php echo esc_attr($args['id_form']); ?> "> <?php do_action('comment_form_top'); ?> <?php if (is_user_logged_in()) { ?> <?php echo apply_filters('comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity); ?> <?php do_action('comment_form_logged_in_after', $commenter, $user_identity); ?> <?php } else { ?> <?php echo $args['comment_notes_before']; ?> <?php do_action('comment_form_before_fields'); foreach ((array) $args['fields'] as $name => $field) { echo apply_filters("comment_form_field_{$name}", $field) . "\n"; } do_action('comment_form_after_fields'); ?> <?php } ?> <?php echo apply_filters('comment_form_field_comment', $args['comment_field']); ?> <?php echo $args['comment_notes_after']; ?> <p class="form-submit"> <input name="submit" type="submit" id="<?php echo esc_attr($args['id_submit']); ?> " value="<?php echo esc_attr($args['label_submit']); ?> " /> <?php comment_id_fields($post_id); ?> </p> <?php do_action('comment_form', $post_id); ?> </form> <?php } ?> </div><!-- #respond --> <?php do_action('comment_form_after'); ?> <?php } else { ?> <?php do_action('comment_form_comments_closed'); ?> <?php } ?> <?php }