/**
  * Output the quickadmin links
  *
  * @global $bp BuddyPress global settings
  * @since 1.0
  * @todo Make this work for more than just super admins.
  */
 public function make_links()
 {
     global $bp;
     if (empty($bp->loggedin_user->id) || !$bp->loggedin_user->is_super_admin) {
         return;
     }
     $url = bp_get_group_admin_permalink();
     $items = array(sprintf('<a href="%1$s">%2$s</a>', $url . '/edit-details', __('Edit', 'bpl')), sprintf('<a href="%1$s">%2$s</a>', $url . '/group-settings', __('Settings', 'bpl')), sprintf('<a href="%1$s">%2$s</a>', $url . '/group-avatar', __('Avatar', 'bpl')), sprintf('<a href="%1$s">%2$s</a>', $url . '/manage-members', __('Members', 'bpl')), sprintf('<a href="%1$s">%2$s</a>', $url . '/delete-group', __('Delete', 'bpl')));
     echo apply_filters('bplabs_make_links', '<div class="bpl-quickadmin"><span>' . implode('</span> | <span>', $items) . '</span></div>', $items);
 }
function bp_group_admin_permalink($group = false)
{
    echo bp_get_group_admin_permalink($group);
}
function bp_group_admin_permalink()
{
    echo bp_get_group_admin_permalink();
}
 /**
  * group_admin_tab( $current_tab, $group_slug )
  *
  * Hooks into groups_admin_tabs, and adds the courseware options tab
  */
 function group_admin_tab($current_tab, $group_slug)
 {
     // global $bp;
     $tab_content = '<li ';
     if ('courseware' == $current_tab) {
         $tab_content .= 'class="current"';
     }
     $tab_content .= '><a href="' . bp_get_group_admin_permalink() . 'courseware/">';
     $tab_content .= __('Courseware', 'bpsp') . '</a></li>';
     echo $tab_content;
 }
Example #5
0
 /**
  * Maybe map a bbPress forum/topic/reply permalink to the corresponding group
  *
  * @param int $post_id
  * @uses get_post()
  * @uses bbp_is_reply()
  * @uses bbp_get_reply_topic_id()
  * @uses bbp_get_reply_forum_id()
  * @uses bbp_is_topic()
  * @uses bbp_get_topic_forum_id()
  * @uses bbp_is_forum()
  * @uses get_post_field()
  * @uses bbp_get_forum_group_ids()
  * @uses groups_get_group()
  * @uses bp_get_group_admin_permalink()
  * @uses bp_get_group_permalink()
  * @return Bail early if not a group forum post
  * @return string
  */
 private function maybe_map_permalink_to_group($post_id = 0, $url = false)
 {
     switch (get_post_type($post_id)) {
         // Reply
         case bbp_get_reply_post_type():
             $topic_id = bbp_get_reply_topic_id($post_id);
             $forum_id = bbp_get_reply_forum_id($post_id);
             $url_end = trailingslashit($this->reply_slug) . get_post_field('post_name', $post_id);
             break;
             // Topic
         // Topic
         case bbp_get_topic_post_type():
             $topic_id = $post_id;
             $forum_id = bbp_get_topic_forum_id($post_id);
             $url_end = trailingslashit($this->topic_slug) . get_post_field('post_name', $post_id);
             break;
             // Forum
         // Forum
         case bbp_get_forum_post_type():
             $forum_id = $post_id;
             $url_end = '';
             //get_post_field( 'post_name', $post_id );
             break;
             // Unknown
         // Unknown
         default:
             return $url;
             break;
     }
     // Get group ID's for this forum
     $group_ids = bbp_get_forum_group_ids($forum_id);
     // Bail if the post isn't associated with a group
     if (empty($group_ids)) {
         return $url;
     }
     // @todo Multiple group forums/forum groups
     $group_id = $group_ids[0];
     $group = groups_get_group(array('group_id' => $group_id));
     if (bp_is_group_admin_screen($this->slug)) {
         $group_permalink = trailingslashit(bp_get_group_admin_permalink($group));
     } else {
         $group_permalink = trailingslashit(bp_get_group_permalink($group));
     }
     return trailingslashit(trailingslashit($group_permalink . $this->slug) . $url_end);
 }
Example #6
0
 function edit_screen_save()
 {
     global $bp;
     if (!isset($_POST['save'])) {
         return false;
     }
     check_admin_referer('groups_edit_save_' . $this->slug);
     /** save the selected subgroup permission setting */
     $permission_options = apply_filters('bp_group_hierarchy_subgroup_permission_options', $this->subgroup_permission_options);
     if (array_key_exists($_POST['allow_children_by'], $permission_options)) {
         $allow_children_by = $_POST['allow_children_by'];
     } else {
         if (groups_get_groupmeta($bp->groups->current_group->id, 'bp_group_hierarchy_subgroup_creators') != '') {
             $allow_children_by = groups_get_groupmeta($bp->groups->current_group->id, 'bp_group_hierarchy_subgroup_creators');
         } else {
             $allow_children_by = $this->get_default_permission_option();
         }
     }
     groups_update_groupmeta($bp->groups->current_group->id, 'bp_group_hierarchy_subgroup_creators', $allow_children_by);
     if (is_super_admin()) {
         /** save changed parent_id */
         $parent_id = (int) $_POST['parent_id'];
         if (bp_group_hierarchy_can_create_subgroups($bp->loggedin_user->id, $bp->groups->current_group->id)) {
             $bp->groups->current_group->parent_id = $parent_id;
             $success = $bp->groups->current_group->save();
         }
         if (!$success) {
             bp_core_add_message(__('There was an error saving; please try again.', 'bp-group-hierarchy'), 'error');
         } else {
             bp_core_add_message(__('Group hierarchy settings saved successfully.', 'bp-group-hierarchy'));
         }
     }
     bp_core_redirect(bp_get_group_admin_permalink($bp->groups->current_group));
 }
 function chat_network_site_box_container($content = '')
 {
     global $bp;
     // We don't want to add the container on our pop-out template.
     if ($this->using_popup_out_template == true) {
         return;
     }
     $site_chat_box = '';
     if (!is_admin()) {
         if ($this->get_option('bottom_corner', 'network-site') == 'enabled') {
             $_SHOW_SITE_CHAT = true;
         } else {
             $_SHOW_SITE_CHAT = false;
         }
         if ($_SHOW_SITE_CHAT == true) {
             // Are we viewing a BuddyPress Group pages?
             if (isset($bp->groups->current_group->id) && intval($bp->groups->current_group->id)) {
                 // Are we viewing the Group Admin screen?
                 $bp_group_admin_url_path = parse_url(bp_get_group_admin_permalink($bp->groups->current_group), PHP_URL_PATH);
                 $request_url_path = parse_url(get_option('siteurl') . $_SERVER['REQUEST_URI'], PHP_URL_PATH);
                 if (!empty($request_url_path) && !empty($bp_group_admin_url_path) && substr($request_url_path, 0, strlen($bp_group_admin_url_path)) == $bp_group_admin_url_path) {
                     if ($this->get_option('bp_group_admin_show_site', 'global') != "enabled") {
                         $_SHOW_SITE_CHAT = false;
                     }
                 } else {
                     if ($this->get_option('bp_group_show_site', 'global') != "enabled") {
                         $_SHOW_SITE_CHAT = false;
                     }
                 }
             } else {
                 if ($this->_chat_plugin_settings['blocked_urls']['site'] == true) {
                     $_SHOW_SITE_CHAT = false;
                 } else {
                     if ($this->get_option('blocked_on_shortcode', 'site') == 'enabled') {
                         global $post;
                         if (!empty($post->post_content) && strstr($post->post_content, '[chat ') !== false) {
                             $_SHOW_SITE_CHAT = false;
                         }
                     }
                 }
             }
         }
     } else {
         if ($this->get_option('bottom_corner_wpadmin', 'network-site') == 'enabled') {
             $_SHOW_SITE_CHAT = true;
         } else {
             $_SHOW_SITE_CHAT = false;
         }
         if ($this->_chat_plugin_settings['blocked_urls']['admin'] == true) {
             $_SHOW_SITE_CHAT = false;
         }
         if ($this->_chat_plugin_settings['blocked_urls']['site'] == true) {
             $_SHOW_SITE_CHAT = false;
         }
     }
     if ($_SHOW_SITE_CHAT == true) {
         $atts = array('id' => 'network-site', 'session_type' => 'network-site');
         $atts = wp_parse_args($atts, $this->_chat_options['network-site']);
         $content .= $this->process_chat_shortcode($atts);
     }
     return $content;
 }
function bp_group_admin_permalink($deprecated = true, $deprecated2 = false)
{
    if (!$deprecated) {
        return bp_get_group_admin_permalink();
    } else {
        echo bp_get_group_admin_permalink();
    }
}
 function chat_network_site_box_container($content = '')
 {
     global $bp;
     // We don't want to add the container on our pop-out template.
     if ($this->using_popup_out_template == true) {
         return;
     }
     $site_chat_box = '';
     if (!is_admin()) {
         if ($this->get_option('bottom_corner', 'network-site') == 'enabled') {
             $_SHOW_SITE_CHAT = true;
         } else {
             $_SHOW_SITE_CHAT = false;
         }
         if ($_SHOW_SITE_CHAT == true) {
             // Are we viewing a BuddyPress Group pages?
             if (isset($bp->groups->current_group->id) && intval($bp->groups->current_group->id)) {
                 // Are we viewing the Group Admin screen?
                 $bp_group_admin_url_path = parse_url(bp_get_group_admin_permalink($bp->groups->current_group), PHP_URL_PATH);
                 $request_url_path = parse_url(get_option('siteurl') . $_SERVER['REQUEST_URI'], PHP_URL_PATH);
                 if (!empty($request_url_path) && !empty($bp_group_admin_url_path) && substr($request_url_path, 0, strlen($bp_group_admin_url_path)) == $bp_group_admin_url_path) {
                     if ($this->get_option('bp_group_admin_show_site', 'global') != "enabled") {
                         $_SHOW_SITE_CHAT = false;
                     }
                 } else {
                     if ($this->get_option('bp_group_show_site', 'global') != "enabled") {
                         $_SHOW_SITE_CHAT = false;
                     }
                 }
             } else {
                 if ($this->_chat_plugin_settings['blocked_urls']['site'] == true) {
                     $_SHOW_SITE_CHAT = false;
                 } else {
                     if ($this->get_option('blocked_on_shortcode', 'site') == 'enabled') {
                         global $post;
                         if (!empty($post->post_content) && strstr($post->post_content, '[chat ') !== false) {
                             $_SHOW_SITE_CHAT = false;
                         }
                     }
                 }
             }
         }
     } else {
         if ($this->get_option('bottom_corner_wpadmin', 'network-site') == 'enabled') {
             $_SHOW_SITE_CHAT = true;
         } else {
             $_SHOW_SITE_CHAT = false;
         }
         if ($this->_chat_plugin_settings['blocked_urls']['admin'] == true) {
             $_SHOW_SITE_CHAT = false;
         }
         if ($this->_chat_plugin_settings['blocked_urls']['site'] == true) {
             $_SHOW_SITE_CHAT = false;
         }
     }
     if ($_SHOW_SITE_CHAT == true) {
         //			$site_box_height 		= wpmudev_chat_check_size_qualifier($this->get_option('box_height', 'network-site'), array('px'));
         //			$site_box_position_v 	= $this->get_option('box_position_v', 'network-site');
         //			$site_box_position_h 	= $this->get_option('box_position_h', 'network-site');
         //			$site_box_offset_v 		= wpmudev_chat_check_size_qualifier($this->get_option('box_offset_v', 'network-site'), array('px'));
         //			$site_box_offset_h 		= wpmudev_chat_check_size_qualifier($this->get_option('box_offset_h', 'network-site'), array('px'));
         //			$site_box_spacing_h 	= wpmudev_chat_check_size_qualifier($this->get_option('box_spacing_h', 'network-site'), array('px'));
         //
         //			if ($site_box_position_h == "left")
         //				$site_box_spacing = "0 ". $site_box_spacing_h .' 0 0';
         //			else
         //				$site_box_spacing = "0 0 0 ". $site_box_spacing_h .'';
         //
         //			$site_box_float 		= $site_box_position_h;
         //			$site_box_position_h 	= $site_box_position_h.': '. $site_box_offset_h .';';
         //
         //			$height_offset = 0;
         //			if ($site_box_position_v == "bottom") {
         //				$border_width = intval($this->get_option('box_border_width', 'network-site'));
         //				if ($border_width > 0) {
         //					$height_offset = wpmudev_chat_check_size_qualifier($border_width*2, array('px'));
         //				}
         //			}
         //
         //			$site_box_position_v 	= $site_box_position_v.': '. $site_box_offset_v .';';
         //
         //
         $atts = array('id' => 'network-site', 'session_type' => 'network-site');
         $atts = wp_parse_args($atts, $this->_chat_options['network-site']);
         //echo "atts<pre>"; print_r($atts); echo "</pre>";
         $content .= $this->process_chat_shortcode($atts);
         //			if (!empty($content)) {
         //				$content .= '<style type="text/css">';
         //				$content .= 'div.wpmudev-chat-box.wpmudev-chat-box-site {  margin: 0; padding: 0;
         //					position: fixed; '. $site_box_position_h .' '. $site_box_position_v .' z-index: 10000;  margin: '. $site_box_spacing .'; padding: 0; } ';
         //				$content .= '</style>';
         //				if ((isset($_GET['page'])) && ($_GET['page'] == 'chat_session_logs')) {
         //
         //				} else {
         //					if ($this->get_option('box_shadow_show', 'network-site') == "enabled") {
         //
         //					$content .= '<style type="text/css">';
         //					$content .= 'div.wpmudev-chat-box.wpmudev-chat-box-network-site {
         //							box-shadow: '.
         //							wpmudev_chat_check_size_qualifier($this->get_option('box_shadow_v', 'network-site'), array('px')) .' '.
         //							wpmudev_chat_check_size_qualifier($this->get_option('box_shadow_h', 'network-site'), array('px')) .' '.
         //							wpmudev_chat_check_size_qualifier($this->get_option('box_shadow_blur', 'network-site'), array('px')) .' '.
         //							wpmudev_chat_check_size_qualifier($this->get_option('box_shadow_spread', 'network-site'), array('px')) .' '.
         //							$this->get_option('box_shadow_color', 'site') .' }';
         //					$content .= '</style>';
         //				}
         //			}
         //		}
     }
     return $content;
 }
 function widget($args, $instance)
 {
     global $wpmudev_chat, $post, $bp;
     if ($wpmudev_chat->get_option('blocked_on_shortcode', 'widget') == "enabled") {
         if (strstr($post->post_content, '[chat ') !== false) {
             return;
         }
     }
     if (isset($bp->groups->current_group->id) && intval($bp->groups->current_group->id)) {
         // Are we viewing the Group Admin screen?
         $bp_group_admin_url_path = parse_url(bp_get_group_admin_permalink($bp->groups->current_group), PHP_URL_PATH);
         $request_url_path = parse_url(get_option('siteurl') . $_SERVER['REQUEST_URI'], PHP_URL_PATH);
         if (!empty($request_url_path) && !empty($bp_group_admin_url_path) && substr($request_url_path, 0, strlen($bp_group_admin_url_path)) == $bp_group_admin_url_path) {
             if ($wpmudev_chat->get_option('bp_group_admin_show_widget', 'global') != "enabled") {
                 return;
             }
         } else {
             if ($wpmudev_chat->get_option('bp_group_show_widget', 'global') != "enabled") {
                 return;
             }
         }
     }
     if ($wpmudev_chat->_chat_plugin_settings['blocked_urls']['widget'] != true) {
         $instance['id'] = $this->id;
         //echo "instance before<pre>"; print_r($instance); echo "</pre>";
         //die();
         $instance = wp_parse_args($this->convert_settings_keys($instance), $this->defaults);
         //echo "instance<pre>"; print_r($instance); echo "</pre>";
         $instance['session_type'] = 'widget';
         $chat_output = $wpmudev_chat->process_chat_shortcode($instance);
         if (!empty($chat_output)) {
             echo $args['before_widget'];
             $title = apply_filters('widget_title', $instance['box_title']);
             if ($title) {
                 echo $args['before_title'] . $title . $args['after_title'];
             }
             echo $chat_output;
             echo $args['after_widget'];
         }
     }
 }
Example #11
0
 /**
  * Map a topic permalink to the current group forum
  *
  * @since bbPress (r3802)
  * @param string $url
  * @param int $reply_id
  * @return string
  */
 public function map_reply_permalink_to_group($url, $reply_id)
 {
     $slug = get_post_field('post_name', $reply_id);
     $forum_id = bbp_get_reply_forum_id($reply_id);
     $group_ids = bbp_get_forum_group_ids($forum_id);
     // If the topic is not associated with a group, don't mess with it
     if (!empty($group_ids)) {
         // @todo Multiple group forums/forum groups
         $group_id = $group_ids[0];
         $group = groups_get_group(array('group_id' => $group_id));
         if (bp_is_group_admin_screen($this->forums_slug)) {
             $group_permalink = bp_get_group_admin_permalink($group);
         } else {
             $group_permalink = bp_get_group_permalink($group);
         }
         $url = trailingslashit($group_permalink . $this->forums_slug . '/' . $this->topic_slug . '/' . $slug);
     }
     return $url;
 }