Example #1
0
		<?php 
            do_action('bp_before_group_send_invites_content');
            ?>
	<?php 
        }
    }
} else {
    // Begin BP 1.2 code
    ?>

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

	<?php 
    if (invite_anyone_access_test() && !bp_is_group_create()) {
        ?>
		<p><?php 
        _e('Want to invite someone to the group who is not yet a member of the site?', 'bp-invite-anyone');
        ?>
 <a href="<?php 
        echo bp_loggedin_user_domain() . BP_INVITE_ANYONE_SLUG . '/invite-new-members/group-invites/' . bp_get_group_id();
        ?>
"><?php 
        _e('Send invitations by email.', 'bp-invite-anyone');
        ?>
</a></p>
	<?php 
    }
    ?>
    /**
     * Markup for public widget.
     */
    function widget($args, $instance)
    {
        global $bp;
        extract($args);
        if (!($title = apply_filters('widget_title', $instance['title']))) {
            $title = __('Invite Anyone', 'invite-anyone');
        }
        if (!($instruction_text = esc_attr($instance['instruction_text']))) {
            $instruction_text = __('Enter one email address per line to invite friends to join this site.', 'invite-anyone');
        }
        ?>

		<?php 
        /* Non-logged-in and unauthorized users should not see the widget */
        ?>
		<?php 
        if (invite_anyone_access_test() && $bp->current_component != $bp->invite_anyone->slug) {
            ?>
		      <?php 
            echo $before_widget;
            ?>
			  <?php 
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            ?>

					<p><?php 
            echo $instruction_text;
            ?>
</p>

					<form class="standard-form" action="<?php 
            echo bp_loggedin_user_domain() . $bp->invite_anyone->slug;
            ?>
" method="post">

					<?php 
            invite_anyone_email_fields();
            ?>

					<?php 
            /* If we're on a group page, send the group_id as well */
            ?>
					<?php 
            if (bp_is_group()) {
                ?>
						<?php 
                global $bp;
                ?>
						<input type="hidden" name="invite_anyone_widget_group" id="invite_anyone_widget_group" value="<?php 
                echo $bp->groups->current_group->id;
                ?>
" />
					<?php 
            }
            ?>

					<input type="hidden" name="invite_anyone_widget" id="invite_anyone_widget" value="1" />

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

					<?php 
            wp_nonce_field('invite-anyone-widget_' . $bp->loggedin_user->id);
            ?>
					<p id="invite-anyone-widget-submit" >
						<input class="button" type="submit" value="<?php 
            _e('Continue', 'invite-anyone');
            ?>
" />
					</p>
					</form>

		      <?php 
            echo $after_widget;
            ?>
		<?php 
        }
        ?>
		<?php 
    }
Example #3
0
function invite_anyone_create_screen_content($event)
{
    if (function_exists('bp_post_get_permalink')) {
        // ugly ugly ugly hack to check for pre-1.2 versions of BP
        add_action('wp_footer', 'invite_anyone_add_old_css');
        ?>

		<?php 
        if (bp_has_groups()) {
            while (bp_groups()) {
                bp_the_group();
                ?>

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

				<?php 
                if ($event != 'create') {
                    ?>
					<form action="<?php 
                    bp_group_send_invite_form_action();
                    ?>
" method="post" id="send-invite-form">
				<?php 
                }
                ?>

					<div class="left-menu">

						<p><?php 
                _e("Search for members to invite:", 'bp-invite-anyone');
                ?>
 &nbsp; <span class="ajax-loader"></span></p>

						<ul class="first acfb-holder">
							<li>
								<input type="text" name="send-to-input" class="send-to-input" id="send-to-input" />
							</li>
						</ul>

						<p><?php 
                _e('Select members from the directory:', 'bp-invite-anyone');
                ?>
 <span class="ajax-loader"></span></p>

						<div id="invite-anyone-member-list">
							<ul>
								<?php 
                bp_new_group_invite_member_list();
                ?>
							</ul>

							<?php 
                wp_nonce_field('groups_invite_uninvite_user', '_wpnonce_invite_uninvite_user');
                ?>
						</div>

					</div>

					<div class="main-column">

						<div id="message" class="info">
							<p><?php 
                _e('Select people to invite.', 'bp-invite-anyone');
                ?>
</p>
						</div>

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

						<?php 
                /* The ID 'friend-list' is important for AJAX support. */
                ?>
						<ul id="invite-anyone-invite-list" class="item-list">
						<?php 
                if (bp_group_has_invites()) {
                    ?>

							<?php 
                    while (bp_group_invites()) {
                        bp_group_the_invite();
                        ?>

								<li id="<?php 
                        bp_group_invite_item_id();
                        ?>
">
									<?php 
                        bp_group_invite_user_avatar();
                        ?>

									<h4><?php 
                        bp_group_invite_user_link();
                        ?>
</h4>
									<span class="activity"><?php 
                        bp_group_invite_user_last_active();
                        ?>
</span>

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

									<div class="action">
										<a class="remove" href="<?php 
                        bp_group_invite_user_remove_invite_url();
                        ?>
" id="<?php 
                        bp_group_invite_item_id();
                        ?>
"><?php 
                        _e('Remove Invite', 'buddypress');
                        ?>
</a>

										<?php 
                        do_action('bp_group_send_invites_item_action');
                        ?>
									</div>
								</li>

							<?php 
                    }
                    ?>
						<?php 
                }
                ?>
						</ul>

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

					</div>

					<div class="clear"></div>

				<?php 
                if ($event != 'create') {
                    ?>
					<p class="clear"><input type="submit" name="submit" id="submit" value="<?php 
                    _e('Send Invites', 'buddypress');
                    ?>
" /></p>
					<?php 
                    wp_nonce_field('groups_send_invites', '_wpnonce_send_invites');
                    ?>
				<?php 
                }
                ?>



					<input type="hidden" name="group_id" id="group_id" value="<?php 
                bp_group_id();
                ?>
" />
				<?php 
                if ($event != 'create') {
                    ?>
					</form>
				<?php 
                }
                ?>


			<?php 
                do_action('bp_before_group_send_invites_content');
                ?>
	<?php 
            }
        }
    } else {
        // Begin BP 1.2 code
        ?>
	<?php 
        do_action('bp_before_group_send_invites_content');
        ?>

	<?php 
        if (invite_anyone_access_test() && !bp_is_group_create()) {
            ?>
		<p><?php 
            _e('Want to invite someone to the group who is not yet a member of the site?', 'bp-invite-anyone');
            ?>
 <a href="<?php 
            echo bp_loggedin_user_domain() . BP_INVITE_ANYONE_SLUG . '/invite-new-members/group-invites/' . bp_get_group_id();
            ?>
"><?php 
            _e('Send invitations by email.', 'bp-invite-anyone');
            ?>
</a></p>
	<?php 
        }
        ?>

	<?php 
        if ($event != 'create') {
            ?>
			<form action="send" method="post" id="send-invite-form">
	<?php 
        }
        ?>



		<div class="left-menu">
					<p><?php 
        _e("Search for members to invite:", 'bp-invite-anyone');
        ?>
 &nbsp; <span class="ajax-loader"></span></p>

					<ul class="first acfb-holder">
						<li>
							<input type="text" name="send-to-input" class="send-to-input" id="send-to-input" />
						</li>
					</ul>

					<p><?php 
        _e('Select members from the directory:', 'bp-invite-anyone');
        ?>
 <span class="ajax-loader"></span></p>

					<div id="invite-anyone-member-list">
						<ul>
							<?php 
        bp_new_group_invite_member_list();
        ?>
						</ul>

						<?php 
        wp_nonce_field('groups_invite_uninvite_user', '_wpnonce_invite_uninvite_user');
        ?>
					</div>



		</div>

		<div class="main-column">

			<div id="message" class="info">
				<p><?php 
        _e('Select people to invite from your friends list.', 'buddypress');
        ?>
</p>
			</div>

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

			<?php 
        /* The ID 'friend-list' is important for AJAX support. */
        ?>
			<ul id="invite-anyone-invite-list" class="item-list">
			<?php 
        if (bp_group_has_invites()) {
            ?>

				<?php 
            while (bp_group_invites()) {
                bp_group_the_invite();
                ?>

					<li id="<?php 
                bp_group_invite_item_id();
                ?>
">
						<?php 
                bp_group_invite_user_avatar();
                ?>

						<h4><?php 
                bp_group_invite_user_link();
                ?>
</h4>
						<span class="activity"><?php 
                bp_group_invite_user_last_active();
                ?>
</span>

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

						<div class="action">
							<a class="remove" href="<?php 
                bp_group_invite_user_remove_invite_url();
                ?>
" id="<?php 
                bp_group_invite_item_id();
                ?>
"><?php 
                _e('Remove Invite', 'buddypress');
                ?>
</a>

							<?php 
                do_action('bp_group_send_invites_item_action');
                ?>
						</div>
					</li>

				<?php 
            }
            ?>

			<?php 
        }
        ?>
			</ul>

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

		</div>

		<div class="clear"></div>

		<?php 
        if ($event != 'create') {
            ?>
		<div class="submit">
			<input type="submit" name="submit" id="submit" value="<?php 
            _e('Send Invites', 'buddypress');
            ?>
" />
		</div>
		<?php 
        }
        ?>

		<?php 
        wp_nonce_field('groups_send_invites', '_wpnonce_send_invites');
        ?>

		<!-- Don't leave out this sweet field -->
			<?php 
        if (!bp_get_new_group_id()) {
            ?>
<input type="hidden" name="group_id" id="group_id" value="<?php 
            bp_group_id();
            ?>
" /><?php 
        } else {
            ?>
<input type="hidden" name="group_id" id="group_id" value="<?php 
            bp_new_group_id();
            ?>
" /><?php 
        }
        ?>

	<?php 
        if ($event != 'create') {
            ?>





		</form>
	<?php 
        }
        ?>

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



	<?php 
    }
}
Example #4
0
function invite_anyone_setup_nav()
{
    global $bp;
    if (!invite_anyone_access_test()) {
        return;
    }
    /* Add 'Send Invites' to the main user profile navigation */
    bp_core_new_nav_item(array('name' => __('Send Invites', 'buddypress'), 'slug' => $bp->invite_anyone->slug, 'position' => 80, 'screen_function' => 'invite_anyone_screen_one', 'default_subnav_slug' => 'invite-new-members', 'show_for_displayed_user' => invite_anyone_access_test()));
    $invite_anyone_link = $bp->loggedin_user->domain . $bp->invite_anyone->slug . '/';
    /* Create two sub nav items for this component */
    bp_core_new_subnav_item(array('name' => __('Invite New Members', 'invite-anyone'), 'slug' => 'invite-new-members', 'parent_slug' => $bp->invite_anyone->slug, 'parent_url' => $invite_anyone_link, 'screen_function' => 'invite_anyone_screen_one', 'position' => 10, 'user_has_access' => invite_anyone_access_test()));
    bp_core_new_subnav_item(array('name' => __('Sent Invites', 'invite-anyone'), 'slug' => 'sent-invites', 'parent_slug' => $bp->invite_anyone->slug, 'parent_url' => $invite_anyone_link, 'screen_function' => 'invite_anyone_screen_two', 'position' => 20, 'user_has_access' => invite_anyone_access_test()));
}
Example #5
0
    /** @see WP_Widget::widget */
    function widget($args, $instance)
    {
        global $bp;
        extract($args);
        if (!($title = apply_filters('widget_title', $instance['title']))) {
            $title = __('Invite Anyone', 'bp-invite-anyone');
        }
        if (!($email_fields = $instance['email_fields'])) {
            $email_fields = 3;
        }
        if (!($instruction_text = esc_attr($instance['instruction_text']))) {
            $instruction_text = __('Invite friends to join the site by entering their email addresses below.', 'bp-invite-anyone');
        }
        ?>
        
        <?php 
        /* Non-logged-in and unauthorized users should not see the widget */
        ?>
        <?php 
        if (invite_anyone_access_test() && $bp->current_component != $bp->invite_anyone->slug) {
            ?>
              <?php 
            echo $before_widget;
            ?>
                  <?php 
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            ?>
					
					<p><?php 
            echo $instruction_text;
            ?>
</p>
					
					<form class="standard-form" action="<?php 
            echo bp_loggedin_user_domain() . $bp->invite_anyone->slug;
            ?>
" method="post">
					
					<?php 
            if ($email_fields) {
                ?>
						<ul class="invite-anyone-widget-email-fields">
						<?php 
                for ($i = 0; $i < $email_fields; $i++) {
                    ?>
							<li>							
							<input type="text" name="emails[<?php 
                    echo $i;
                    ?>
]" value="<?php 
                    _e('email address', 'bp-invite-anyone');
                    ?>
" onfocus="if (this.value == '<?php 
                    _e('email address', 'bp-invite-anyone');
                    ?>
' ) { this.value = ''; }" />						
							</li>
						<?php 
                }
                ?>
						</ul>
					<?php 
            }
            ?>
					
					<?php 
            /* If we're on a group page, send the group_id as well */
            ?>
					<?php 
            if (bp_is_group()) {
                ?>
						<?php 
                global $bp;
                ?>
						<input type="hidden" name="invite_anyone_widget_group" id="invite_anyone_widget_group" value="<?php 
                echo $bp->groups->current_group->id;
                ?>
" />
					<?php 
            }
            ?>
					
					<input type="hidden" name="invite_anyone_widget" id="invite_anyone_widget" value="1" />
					
					<?php 
            wp_nonce_field('invite-anyone-widget_' . $bp->loggedin_user->id);
            ?>
 
					<p id="invite-anyone-widget-submit" >
						<input class="button" type="submit" value="<?php 
            _e('Continue', 'bp-invite-anyone');
            ?>
" />
					</p>
					</form>
					
              <?php 
            echo $after_widget;
            ?>
        <?php 
        }
        ?>
        <?php 
    }