/**
 * Adds the Group Admin top-level menu to group pages
 *
 * @package BuddyPress
 * @since 1.5
 *
 * @todo Add dynamic menu items for group extensions
 */
function bp_groups_group_admin_menu()
{
    global $nxt_admin_bar, $bp;
    // Only show if viewing a group
    if (!bp_is_group()) {
        return false;
    }
    // Only show this menu to group admins and super admins
    if (!is_super_admin() && !bp_group_is_admin()) {
        return false;
    }
    if ('3.2' == bp_get_major_nxt_version()) {
        // Group avatar
        $avatar = bp_core_fetch_avatar(array('object' => 'group', 'type' => 'thumb', 'avatar_dir' => 'group-avatars', 'item_id' => $bp->groups->current_group->id, 'width' => 16, 'height' => 16));
        // Unique ID for the 'My Account' menu
        $bp->group_admin_menu_id = !empty($avatar) ? 'group-admin-with-avatar' : 'group-admin';
        // Add the top-level Group Admin button
        $nxt_admin_bar->add_menu(array('id' => $bp->group_admin_menu_id, 'title' => $avatar . bp_get_current_group_name(), 'href' => bp_get_group_permalink($bp->groups->current_group)));
    } elseif ('3.3' == bp_get_major_nxt_version()) {
        // Unique ID for the 'My Account' menu
        $bp->group_admin_menu_id = 'group-admin';
        // Add the top-level Group Admin button
        $nxt_admin_bar->add_menu(array('id' => $bp->group_admin_menu_id, 'title' => __('Edit Group', 'buddypress'), 'href' => bp_get_group_permalink($bp->groups->current_group)));
    }
    // Group Admin > Edit details
    $nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'edit-details', 'title' => __('Edit Details', 'buddypress'), 'href' => bp_get_groups_action_link('admin/edit-details')));
    // Group Admin > Group settings
    $nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'group-settings', 'title' => __('Edit Settings', 'buddypress'), 'href' => bp_get_groups_action_link('admin/group-settings')));
    // Group Admin > Group avatar
    if (!(int) bp_get_option('bp-disable-avatar-uploads')) {
        $nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'group-avatar', 'title' => __('Edit Avatar', 'buddypress'), 'href' => bp_get_groups_action_link('admin/group-avatar')));
    }
    // Group Admin > Manage invitations
    if (bp_is_active('friends')) {
        $nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'manage-invitations', 'title' => __('Manage Invitations', 'buddypress'), 'href' => bp_get_groups_action_link('send-invites')));
    }
    // Group Admin > Manage members
    $nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'manage-members', 'title' => __('Manage Members', 'buddypress'), 'href' => bp_get_groups_action_link('admin/manage-members')));
    // Group Admin > Membership Requests
    if (bp_get_group_status($bp->groups->current_group) == 'private') {
        $nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'membership-requests', 'title' => __('Membership Requests', 'buddypress'), 'href' => bp_get_groups_action_link('admin/membership-requests')));
    }
    // Delete Group
    $nxt_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'delete-group', 'title' => __('Delete Group', 'buddypress'), 'href' => bp_get_groups_action_link('admin/delete-group')));
}
/**
 * Add the Group Admin top-level menu when viewing group pages.
 *
 * @since BuddyPress (1.5.0)
 *
 * @todo Add dynamic menu items for group extensions.
 */
function bp_groups_group_admin_menu()
{
    global $wp_admin_bar, $bp;
    // Only show if viewing a group
    if (!bp_is_group()) {
        return false;
    }
    // Only show this menu to group admins and super admins
    if (!bp_current_user_can('bp_moderate') && !bp_group_is_admin()) {
        return false;
    }
    // Unique ID for the 'Edit Group' menu
    $bp->group_admin_menu_id = 'group-admin';
    // Add the top-level Group Admin button
    $wp_admin_bar->add_menu(array('id' => $bp->group_admin_menu_id, 'title' => __('Edit Group', 'buddypress'), 'href' => bp_get_group_permalink($bp->groups->current_group)));
    // Group Admin > Edit details
    $wp_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'edit-details', 'title' => __('Edit Details', 'buddypress'), 'href' => bp_get_groups_action_link('admin/edit-details')));
    // Group Admin > Group settings
    $wp_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'group-settings', 'title' => __('Edit Settings', 'buddypress'), 'href' => bp_get_groups_action_link('admin/group-settings')));
    // Group Admin > Group avatar
    if (!(int) bp_get_option('bp-disable-avatar-uploads')) {
        $wp_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'group-avatar', 'title' => __('Edit Avatar', 'buddypress'), 'href' => bp_get_groups_action_link('admin/group-avatar')));
    }
    // Group Admin > Manage invitations
    if (bp_is_active('friends')) {
        $wp_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'manage-invitations', 'title' => __('Manage Invitations', 'buddypress'), 'href' => bp_get_groups_action_link('send-invites')));
    }
    // Group Admin > Manage members
    $wp_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'manage-members', 'title' => __('Manage Members', 'buddypress'), 'href' => bp_get_groups_action_link('admin/manage-members')));
    // Group Admin > Membership Requests
    if (bp_get_group_status($bp->groups->current_group) == 'private') {
        $wp_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'membership-requests', 'title' => __('Membership Requests', 'buddypress'), 'href' => bp_get_groups_action_link('admin/membership-requests')));
    }
    // Delete Group
    $wp_admin_bar->add_menu(array('parent' => $bp->group_admin_menu_id, 'id' => 'delete-group', 'title' => __('Delete Group', 'buddypress'), 'href' => bp_get_groups_action_link('admin/delete-group')));
}
function bp_group_status($group = false)
{
    echo bp_get_group_status($group);
}
</label>
							<select id="topic_group_id" name="topic_group_id">

								<option value=""><?php 
        /* translators: no option picked in select box */
        _e('----', 'buddypress');
        ?>
</option>

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

									<?php 
            if (bp_group_is_forum_enabled() && (is_super_admin() || 'public' == bp_get_group_status() || bp_group_is_member())) {
                ?>

										<option value="<?php 
                bp_group_id();
                ?>
"><?php 
                bp_group_name();
                ?>
</option>

									<?php 
            }
            ?>

								<?php 
Example #5
0
	</div><!-- .forums.single-forum -->

<?php 
}
?>

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

<?php 
if (!bp_is_group_forum_topic_edit() && !bp_is_group_forum_topic()) {
    ?>

	<?php 
    if (!bp_group_is_user_banned() && (is_user_logged_in() && 'public' == bp_get_group_status() || bp_group_is_member())) {
        ?>

		<form action="" method="post" id="forum-topic-form" class="standard-form">
			<div id="new-topic-post">

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

				<?php 
        if (bp_groups_auto_join() && !bp_group_is_member()) {
            ?>
					<p><?php 
            _e('You will auto join this group when you start a new topic.', 'buddypress');
            ?>
Example #6
0
						<input type="text" name="topic_title" id="topic_title" value="" />

						<label><?php _e( 'Content:', 'buddypress' ) ?></label>
						<textarea name="topic_text" id="topic_text"></textarea>

						<label><?php _e( 'Tags (comma separated):', 'buddypress' ) ?></label>
						<input type="text" name="topic_tags" id="topic_tags" value="" />

						<label><?php _e( 'Post In Group Forum:', 'buddypress' ) ?></label>
						<select id="topic_group_id" name="topic_group_id">

							<option value="">----</option>

							<?php while ( bp_groups() ) : bp_the_group(); ?>

								<?php if ( bp_group_is_forum_enabled() && 'public' == bp_get_group_status() ) : ?>

									<option value="<?php bp_group_id() ?>"><?php bp_group_name() ?></option>

								<?php endif; ?>

							<?php endwhile; ?>

						</select><!-- #topic_group_id -->

						<?php do_action( 'groups_forum_new_topic_after' ) ?>

						<div class="submit">
							<input type="submit" name="submit_topic" id="submit" value="<?php _e( 'Post Topic', 'buddypress' ) ?>" />
							<input type="button" name="submit_topic_cancel" id="submit_topic_cancel" value="<?php _e( 'Cancel', 'buddypress' ) ?>" />
						</div>
function bp_group_status()
{
    echo bp_get_group_status();
}
Example #8
0
</label>
					<select id="topic_group_id" name="topic_group_id">

						<option value=""><?php 
        /* translators: no option picked in select box */
        _e('----', 'buddypress');
        ?>
</option>

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

							<?php 
            if (bp_group_is_forum_enabled() && (bp_current_user_can('bp_moderate') || 'public' == bp_get_group_status() || bp_group_is_member())) {
                ?>

								<option value="<?php 
                bp_group_id();
                ?>
"><?php 
                bp_group_name();
                ?>
</option>

							<?php 
            }
            ?>

						<?php 
 /**
  * Create the hub overview CSV when requested.
  *
  * @since    1.0.0
  */
 public function run_stat_hub_csv()
 {
     global $wpdb;
     $bp = buddypress();
     // Output headers so that the file is downloaded rather than displayed.
     header('Content-Type: text/csv; charset=utf-8');
     header('Content-Disposition: attachment; filename=cc-hubs-overview.csv');
     // Create a file pointer connected to the output stream.
     $output = fopen('php://output', 'w');
     // Write a header row.
     $row = array('Hub ID', 'Name', 'Slug', 'Status', 'Date Created', 'Last Activity', 'Parent Hub ID', 'Total Members', 'Creator ID', 'Creator Email', 'Forum', 'BP Docs', 'CC Hub Home Page', 'CC Hub Pages', 'CC Hub Narratives', 'Custom Plugins');
     fputcsv($output, $row);
     // Groups Loop
     if (bp_has_groups(array('order' => 'ASC', 'orderby' => 'date_created', 'page' => null, 'per_page' => null, 'max' => false, 'show_hidden' => true, 'user_id' => null, 'meta_query' => false, 'include' => false, 'exclude' => false, 'populate_extras' => false, 'update_meta_cache' => false))) {
         while (bp_groups()) {
             bp_the_group();
             $group_id = bp_get_group_id();
             $group_object = groups_get_group(array('group_id' => (int) $group_id, 'populate_extras' => true));
             // Hub ID
             $row = array($group_id);
             // Name
             $row[] = bp_get_group_name();
             // Slug
             $row[] = bp_get_group_slug();
             // Status
             $row[] = bp_get_group_status();
             // Date Created
             $row[] = $group_object->date_created;
             // Date of last activity
             $row[] = $group_object->last_activity;
             // Parent Hub ID
             $row[] = $wpdb->get_var($wpdb->prepare("SELECT g.parent_id FROM {$bp->groups->table_name} g WHERE g.id = %d", $group_id));
             // Total Members
             $row[] = groups_get_total_member_count($group_id);
             // Creator ID
             $creator_id = $group_object->creator_id;
             $row[] = $creator_id;
             // Creator Email
             $creator = get_user_by('id', $creator_id);
             $row[] = $creator->user_email;
             // Forum
             $row[] = $group_object->enable_forum;
             // BP Docs
             if (function_exists('bp_docs_is_docs_enabled_for_group')) {
                 $row[] = bp_docs_is_docs_enabled_for_group($group_id);
             } else {
                 $row[] = '';
             }
             // CC Hub Home Page
             if (function_exists('cc_get_group_home_page_post') && cc_get_group_home_page_post($group_id)->have_posts()) {
                 $row[] = 1;
             } else {
                 $row[] = 0;
             }
             // CC Hub Pages
             $row[] = (bool) groups_get_groupmeta($group_id, "ccgp_is_enabled");
             // CC Hub Narratives
             $row[] = (bool) groups_get_groupmeta($group_id, "ccgn_is_enabled");
             // Custom Plugins
             // To make your group-specific plugin be counted, so something like this:
             /*	add_filter( 'cc_stats_custom_plugins', 'prefix_report_custom_plugin', 10, 2 );
              *	function prefix_report_custom_plugin( $custom_plugins, $group_id ) {
              *		if ( $group_id == sa_get_group_id() ) {
              *			$custom_plugins[] = "CC Salud America";
              *		}
              *		return $custom_plugins;
              *	}
              */
             $custom_plugins = apply_filters('cc_stats_custom_plugins', array(), $group_id);
             $custom_plugins = implode(' ', $custom_plugins);
             $row[] = $custom_plugins;
             // Write the row.
             fputcsv($output, $row);
         }
     }
     fclose($output);
     exit;
 }
Example #10
0
		<?php do_action( 'bp_after_group_forum_topic_posts' ) ?>

		<div class="pagination no-ajax">

			<div id="post-count" class="pag-count">
				<?php bp_the_topic_pagination_count() ?>
			</div>

			<div class="pagination-links" id="topic-pag">
				<?php bp_the_topic_pagination() ?>
			</div>

		</div>

		<?php if ( ( is_user_logged_in() && 'public' == bp_get_group_status() ) || bp_group_is_member() ) : ?>

			<?php if ( bp_get_the_topic_is_last_page() ) : ?>

				<?php if ( bp_get_the_topic_is_topic_open() ) : ?>

					<div id="post-topic-reply">
						<p id="post-reply"></p>

						<?php if ( bp_groups_auto_join() && !bp_group_is_member() ) : ?>
							<p><?php _e( 'You will auto join this group when you reply to this topic.', 'buddypress' ) ?></p>
						<?php endif; ?>

						<?php do_action( 'groups_forum_new_reply_before' ) ?>

						<h4><?php _e( 'Add a reply:', 'buddypress' ) ?></h4>
Example #11
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 
}
Example #12
0
 function insert_activity($id, $media)
 {
     if (!$this->activity_enabled()) {
         return false;
     }
     $activity = new RTMediaActivity($media->id, $media->privacy);
     $activity_content = $activity->create_activity_html();
     $user = get_userdata($media->media_author);
     $username = '******' . get_rtmedia_user_link($media->media_author) . '">' . $user->user_nicename . '</a>';
     $count = count($id);
     $media_const = 'RTMEDIA_' . strtoupper($media->media_type);
     if ($count > 1) {
         $media_const .= '_PLURAL';
     }
     $media_const .= '_LABEL';
     $media_str = constant($media_const);
     $action = sprintf($count == 1 ? __('%1$s added a %2$s', 'rtmedia') : __('%1$s added %4$d %3$s', 'rtmedia'), $username, $media->media_type, $media_str, $count);
     $action = apply_filters('rtmedia_buddypress_action_text_fitler', $action, $username, $count, $user->user_nicename, $media->media_type);
     $activity_args = array('user_id' => $user->ID, 'action' => $action, 'content' => $activity_content, 'type' => 'rtmedia_update', 'primary_link' => '', 'item_id' => $id);
     if ($media->context == "group" && function_exists("bp_get_group_status") && bp_get_group_status(groups_get_group(array("group_id" => $media->context_id))) != "public") {
         $activity_args["hide_sitewide"] = true;
     }
     if ($media->context == 'group' || 'profile') {
         $activity_args['component'] = $media->context;
         if ($media->context == 'group') {
             $activity_args['component'] = "groups";
             $activity_args['item_id'] = $media->context_id;
         }
     }
     $activity_id = bp_activity_add($activity_args);
     bp_activity_update_meta($activity_id, 'rtmedia_privacy', $media->privacy == 0 ? -1 : $media->privacy);
     $this->model->update(array('activity_id' => $activity_id), array('id' => $media->id));
     // insert/update activity details in rtmedia activity table
     $rtmedia_activity_model = new RTMediaActivityModel();
     if (!$rtmedia_activity_model->check($activity_id)) {
         $rtmedia_activity_model->insert(array('activity_id' => $activity_id, 'user_id' => $media->media_author, 'privacy' => $media->privacy));
     } else {
         $rtmedia_activity_model->update(array('activity_id' => $activity_id, 'user_id' => $media->media_author, 'privacy' => $media->privacy), array('activity_id' => $activity_id));
     }
     return $activity_id;
 }
function ccgn_create_activity_items($post_id)
{
    $bp = buddypress();
    // We want to fetch the saved post, because WP has done some filtering on save.
    $post_object = get_post($post_id);
    $author_id = (int) $post_object->post_author;
    $user_link = bp_core_get_userlink($author_id);
    $post_type_object = get_post_type_object($post_object->post_type);
    $post_type_label = strtolower($post_type_object->labels->singular_name);
    // A single narrative may be associated with more than one group
    $origin_group_id = ccgn_get_origin_group($post_id);
    $associated_groups = ccgn_get_associated_group_ids($post_id);
    $type = $post_object->post_type . '_created';
    foreach ($associated_groups as $group_id) {
        // Does an activity item already exist?
        $exists = bp_activity_get_activity_id(array('component' => $bp->groups->id, 'type' => $type, 'item_id' => $group_id, 'secondary_item_id' => $post_id));
        if (!empty($exists)) {
            continue;
        }
        // Create a post url that is relative to this group.
        $post_url = trailingslashit(ccgn_get_home_permalink($group_id)) . $post_object->post_name;
        $post_link = sprintf('<a href="%s">%s</a>', $post_url, $post_object->post_title);
        $group = groups_get_group(array('group_id' => $group_id));
        $group_url = bp_get_group_permalink($group);
        $group_link = '<a href="' . $group_url . '">' . $group->name . '</a>';
        // Only set hide_sitewide to false if this is the origin group and it is a public group.
        if ($group_id == $origin_group_id && 'public' == bp_get_group_status($group)) {
            $hide_sitewide = false;
        } else {
            $hide_sitewide = true;
        }
        $action = sprintf(__('%1$s published the %2$s %3$s in the Hub %4$s', 'cc-group-narratives'), $user_link, $post_type_label, $post_link, $group_link);
        $args = array('user_id' => $author_id, 'action' => $action, 'primary_link' => $post_link, 'component' => $bp->groups->id, 'type' => $type, 'item_id' => $group_id, 'secondary_item_id' => $post_id, 'recorded_time' => $post_object->post_date, 'hide_sitewide' => $hide_sitewide, 'content' => bp_create_excerpt($post_object->post_content, 358));
        do_action($post_object->post_type . '_before_activity_save', $args);
        $activity_id = bp_activity_add(apply_filters($post_object->post_type . '_activity_args', $args, $post_id));
    }
}
Example #14
0
        _e('Tags (comma separated):', 'buddypress');
        ?>
</label>
							<input type="text" name="topic_tags" id="topic_tags" value="" />

							<label><?php 
        _e('Post In Group Forum:', 'buddypress');
        ?>
</label>
							<select id="topic_group_id" name="topic_group_id">
								<?php 
        while (bp_groups()) {
            bp_the_group();
            ?>
									<?php 
            if ('public' == bp_get_group_status()) {
                ?>
										<option value="<?php 
                bp_group_id();
                ?>
"><?php 
                bp_group_name();
                ?>
</option>
									<?php 
            }
            ?>
								<?php 
        }
        ?>
							</select>
Example #15
0
    ?>
				</select>
			</li>
		</ul>
		<div class="clear"></div>
	</div>
	<div class="forums single-forum" role="main">
		<?php 
    gconnect_locate_template(array('forums/forums-loop.php'), true);
    ?>
	</div><!-- .forums.single-forum -->

<?php 
}
do_action('bp_after_group_forum_content');
if (!bp_is_group_forum_topic_edit() && !bp_is_group_forum_topic() && !bp_group_is_user_banned() && (is_user_logged_in() && 'public' == bp_get_group_status() || bp_group_is_member())) {
    ?>

	<form action="" method="post" id="forum-topic-form" class="standard-form">
		<div id="new-topic-post">

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

			<?php 
    if (bp_groups_auto_join() && !bp_group_is_member()) {
        ?>
				<p><?php 
        _e('You will auto join this group when you start a new topic.', 'buddypress');
        ?>
Example #16
0
    /**
     * Render the uploader shortcode and attach the uploader panel
     *
     * @param type $template_name
     */
    public function render($template_name)
    {
        global $rtmedia_query;
        $album = '';
        if (apply_filters('rtmedia_render_select_album_upload', true)) {
            if ($rtmedia_query && isset($rtmedia_query->media_query) && isset($rtmedia_query->media_query['album_id']) && is_rtmedia_album($rtmedia_query->media_query['album_id'])) {
                $album = '<input class="rtmedia-current-album" type="hidden" name="rtmedia-current-album" value="' . esc_attr($rtmedia_query->media_query['album_id']) . '" />';
            } elseif (is_rtmedia_album_enable() && $rtmedia_query && is_rtmedia_gallery()) {
                if (isset($rtmedia_query->query['context']) && 'profile' === $rtmedia_query->query['context']) {
                    $album = '<span> <label> <i class="dashicons dashicons-format-gallery rtmicon"></i>' . esc_html__('Album', 'buddypress-media') . ': </label><select name="album" class="rtmedia-user-album-list">' . rtmedia_user_album_list() . '</select></span>';
                }
                if (isset($rtmedia_query->query['context']) && 'group' === $rtmedia_query->query['context']) {
                    $album = '<span> <label> <i class="dashicons dashicons-format-gallery rtmicon"></i>' . esc_html__('Album', 'buddypress-media') . ': </label><select name="album" class="rtmedia-user-album-list">' . rtmedia_group_album_list() . '</select></span>';
                }
            }
        }
        $up_privacy = $privacy = '';
        //uploader privacy dropdown for uploader under rtMedia Media tab.
        if (is_rtmedia_privacy_enable() && (!isset($rtmedia_query->is_upload_shortcode) || false === $rtmedia_query->is_upload_shortcode) || isset($rtmedia_query->is_upload_shortcode) && !isset($this->attributes['privacy'])) {
            if (isset($rtmedia_query->query['context']) && 'group' === $rtmedia_query->query['context'] || function_exists('bp_is_groups_component') && bp_is_groups_component()) {
                $group_status = bp_get_group_status();
                $privacy_levels_array = array('public' => 0, 'private' => 20, 'hidden' => 20);
                $privacy_levels_array = apply_filters('rtmedia_group_privacy_levels', $privacy_levels_array);
                $privacy_val = $privacy_levels_array[$group_status];
                $up_privacy = $privacy = "<input type='hidden' name='privacy' value='" . esc_attr($privacy_val) . "' />";
            } else {
                $up_privacy = new RTMediaPrivacy(false);
                $up_privacy = $up_privacy->select_privacy_ui(false, 'rtSelectPrivacy');
                if ($up_privacy) {
                    $privacy = "<span> <label for='privacy'> <i class='dashicons dashicons-visibility rtmicon'></i>" . esc_html__('Privacy: ', 'buddypress-media') . '</label>' . $up_privacy . '</span>';
                }
            }
        }
        $upload_tabs = array('file_upload' => array('title' => esc_html__('File Upload', 'buddypress-media'), 'class' => array('rtm-upload-tab', 'active'), 'content' => '<div class="rtm-upload-tab-content" data-id="rtm-upload-tab">' . apply_filters('rtmedia_uploader_before_select_files', '') . '<div class="rtm-select-files"><input id="' . apply_filters('rtmedia_upload_button_id', 'rtMedia-upload-button') . '" value="' . esc_attr__('Select your files', 'buddypress-media') . '" type="button" class="rtmedia-upload-input rtmedia-file" />' . '<span class="rtm-seperator">' . esc_html__('or', 'buddypress-media') . '</span><span class="drag-drop-info">' . esc_html__('Drop your files here', 'buddypress-media') . '</span> <i class="rtm-file-size-limit rtmicon-info-circle rtmicon-fw"></i></div>' . apply_filters('rtmedia_uploader_after_select_files', '') . '</div>'));
        $upload_tabs = apply_filters('rtmedia_uploader_tabs', $upload_tabs);
        if (is_array($upload_tabs) && !empty($upload_tabs)) {
            if (1 === count($upload_tabs) && isset($upload_tabs['file_upload'])) {
                $upload_tab_html = $upload_tabs['file_upload']['content'];
            } else {
                $upload_tab_html = '<div class="rtm-uploader-main-wrapper"><div class="rtm-uploader-tabs"><ul>';
                foreach ($upload_tabs as $single_tab) {
                    $upload_tab_html .= '<li class="' . implode(' ', $single_tab['class']) . '">' . $single_tab['title'] . '</li>';
                }
                $upload_tab_html .= '</ul></div>';
                foreach ($upload_tabs as $single_tab) {
                    $upload_tab_html .= $single_tab['content'];
                }
                $upload_tab_html .= '</div>';
            }
        } else {
            $upload_tab_html = '';
        }
        global $rtmedia;
        $upload_button = '<input type="button" class="start-media-upload" value="' . esc_attr__('Start upload', 'buddypress-media') . '"/>';
        $tabs = array('file_upload' => array('default' => array('title' => esc_html__('File Upload', 'buddypress-media'), 'content' => '<div id="rtmedia-upload-container" >' . '<div id="drag-drop-area" class="drag-drop clearfix">' . apply_filters('rtmedia_uploader_before_album_privacy', '') . "<div class='rtm-album-privacy'>" . $album . $privacy . '</div>' . $upload_tab_html . apply_filters('rtmedia_uploader_before_start_upload_button', '') . $upload_button . apply_filters('rtmedia_uploader_after_start_upload_button', '') . '</div>' . '<div class="clearfix">' . '<ul class="plupload_filelist_content ui-sortable rtm-plupload-list clearfix" id="rtmedia_uploader_filelist"></ul>' . '</div>' . '</div>'), 'activity' => array('title' => esc_html__('File Upload', 'buddypress-media'), 'content' => '<div class="rtmedia-plupload-container rtmedia-container clearfix">' . '<div id="rtmedia-action-update" class="clearfix">' . '<div class="rtm-upload-button-wrapper">' . '<div id="rtmedia-whts-new-upload-container">' . '</div>' . '<button type="button" class="rtmedia-add-media-button" id="' . apply_filters('rtmedia_upload_button_id', 'rtmedia-add-media-button-post-update') . '" title="' . apply_filters('rtmedia_attach_media_button_title', esc_attr__('Attach Media', 'buddypress-media')) . '">' . '<span class="dashicons dashicons-admin-media"></span>' . apply_filters('rtmedia_attach_file_message', '') . '</button>' . '</div>' . $up_privacy . '</div>' . '</div>' . apply_filters('rtmedia_uploader_after_activity_upload_button', '') . '<div class="rtmedia-plupload-notice">' . '<ul class="plupload_filelist_content ui-sortable rtm-plupload-list clearfix" id="rtmedia_uploader_filelist"></ul>' . '</div>')), 'link_input' => array('title' => esc_html__('Insert from URL', 'buddypress-media'), 'content' => '<input type="url" name="bp-media-url" class="rtmedia-upload-input rtmedia-url" />'));
        $tabs = apply_filters('rtmedia_upload_tabs', $tabs);
        $attr = $this->attributes;
        $mode = filter_input(INPUT_GET, 'mode', FILTER_SANITIZE_STRING);
        if (is_null($mode) || false === $mode || !array_key_exists($mode, $tabs)) {
            $mode = 'file_upload';
        }
        if ($attr && is_array($attr)) {
            foreach ($attr as $key => $val) {
                ?>
				<input type='hidden' id="rt_upload_hf_<?php 
                echo esc_attr($key);
                ?>
"
				       value='<?php 
                echo esc_attr($val);
                ?>
'
				       name='<?php 
                echo esc_attr($key);
                ?>
'/>
				<?php 
            }
        }
        $upload_type = 'default';
        if (isset($attr['activity']) && $attr['activity']) {
            $upload_type = 'activity';
        }
        $upload_helper = new RTMediaUploadHelper();
        include $this->locate_template($template_name);
    }