Example #1
0
 /**
  *
  */
 function miss_is_bp()
 {
     if (function_exists('bp_is_group') && (bp_is_blog_page() || bp_is_my_profile() || bp_is_my_profile() || is_front_page() || bp_is_component_front_page('activity') || bp_is_directory() || bp_is_profile_component() || bp_is_activity_component() || bp_is_blogs_component() || bp_is_messages_component() || bp_is_friends_component() || bp_is_groups_component() || bp_is_settings_component() || bp_is_user_activity() || bp_is_user_friends_activity() || bp_is_activity_permalink() || bp_is_user_profile() || bp_is_profile_edit() || bp_is_change_avatar() || bp_is_user_groups() || bp_is_group() || bp_is_group_home() || bp_is_group_create() || bp_is_group_admin_page() || bp_is_group_forum() || bp_is_group_activity() || bp_is_group_forum_topic() || bp_is_group_forum_topic_edit() || bp_is_group_members() || bp_is_group_invites() || bp_is_group_membership_request() || bp_is_group_leave() || bp_is_group_single() || bp_is_user_blogs() || bp_is_user_recent_posts() || bp_is_user_recent_commments() || bp_is_create_blog() || bp_is_user_friends() || bp_is_friend_requests() || bp_is_user_messages() || bp_is_messages_inbox() || bp_is_messages_sentbox() || bp_is_notices() || bp_is_messages_compose_screen() || bp_is_activation_page() || bp_is_register_page())) {
         return true;
     }
     return false;
 }
Example #2
0
/**
 * cover photo subnav callback function. renders the title content and the template
 * files that are needed to process the upload and cropping of the photo
 * 
 * @author dunhakdis<*****@*****.**>
 * @package bp-cover-photo
 * @since 1.0
 * @return void
 */
function bcp_cover_photo_screen()
{
    // store buddypress object to $bp
    // same as global $bp;
    $bp = buddypress();
    // template directory
    $template = 'members';
    // filter function for uploading images
    $upload_filter = 'xprofile_avatar_upload_dir';
    // the id of the user
    $item_id = bp_displayed_user_id();
    if (bp_is_group_single()) {
        $template = 'groups';
        $upload_filter = 'groups_avatar_upload_dir';
        $item_id = $bp->groups->current_group->id;
    }
    // load jcrop
    add_action('wp_enqueue_scripts', 'bp_cover_photo_scripts');
    //add title and content here - last is to call the members plugin.php template
    add_action('bp_template_title', 'bp_cover_photo_screen_title');
    add_action('bp_template_content', 'bp_cover_photo_screen_content');
    // handle uploading of cover photo
    if (!empty($_FILES)) {
        // Check the nonce
        check_admin_referer('bp_avatar_upload');
        // create avatar_admin object to prevent notices
        // from empty variables and objects
        if (!isset($bp->avatar_admin)) {
            $bp->avatar_admin = new stdClass();
        }
        // Pass the file to the avatar upload handler
        $bp = buddypress();
        if (bp_core_avatar_handle_upload($_FILES, $upload_filter)) {
            // adjust current step
            $bp->avatar_admin->step = 'crop-image';
        }
    }
    // If the image cropping is done, crop the image and save a full/thumb version
    if (isset($_POST['avatar-crop-submit'])) {
        // Check the nonce
        check_admin_referer('bp_avatar_cropstore');
        $groups_slug = bcp_get_groups_slug();
        $args = array('item_id' => $item_id, 'original_file' => $_POST['image_src'], 'crop_x' => $_POST['x'], 'crop_y' => $_POST['y'], 'crop_w' => $_POST['w'], 'crop_h' => $_POST['h']);
        // change avatar path for groups
        if (bp_is_group_single()) {
            $args['avatar_dir'] = 'group-avatars';
        }
        if (!bcp_core_avatar_handle_crop($args)) {
            bp_core_add_message(__('There was a problem cropping your cover photo.', 'buddypress'), 'error');
        } else {
            // update the default cover photo image for groups
            if (isset($_POST['global-coverphoto'])) {
                $type = wp_kses($_POST['global-coverphoto'], array());
                $args = array('object_id' => $item_id, 'type' => $type);
                $new_cover_photo = bcp_fetch_cover_photo($args);
                update_option('__bcp_default_' . $type . '_cover_photo', $new_cover_photo['full']);
            }
            if (bp_is_group_single()) {
                // if its a single group
                // redirect to group home page
                $current_displayed_group_url = trailingslashit(get_bloginfo('url') . '/' . $groups_slug . '/' . $bp->groups->current_group->slug . '/');
                groups_update_groupmeta($item_id, 'cover-photo-timestamp', md5(time()));
                bp_core_redirect($current_displayed_group_url);
            } else {
                //otherwise, redirect to members profile
                update_user_meta($item_id, 'cover-photo-timestamp', md5(time()));
                bp_core_redirect(bp_displayed_user_domain());
            }
            bp_core_add_message(__('Your new cover photo was uploaded successfully.', 'buddypress'));
        }
    }
    bp_core_load_template(apply_filters('bp_core_template_plugin', $template . '/single/plugins'));
    return;
}
Example #3
0
    esc_html_e('Describe what this project is all about. You can edit this later.', 'task_breaker');
    ?>
" required ></textarea>

			</div>

			<?php 
    $current_user_groups = task_breaker_get_current_user_groups();
    ?>

			<?php 
    $group_id = 0;
    ?>

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

				<?php 
        $group_id = bp_get_group_id();
        ?>

			<?php 
    }
    ?>

			<?php 
    if (!empty($current_user_groups)) {
        ?>

				<div class="task_breaker-form-field">
Example #4
0
 /**
  * Similar to the post_class() function, but for BP. This is NOT used by core Suffusion, but is useful for child themes using BP.
  * This might be defined by the Suffusion BuddyPress Pack for BP users of Suffusion, but is included conditionally here so
  * that the theme and the plugin can be used independently of each other and so that one version of Suffusion can work with an older
  * version of the BP pack.
  *
  * @since 3.6.7
  * @param bool $custom
  * @param bool $echo
  * @return bool|string
  */
 function suffusion_bp_content_class($custom = false, $echo = true)
 {
     if (!function_exists('bp_is_group')) {
         return false;
     }
     $css = array();
     $css[] = 'post';
     if (function_exists('bp_is_profile_component') && bp_is_profile_component()) {
         $css[] = 'profile-component';
     }
     if (function_exists('bp_is_activity_component') && bp_is_activity_component()) {
         $css[] = 'activity-component';
     }
     if (function_exists('bp_is_blogs_component') && bp_is_blogs_component()) {
         $css[] = 'blogs-component';
     }
     if (function_exists('bp_is_messages_component') && bp_is_messages_component()) {
         $css[] = 'messages-component';
     }
     if (function_exists('bp_is_friends_component') && bp_is_friends_component()) {
         $css[] = 'friends-component';
     }
     if (function_exists('bp_is_groups_component') && bp_is_groups_component()) {
         $css[] = 'groups-component';
     }
     if (function_exists('bp_is_settings_component') && bp_is_settings_component()) {
         $css[] = 'settings-component';
     }
     if (function_exists('bp_is_member') && bp_is_member()) {
         $css[] = 'member';
     }
     if (function_exists('bp_is_user_activity') && bp_is_user_activity()) {
         $css[] = 'user-activity';
     }
     if (function_exists('bp_is_user_friends_activity') && bp_is_user_friends_activity()) {
         $css[] = 'user-friends-activity';
     }
     if (function_exists('bp_is_activity_permalink') && bp_is_activity_permalink()) {
         $css[] = 'activity-permalink';
     }
     if (function_exists('bp_is_user_profile') && bp_is_user_profile()) {
         $css[] = 'user-profile';
     }
     if (function_exists('bp_is_profile_edit') && bp_is_profile_edit()) {
         $css[] = 'profile-edit';
     }
     if (function_exists('bp_is_change_avatar') && bp_is_change_avatar()) {
         $css[] = 'change-avatar';
     }
     if (function_exists('bp_is_user_groups') && bp_is_user_groups()) {
         $css[] = 'user-groups';
     }
     if (function_exists('bp_is_group') && bp_is_group()) {
         $css[] = 'group';
     }
     if (function_exists('bp_is_group_home') && bp_is_group_home()) {
         $css[] = 'group-home';
     }
     if (function_exists('bp_is_group_create') && bp_is_group_create()) {
         $css[] = 'group-create';
     }
     if (function_exists('bp_is_group_admin_page') && bp_is_group_admin_page()) {
         $css[] = 'group-admin-page';
     }
     if (function_exists('bp_is_group_forum') && bp_is_group_forum()) {
         $css[] = 'group-forum';
     }
     if (function_exists('bp_is_group_activity') && bp_is_group_activity()) {
         $css[] = 'group-activity';
     }
     if (function_exists('bp_is_group_forum_topic') && bp_is_group_forum_topic()) {
         $css[] = 'group-forum-topic';
     }
     if (function_exists('bp_is_group_forum_topic_edit') && bp_is_group_forum_topic_edit()) {
         $css[] = 'group-forum-topic-edit';
     }
     if (function_exists('bp_is_group_members') && bp_is_group_members()) {
         $css[] = 'group-members';
     }
     if (function_exists('bp_is_group_invites') && bp_is_group_invites()) {
         $css[] = 'group-invites';
     }
     if (function_exists('bp_is_group_membership_request') && bp_is_group_membership_request()) {
         $css[] = 'group-membership-request';
     }
     if (function_exists('bp_is_group_leave') && bp_is_group_leave()) {
         $css[] = 'group-leave';
     }
     if (function_exists('bp_is_group_single') && bp_is_group_single()) {
         $css[] = 'group-single';
     }
     if (function_exists('bp_is_user_blogs') && bp_is_user_blogs()) {
         $css[] = 'user-blogs';
     }
     if (function_exists('bp_is_user_recent_posts') && bp_is_user_recent_posts()) {
         $css[] = 'user-recent-posts';
     }
     if (function_exists('bp_is_user_recent_commments') && bp_is_user_recent_commments()) {
         $css[] = 'user-recent-commments';
     }
     if (function_exists('bp_is_create_blog') && bp_is_create_blog()) {
         $css[] = 'create-blog';
     }
     if (function_exists('bp_is_user_friends') && bp_is_user_friends()) {
         $css[] = 'user-friends';
     }
     if (function_exists('bp_is_friend_requests') && bp_is_friend_requests()) {
         $css[] = 'friend-requests';
     }
     if (function_exists('bp_is_user_messages') && bp_is_user_messages()) {
         $css[] = 'user-messages';
     }
     if (function_exists('bp_is_messages_inbox') && bp_is_messages_inbox()) {
         $css[] = 'messages-inbox';
     }
     if (function_exists('bp_is_messages_sentbox') && bp_is_messages_sentbox()) {
         $css[] = 'messages-sentbox';
     }
     if (function_exists('bp_is_notices') && bp_is_notices()) {
         $css[] = 'notices';
     }
     if (function_exists('bp_is_messages_compose_screen') && bp_is_messages_compose_screen()) {
         $css[] = 'messages-compose-screen';
     }
     if (function_exists('bp_is_single_item') && bp_is_single_item()) {
         $css[] = 'single-item';
     }
     if (function_exists('bp_is_activation_page') && bp_is_activation_page()) {
         $css[] = 'activation-page';
     }
     if (function_exists('bp_is_register_page') && bp_is_register_page()) {
         $css[] = 'register-page';
     }
     $css[] = 'fix';
     if (is_array($custom)) {
         foreach ($custom as $class) {
             if (!in_array($class, $css)) {
                 $css[] = esc_attr($class);
             }
         }
     } else {
         if ($custom != false) {
             $css[] = $custom;
         }
     }
     $css_class = implode(' ', $css);
     if ($echo) {
         echo ' class="' . $css_class . '" ';
     }
     return ' class="' . $css_class . '" ';
 }
Example #5
0
function kleo_bp_get_component_id()
{
    $current_page_id = NULL;
    $page_array = get_option('bp-pages');
    if (bp_is_register_page()) {
        /* register page */
        $current_page_id = $page_array['register'];
    } elseif (bp_is_members_component() || bp_is_user()) {
        /* members component */
        $current_page_id = $page_array['members'];
    } elseif (bp_is_activity_directory()) {
        /* activity directory */
        $current_page_id = $page_array['activity'];
    } elseif (bp_is_groups_directory() || bp_is_group_single()) {
        /* groups directory */
        $current_page_id = $page_array['groups'];
    } elseif (bp_is_activation_page()) {
        /* activation page */
        $current_page_id = $page_array['activate'];
    }
    return $current_page_id;
}
function buddyforms_pig_after_save_post_redirect($permalink)
{
    global $buddyforms;
    if (!bp_is_group_single()) {
        return $permalink;
    }
    if (isset($buddyforms[$_POST['form_slug']]['after_submit'])) {
        if ($buddyforms[$_POST['form_slug']]['after_submit'] == 'display_posts_list') {
            $permalink = bp_get_group_permalink() . bp_current_action();
        }
    }
    //echo $permalink;
    return $permalink;
}