Exemple #1
0
/**
 * bp_groupblog_options_nav()
 *
 * Manually create the navigation for the group since we can't fetch any other way.
 * You should manually add items if you have third party plugins that add a menu item.
 *
 * The BuddyPress function we duplicate is called bp_get_options_nav()
 */
function bp_groupblog_options_nav()
{
    global $bp;
    $checks = get_site_option('bp_groupblog_blog_defaults_options');
    ?>

	  <li id="home-personal-li"<?php 
    if ($checks['deep_group_integration']) {
        ?>
 class="current selected"<?php 
    }
    ?>
>
			<a id="home" href="<?php 
    bp_group_permalink();
    ?>
"><?php 
    _e('Home', 'groupblog');
    ?>
</a>
		</li>

    <?php 
    if (groups_is_user_admin($bp->loggedin_user->id, bp_get_group_id()) || groups_is_user_mod($bp->loggedin_user->id, bp_get_group_id())) {
        ?>
			<li id="admin-personal-li" >
				<a id="admin" href="<?php 
        bp_group_permalink();
        ?>
admin/"><?php 
        _e('Admin', 'groupblog');
        ?>
</a>
			</li>
		<?php 
    }
    ?>

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

			<?php 
        if (bp_groupblog_is_blog_enabled(bp_get_group_id())) {
            ?>
				<?php 
            if (!$checks['deep_group_integration']) {
                ?>
					<li id="<?php 
                echo BP_GROUPBLOG_SLUG;
                ?>
-personal-li"<?php 
                //if ( is_page() ) :
                ?>
 class="current selected"<?php 
                //endif;
                ?>
>
						<a id="<?php 
                echo BP_GROUPBLOG_SLUG;
                ?>
" href="<?php 
                bp_group_permalink();
                ?>
blog/"><?php 
                _e('Blog', 'groupblog');
                ?>
</a>
					</li>
				<?php 
            }
            ?>
		  <?php 
        }
        ?>

			<?php 
        if (bp_is_active('forums') && (function_exists('bp_forums_is_installed_correctly') && bp_group_is_forum_enabled() && !(int) bp_get_option('bp-disable-forum-directory')) && bp_forums_is_installed_correctly()) {
            ?>
				<li id="<?php 
            echo BP_FORUMS_SLUG;
            ?>
-personal-li" >
					<a id="<?php 
            echo BP_FORUMS_SLUG;
            ?>
" href="<?php 
            bp_group_permalink();
            ?>
forum/"><?php 
            _e('Forum', 'groupblog');
            ?>
</a>
				</li>
			<?php 
        }
        ?>

			<li id="<?php 
        echo BP_MEMBERS_SLUG;
        ?>
-personal-li" >
				<a id="<?php 
        echo BP_MEMBERS_SLUG;
        ?>
" href="<?php 
        bp_group_permalink();
        ?>
members/"><?php 
        _e('Members', 'groupblog');
        ?>
 (<?php 
        bp_group_total_members();
        ?>
)</a>
			</li>

			<li id="invite-personal-li" >
				<a id="invite" href="<?php 
        bp_group_permalink();
        ?>
send-invites/"><?php 
        _e('Send Invites', 'groupblog');
        ?>
</a>
			</li>

		<?php 
    } elseif (!bp_group_is_visible() && bp_get_group_status() != 'hidden') {
        ?>

			<li id="request-membership-personal-li" >
				<a id="request-membership" href="<?php 
        bp_group_permalink();
        ?>
request-membership/"><?php 
        _e('Request Membership', 'groupblog');
        ?>
</a>
			</li>

		<?php 
    }
    ?>

	<?php 
}
/**
 * bp_groupblog_signup_blog($blogname = '', $blog_title = '', $errors = '')
 *
 * This function is called from the template and initiates the blog creation.
 */
function bp_groupblog_signup_blog($blogname = '', $blog_title = '', $errors = '')
{
    global $current_user, $current_site, $groupblog_create_screen;
    global $bp, $filtered_results;
    if (!is_wp_error($errors)) {
        $errors = new WP_Error();
    }
    // allow definition of default variables
    $filtered_results = apply_filters('signup_blog_init', array('blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors));
    $blogname = $filtered_results['blogname'];
    $blog_title = $filtered_results['blog_title'];
    $errors = $filtered_results['errors'];
    if (!isset($groupblog_create_screen)) {
        $groupblog_create_screen = false;
    }
    // Get the group id, which is fetched differently depending on whether this is a group
    // Create or Edit screen
    $group_id = bp_is_group_create() ? bp_get_new_group_id() : bp_get_current_group_id();
    $disabled = !bp_groupblog_silent_add($group_id) || !bp_groupblog_is_blog_enabled($group_id) ? ' disabled="true" ' : '';
    if (!$groupblog_create_screen) {
        ?>
	<h2><?php 
        _e('Group Blog', 'groupblog');
        ?>
</h2>

	<form id="setupform" method="post" action="<?php 
        bp_groupblog_admin_form_action('group-blog');
        ?>
">
		<input type="hidden" name="stage" value="gimmeanotherblog" />
		<?php 
        do_action("signup_hidden_fields");
        ?>
	<?php 
    }
    ?>

		<div class="checkbox">
			<label><input type="checkbox" name="groupblog-enable-blog" id="groupblog-enable-blog" value="1"<?php 
    bp_groupblog_show_enabled($group_id);
    ?>
/> <?php 
    _e('Enable group blog', 'groupblog');
    ?>
</label>
		</div>

		<?php 
    bp_groupblog_show_blog_form($blogname, $blog_title, $errors);
    ?>

		<br />

		<div id="groupblog-member-options">

			<h3><?php 
    _e('Member Options', 'groupblog');
    ?>
</h3>

			<p><?php 
    _e('Enable blog posting to allow adding of group members to the blog with the roles set below.', 'groupblog');
    ?>
<br /><?php 
    _e('When disabled, all members will temporarily be set to subscribers, disabling posting.', 'groupblog');
    ?>
</p>

			<div class="checkbox">
				<label><input<?php 
    if (!bp_groupblog_is_blog_enabled($group_id)) {
        ?>
 disabled="true"<?php 
    }
    ?>
 type="checkbox" name="groupblog-silent-add" id="groupblog-silent-add" value="1"<?php 
    if (bp_groupblog_silent_add($group_id)) {
        ?>
 checked="checked"<?php 
    }
    ?>
/> <?php 
    _e('Enable member blog posting', 'groupblog');
    ?>
</label>
			</div>

			<?php 
    // Assign our default roles to variables.
    // If nothing has been saved in the groupmeta yet, then we assign our own defalt values.
    if (!($groupblog_default_admin_role = groups_get_groupmeta($bp->groups->current_group->id, 'groupblog_default_admin_role'))) {
        $groupblog_default_admin_role = $bp->groupblog->default_admin_role;
    }
    if (!($groupblog_default_mod_role = groups_get_groupmeta($bp->groups->current_group->id, 'groupblog_default_mod_role'))) {
        $groupblog_default_mod_role = $bp->groupblog->default_mod_role;
    }
    if (!($groupblog_default_member_role = groups_get_groupmeta($bp->groups->current_group->id, 'groupblog_default_member_role'))) {
        $groupblog_default_member_role = $bp->groupblog->default_member_role;
    }
    ?>

			<label><strong><?php 
    _e('Default Administrator Role:', 'groupblog');
    ?>
</strong></label>
			<input type="radio" <?php 
    checked($groupblog_default_admin_role, 'administrator');
    ?>
 value="administrator" name="default-administrator"<?php 
    echo $disabled;
    ?>
 /><span>&nbsp;<?php 
    _e('Administrator', 'groupblog');
    ?>
&nbsp;&nbsp;</span>
			<input type="radio" <?php 
    checked($groupblog_default_admin_role, 'editor');
    ?>
 value="editor" name="default-administrator"<?php 
    echo $disabled;
    ?>
 /><span>&nbsp;<?php 
    _e('Editor', 'groupblog');
    ?>
&nbsp;&nbsp;</span>
			<input type="radio" <?php 
    checked($groupblog_default_admin_role, 'author');
    ?>
 value="author" name="default-administrator"<?php 
    echo $disabled;
    ?>
 /><span>&nbsp;<?php 
    _e('Author', 'groupblog');
    ?>
&nbsp;&nbsp;</span>
			<input type="radio" <?php 
    checked($groupblog_default_admin_role, 'contributor');
    ?>
 value="contributor" name="default-administrator"<?php 
    echo $disabled;
    ?>
 /><span>&nbsp;<?php 
    _e('Contributor', 'groupblog');
    ?>
&nbsp;&nbsp;</span>
			<input type="radio" <?php 
    checked($groupblog_default_admin_role, 'subscriber');
    ?>
 value="subscriber" name="default-administrator"<?php 
    echo $disabled;
    ?>
 /><span>&nbsp;<?php 
    _e('Subscriber', 'groupblog');
    ?>
&nbsp;&nbsp;</span>

			<label><strong><?php 
    _e('Default Moderator Role:', 'groupblog');
    ?>
</strong></label>
			<input type="radio" <?php 
    checked($groupblog_default_mod_role, 'administrator');
    ?>
 value="administrator" name="default-moderator"<?php 
    echo $disabled;
    ?>
 /><span>&nbsp;<?php 
    _e('Administrator', 'groupblog');
    ?>
&nbsp;&nbsp;</span>
			<input type="radio" <?php 
    checked($groupblog_default_mod_role, 'editor');
    ?>
 value="editor" name="default-moderator"<?php 
    echo $disabled;
    ?>
 /><span>&nbsp;<?php 
    _e('Editor', 'groupblog');
    ?>
&nbsp;&nbsp;</span>
			<input type="radio" <?php 
    checked($groupblog_default_mod_role, 'author');
    ?>
 value="author" name="default-moderator"<?php 
    echo $disabled;
    ?>
 /><span>&nbsp;<?php 
    _e('Author', 'groupblog');
    ?>
&nbsp;&nbsp;</span>
			<input type="radio" <?php 
    checked($groupblog_default_mod_role, 'contributor');
    ?>
 value="contributor" name="default-moderator"<?php 
    echo $disabled;
    ?>
 /><span>&nbsp;<?php 
    _e('Contributor', 'groupblog');
    ?>
&nbsp;&nbsp;</span>
			<input type="radio" <?php 
    checked($groupblog_default_mod_role, 'subscriber');
    ?>
 value="subscriber" name="default-moderator"<?php 
    echo $disabled;
    ?>
 /><span>&nbsp;<?php 
    _e('Subscriber', 'groupblog');
    ?>
&nbsp;&nbsp;</span>

			<label><strong><?php 
    _e('Default Member Role:', 'groupblog');
    ?>
</strong></label>
			<input type="radio" <?php 
    checked($groupblog_default_member_role, 'administrator');
    ?>
 value="administrator" name="default-member"<?php 
    echo $disabled;
    ?>
 /><span>&nbsp;<?php 
    _e('Administrator', 'groupblog');
    ?>
&nbsp;&nbsp;</span>
			<input type="radio" <?php 
    checked($groupblog_default_member_role, 'editor');
    ?>
 value="editor" name="default-member"<?php 
    echo $disabled;
    ?>
 /><span>&nbsp;<?php 
    _e('Editor', 'groupblog');
    ?>
&nbsp;&nbsp;</span>
			<input type="radio" <?php 
    checked($groupblog_default_member_role, 'author');
    ?>
 value="author" name="default-member"<?php 
    echo $disabled;
    ?>
 /><span>&nbsp;<?php 
    _e('Author', 'groupblog');
    ?>
&nbsp;&nbsp;</span>
			<input type="radio" <?php 
    checked($groupblog_default_member_role, 'contributor');
    ?>
 value="contributor" name="default-member"<?php 
    echo $disabled;
    ?>
 /><span>&nbsp;<?php 
    _e('Contributor', 'groupblog');
    ?>
&nbsp;&nbsp;</span>
			<input type="radio" <?php 
    checked($groupblog_default_member_role, 'subscriber');
    ?>
 value="subscriber" name="default-member"<?php 
    echo $disabled;
    ?>
 /><span>&nbsp;<?php 
    _e('Subscriber', 'groupblog');
    ?>
&nbsp;&nbsp;</span>

			<div id="groupblog-member-roles">
				<label><strong><?php 
    _e('A bit about WordPress member roles:', 'groupblog');
    ?>
</strong></label>
				<ul id="groupblog-members">
					<li><?php 
    _e('Administrator', 'groupblog');
    ?>
 - <?php 
    _e("Somebody who has access to all the administration features.", 'groupblog');
    ?>
</li>
					<li><?php 
    _e('Editor', 'groupblog');
    ?>
 - <?php 
    _e("Somebody who can publish posts, manage posts as well as manage other people's posts, etc.", 'groupblog');
    ?>
</li>
					<li><?php 
    _e('Author', 'groupblog');
    ?>
 - <?php 
    _e("Somebody who can publish and manage their own posts.", 'groupblog');
    ?>
</li>
					<li><?php 
    _e('Contributor', 'groupblog');
    ?>
 - <?php 
    _e("Somebody who can write and manage their posts but not publish posts.", 'groupblog');
    ?>
</li>
					<li><?php 
    _e('Subscriber', 'groupblog');
    ?>
 - <?php 
    _e("Somebody who can read comments/comment/receive news letters, etc.", 'groupblog');
    ?>
</li>
				</ul>
			</div>

		</div>

		<br />

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

			<?php 
        if (!($page_template_layout = groups_get_groupmeta($bp->groups->current_group->id, 'page_template_layout'))) {
            $page_template_layout = groupblog_get_page_template_layout();
        }
        ?>

			<div id="groupblog-layout-options">

				<h3><?php 
        _e('Select Layout', 'groupblog');
        ?>
</h3>

				<p class="enabled"><?php 
        _e('Please select a Layout which you would like to use for your Group Blog.', 'groupblog');
        ?>
</p>

				<table class="enabled" id="availablethemes" cellspacing="0" cellpadding="0">
					<tbody>
					<tr>
						<td class="available-theme top left">
							<?php 
        echo '<img src="' . WP_PLUGIN_URL . '/bp-groupblog/inc/i/screenshot-mag.png">';
        ?>
							<br /><br />
							<input<?php 
        if (!bp_groupblog_is_blog_enabled($group_id)) {
            ?>
 disabled="true"<?php 
        }
        ?>
 name="page_template_layout" id="page_template_layout"  value="magazine" type="radio" <?php 
        if ($page_template_layout == 'magazine') {
            echo 'checked="checked"';
        }
        ?>
 /><label style="display:inline;"> <?php 
        _e('Magazine', 'groupblog');
        ?>
</label>
							<p class="description"><?php 
        _e('Balanced template for groups with diverse postings.', 'groupblog');
        ?>
</p>
						</td>
						<td class="available-theme top">
							<?php 
        echo '<img src="' . WP_PLUGIN_URL . '/bp-groupblog/inc/i/screenshot-micro.png">';
        ?>
							<br /><br />
							<input<?php 
        if (!bp_groupblog_is_blog_enabled($group_id)) {
            ?>
 disabled="true"<?php 
        }
        ?>
 name="page_template_layout" id="page_template_layout"  value="microblog" type="radio" <?php 
        if ($page_template_layout == 'microblog') {
            echo 'checked="checked"';
        }
        ?>
 /><label style="display:inline;"> <?php 
        _e('Microblog', 'groupblog');
        ?>
</label>
							<p class="description"><?php 
        _e('Great for simple listing of posts in a chronological order.', 'groupblog');
        ?>
</p>
						</td>
					</tr>
					</tbody>
				</table>

			</div>

			<br />

		<?php 
    }
    ?>

		<?php 
    if (!$groupblog_create_screen) {
        ?>
		<p>
			<input id="save" type="submit" name="save" class="submit" value="<?php 
        _e('Save Changes &raquo;', 'groupblog');
        ?>
"/>
		</p>
	</form>
	<?php 
    }
}
Exemple #3
0
						<?php 
        do_action('bp_group_options_nav');
        ?>
					</ul>
				</div>
			</div>

			<div id="item-body">

				<?php 
        do_action('bp_before_group_body');
        ?>
				
				<?php 
        if (bp_group_is_visible() && bp_groupblog_is_blog_enabled(bp_get_group_id())) {
            ?>
			  
			
					<?php 
            switch_to_blog(get_groupblog_blog_id());
            ?>
					
					<?php 
            /********************* Start your custom content *********************/
            ?>
				
					<?php 
            /* Uncomment to disable */
            include 'inc/pages.php';
            ?>