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, $nxt_admin_bar;
    // Bail if this is an ajax request
    if (defined('DOING_AJAX')) {
        return;
    }
    // Logged in user
    if (is_user_logged_in()) {
        if ('3.2' == bp_get_major_nxt_version()) {
            // 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
            $nxt_admin_bar->add_menu(array('id' => $bp->my_account_menu_id, 'title' => $avatar . bp_get_loggedin_user_fullname(), 'href' => $bp->loggedin_user->domain));
        } else {
            // Unique ID for the 'My Account' menu
            $bp->my_account_menu_id = 'my-account-buddypress';
            // Create the main 'My Account' menu
            $nxt_admin_bar->add_menu(array('parent' => 'my-account', 'id' => $bp->my_account_menu_id, 'href' => $bp->loggedin_user->domain, 'group' => true, 'meta' => array('class' => 'ab-sub-secondary')));
        }
        // Show login and sign-up links
    } elseif (!empty($nxt_admin_bar)) {
        add_filter('show_admin_bar', '__return_true');
        // Create the main 'My Account' menu
        $nxt_admin_bar->add_menu(array('id' => 'bp-login', 'title' => __('Log in', 'buddypress'), 'href' => nxt_login_url()));
        // Sign up
        if (bp_get_signup_allowed()) {
            $nxt_admin_bar->add_menu(array('id' => 'bp-register', 'title' => __('Register', 'buddypress'), 'href' => bp_get_signup_page()));
        }
    }
}
/**
 * Redirects a user to login for BP pages that require access control and adds an error message (if
 * one is provided).
 * If authenticated, redirects user back to requested content by default.
 *
 * @package BuddyPress Core
 * @since 1.5
 */
function bp_core_no_access($args = '')
{
    global $bp;
    $defaults = array('mode' => '1', 'message' => __('You must log in to access the page you requested.', 'buddypress'), 'redirect' => nxt_guess_url(), 'root' => $bp->root_domain);
    $r = nxt_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    // Apply filters to these variables
    $mode = apply_filters('bp_no_access_mode', $mode, $root, $redirect, $message);
    $redirect = apply_filters('bp_no_access_redirect', $redirect, $root, $message, $mode);
    $root = trailingslashit(apply_filters('bp_no_access_root', $root, $redirect, $message, $mode));
    $message = apply_filters('bp_no_access_message', $message, $root, $redirect, $mode);
    switch ($mode) {
        // Option to redirect to nxt-login.php
        // Error message is displayed with bp_core_no_access_nxt_login_error()
        case 2:
            if ($redirect) {
                bp_core_redirect(nxt_login_url($redirect) . '&action=bpnoaccess');
            } else {
                bp_core_redirect($root);
            }
            break;
            // Redirect to root with "redirect_to" parameter
            // Error message is displayed with bp_core_add_message()
        // Redirect to root with "redirect_to" parameter
        // Error message is displayed with bp_core_add_message()
        case 1:
        default:
            if ($redirect) {
                $url = add_query_arg('redirect_to', urlencode($redirect), $root);
            } else {
                $url = $root;
            }
            if ($message) {
                bp_core_add_message($message, 'error');
            }
            bp_core_redirect($url);
            break;
    }
}
Esempio n. 3
0
 function nxtw_nope($content)
 {
     global $post;
     $content = $this->get_content($content);
     $message = __('This page is a Wiki!');
     $message .= '&nbsp;<a href="' . nxt_login_url(get_permalink($post->ID)) . '">' . __('Log in or register an account to edit.') . '</a>';
     return $content . $message;
 }
Esempio n. 4
0
 /**
  * Applies BuddyPress customisations to the post comment form.
  *
  * @global string $user_identity The display name of the user
  * @param array $default_labels The default options for strings, fields etc in the form
  * @see comment_form()
  * @since 1.5
  */
 function bp_dtheme_comment_form($default_labels)
 {
     global $user_identity;
     $commenter = nxt_get_current_commenter();
     $req = get_option('require_name_email');
     $aria_req = $req ? " aria-required='true'" : '';
     $fields = array('author' => '<p class="comment-form-author">' . '<label for="author">' . __('Name', 'buddypress') . ($req ? '<span class="required"> *</span>' : '') . '</label> ' . '<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', 'buddypress') . ($req ? '<span class="required"> *</span>' : '') . '</label> ' . '<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', 'buddypress') . '</label>' . '<input id="url" name="url" type="text" value="' . esc_attr($commenter['comment_author_url']) . '" size="30" /></p>');
     $new_labels = array('comment_field' => '<p class="form-textarea"><textarea name="comment" id="comment" cols="60" rows="10" aria-required="true"></textarea></p>', 'fields' => apply_filters('comment_form_default_fields', $fields), 'logged_in_as' => '', 'must_log_in' => '<p class="alert">' . sprintf(__('You must be <a href="%1$s">logged in</a> to post a comment.', 'buddypress'), nxt_login_url(get_permalink())) . '</p>', 'title_reply' => __('Leave a reply', 'buddypress'));
     return apply_filters('bp_dtheme_comment_form', array_merge($default_labels, $new_labels));
 }
Esempio n. 5
0
    comment_form_title(__('Leave a Reply'), __('Leave a Reply to %s'));
    ?>
</h3>

<div id="cancel-comment-reply">
	<small><?php 
    cancel_comment_reply_link();
    ?>
</small>
</div>

<?php 
    if (get_option('comment_registration') && !is_user_logged_in()) {
        ?>
<p><?php 
        printf(__('You must be <a href="%s">logged in</a> to post a comment.'), nxt_login_url(get_permalink()));
        ?>
</p>
<?php 
    } else {
        ?>

<form action="<?php 
        echo get_option('siteurl');
        ?>
/nxt-comments-post.php" method="post" id="commentform">

<?php 
        if (is_user_logged_in()) {
            ?>
Esempio n. 6
0
 define('DOING_AUTOSAVE', true);
 $nonce_age = check_ajax_referer('autosave', 'autosavenonce');
 $_POST['post_category'] = explode(",", $_POST['catslist']);
 if ($_POST['post_type'] == 'page' || empty($_POST['post_category'])) {
     unset($_POST['post_category']);
 }
 $do_autosave = (bool) $_POST['autosave'];
 $do_lock = true;
 $data = $alert = '';
 /* translators: draft saved date format, see http://php.net/date */
 $draft_saved_date_format = __('g:i:s a');
 /* translators: %s: date and time */
 $message = sprintf(__('Draft saved at %s.'), date_i18n($draft_saved_date_format));
 $supplemental = array();
 if (isset($login_grace_period)) {
     $alert .= sprintf(__('Your login has expired. Please open a new browser window and <a href="%s" target="_blank">log in again</a>. '), add_query_arg('interim-login', 1, nxt_login_url()));
 }
 $id = $revision_id = 0;
 $post_ID = (int) $_POST['post_ID'];
 $_POST['ID'] = $post_ID;
 $post = get_post($post_ID);
 if ('auto-draft' == $post->post_status) {
     $_POST['post_status'] = 'draft';
 }
 if ($last = nxt_check_post_lock($post->ID)) {
     $do_autosave = $do_lock = false;
     $last_user = get_userdata($last);
     $last_user_name = $last_user ? $last_user->display_name : __('Someone');
     $data = __('Autosave disabled.');
     $supplemental['disable_autosave'] = 'disable';
     $alert .= sprintf(__('%s is currently editing this article. If you update it, you will overwrite the changes.'), esc_html($last_user_name));
Esempio n. 7
0
 /**
  * Notify the blog admin of a new user, normally via email.
  *
  * @since 2.0
  *
  * @param int $user_id User ID
  * @param string $plaintext_pass Optional. The user's plaintext password
  */
 function nxt_new_user_notification($user_id, $plaintext_pass = '')
 {
     $user = new nxt_User($user_id);
     $user_login = stripslashes($user->user_login);
     $user_email = stripslashes($user->user_email);
     // The blogname option is escaped with esc_html on the way into the database in sanitize_option
     // we want to reverse this for the plain text arena of emails.
     $blogname = nxt_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     $message = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n";
     $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
     $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
     @nxt_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
     if (empty($plaintext_pass)) {
         return;
     }
     $message = sprintf(__('Username: %s'), $user_login) . "\r\n";
     $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
     $message .= nxt_login_url() . "\r\n";
     nxt_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message);
 }
Esempio n. 8
0
/**
 * Notify a user that her account activation has been successful.
 *
 * Filter 'nxtmu_welcome_user_notification' to disable or bypass.
 *
 * Filter 'update_welcome_user_email' and 'update_welcome_user_subject' to
 * modify the content and subject line of the notification email.
 *
 * @since MU
 *
 * @param int $user_id
 * @param string $password
 * @param array $meta Optional. Not used in the default function, but is passed along to hooks for customization.
 * @return bool
 */
function nxtmu_welcome_user_notification($user_id, $password, $meta = '')
{
    global $current_site;
    if (!apply_filters('nxtmu_welcome_user_notification', $user_id, $password, $meta)) {
        return false;
    }
    $welcome_email = get_site_option('welcome_user_email');
    $user = new nxt_User($user_id);
    $welcome_email = apply_filters('update_welcome_user_email', $welcome_email, $user_id, $password, $meta);
    $welcome_email = str_replace('SITE_NAME', $current_site->site_name, $welcome_email);
    $welcome_email = str_replace('USERNAME', $user->user_login, $welcome_email);
    $welcome_email = str_replace('PASSWORD', $password, $welcome_email);
    $welcome_email = str_replace('LOGINLINK', nxt_login_url(), $welcome_email);
    $admin_email = get_site_option('admin_email');
    if ($admin_email == '') {
        $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
    }
    $from_name = get_site_option('site_name') == '' ? 'NXTClass' : esc_html(get_site_option('site_name'));
    $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    $message = $welcome_email;
    if (empty($current_site->site_name)) {
        $current_site->site_name = 'NXTClass';
    }
    $subject = apply_filters('update_welcome_user_subject', sprintf(__('New %1$s User: %2$s'), $current_site->site_name, $user->user_login));
    nxt_mail($user->user_email, $subject, $message, $message_headers);
    return true;
}
<form id="reg-form" action="<?php 
echo get_permalink();
?>
" method="post">
	<div class="formleft">
		<h2><?php 
_e('Step 1. Create a New Account', 'membership');
?>
</h2>
		<a title="Login »" href="<?php 
echo nxt_login_url(add_query_arg('action', 'page2', get_permalink()));
?>
" class="alignright" id="login_right"><?php 
_e('Already have a user account?', 'membership');
?>
</a>

		<p><label><?php 
_e('Choose a Username', 'membership');
?>
 <span>*</span></label>
		<input type="text" value="<?php 
echo esc_attr($_POST['user_login']);
?>
" class="regtext" name="user_login"></p>

		<div class="alignleft">
			<label><?php 
_e('Email Address', 'membership');
?>
 <span>*</span></label>
Esempio n. 10
0
/**
 * 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);
    }
}
Esempio n. 11
0
/**
 * 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 
}