Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 17 replies - 51 through 67 (of 67 total)
  • @talk2manoj

    Participant
    function bp_group_admin_only(){
    global $bp, $current_blog;
    global $group_obj, $is_single_group;

    if (!is_site_admin()){
    remove_action( 'wp', 'groups_setup_nav', 2 );
    }
    }

    /* I am using the same function (groups_setup_nav) as BuddyPress to avoid
    * any hacking to the original code
    */

    function manoj_groups_setup_nav(){

    if (!is_site_admin() ){

    global $bp, $current_blog;
    global $group_obj, $is_single_group;

    if ( $group_id = BP_Groups_Group::group_exists($bp->current_action) ) {
    /* This is a single group page. */
    $is_single_group = true;
    $group_obj = new BP_Groups_Group( $group_id );

    /* Using "item" not "group" for generic support in other components. */
    if ( is_site_admin() )
    $bp->is_item_admin = 1;
    else
    $bp->is_item_admin = groups_is_user_admin( $bp->loggedin_user->id, $group_obj->id );

    /* If the user is not an admin, check if they are a moderator */
    if ( !$bp->is_item_admin )
    $bp->is_item_mod = groups_is_user_mod( $bp->loggedin_user->id, $group_obj->id );

    /* Is the logged in user a member of the group? */
    $is_member = ( groups_is_user_member( $bp->loggedin_user->id, $group_obj->id ) ) ? true : false;

    /* Should this group be visible to the logged in user? */
    $is_visible = ( 'public' == $group_obj->status || $is_member ) ? true : false;
    }

    /* Add 'Groups' to the main navigation */
    bp_core_add_nav_item( __('Groups', 'buddypress'), $bp->groups->slug );

    if ( $bp->displayed_user->id )
    bp_core_add_nav_default( $bp->groups->slug, 'groups_screen_my_groups', 'my-groups' );

    $groups_link = $bp->loggedin_user->domain . $bp->groups->slug . '/';

    /* Add the subnav items to the groups nav item */
    bp_core_add_subnav_item( $bp->groups->slug, 'my-groups', __('My Groups', 'buddypress'), $groups_link, 'groups_screen_my_groups', 'my-groups-list' );
    //bp_core_add_subnav_item( $bp->groups->slug, 'create', __('Create a Group', 'buddypress'), $groups_link, 'groups_screen_create_group', false, bp_is_home() );
    bp_core_add_subnav_item( $bp->groups->slug, 'invites', __('Invites', 'buddypress'), $groups_link, 'groups_screen_group_invites', false, bp_is_home() );

    if ( $bp->current_component == $bp->groups->slug ) {

    if ( bp_is_home() && !$is_single_group ) {

    $bp->bp_options_title = __('My Groups', 'buddypress');

    } else if ( !bp_is_home() && !$is_single_group ) {

    $bp->bp_options_avatar = bp_core_get_avatar( $bp->displayed_user->id, 1 );
    $bp->bp_options_title = $bp->displayed_user->fullname;

    } else if ( $is_single_group ) {
    // We are viewing a single group, so set up the
    // group navigation menu using the $group_obj global.

    /* When in a single group, the first action is bumped down one because of the
    group name, so we need to adjust this and set the group name to current_item. */
    $bp->current_item = $bp->current_action;
    $bp->current_action = $bp->action_variables[0];
    array_shift($bp->action_variables);

    $bp->bp_options_title = bp_create_excerpt( $group_obj->name, 1 );
    $bp->bp_options_avatar = '<img src="' . $group_obj->avatar_thumb . '" alt="Group Avatar Thumbnail" />';

    $group_link = $bp->root_domain . '/' . $bp->groups->slug . '/' . $group_obj->slug . '/';

    // If this is a private or hidden group, does the user have access?
    if ( 'private' == $group_obj->status || 'hidden' == $group_obj->status ) {
    if ( groups_is_user_member( $bp->loggedin_user->id, $group_obj->id ) &amp;&amp; is_user_logged_in() )
    $has_access = true;
    else
    $has_access = false;
    } else {
    $has_access = true;
    }

    // Reset the existing subnav items
    bp_core_reset_subnav_items($bp->groups->slug);
    // bp_core_add_nav_default( $bp->groups->slug, 'groups_screen_group_home', 'home' );
    bp_core_add_subnav_item( $bp->groups->slug, 'home', __('Home', 'buddypress'), $group_link, 'groups_screen_group_home', 'group-home' );

    // If the user is a group mod or more, then show the group admin nav item */
    if ( $bp->is_item_mod || $bp->is_item_admin )
    bp_core_add_subnav_item( $bp->groups->slug, 'admin', __('Admin', 'buddypress'), $group_link , 'groups_screen_group_admin', 'group-admin', ( $bp->is_item_admin + (int)$bp->is_item_mod ) );

    // If this is a private group, and the user is not a member, show a "Request Membership" nav item.
    if ( !$has_access &amp;&amp; !groups_check_for_membership_request( $bp->loggedin_user->id, $group_obj->id ) &amp;&amp; $group_obj->status == 'private' )
    bp_core_add_subnav_item( $bp->groups->slug, 'request-membership', __('Request Membership', 'buddypress'), $group_link , 'groups_screen_group_request_membership', 'request-membership' );

    if ( $has_access &amp;&amp; $group_obj->enable_forum &amp;&amp; function_exists('bp_forums_setup') )
    bp_core_add_subnav_item( $bp->groups->slug, 'forum', __('Forum', 'buddypress'), $group_link , 'groups_screen_group_forum', 'group-forum', $is_visible);

    if ( $has_access &amp;&amp; $group_obj->enable_wire &amp;&amp; function_exists('bp_wire_install') )
    bp_core_add_subnav_item( $bp->groups->slug, 'wire', __('Wire', 'buddypress'), $group_link, 'groups_screen_group_wire', 'group-wire', $is_visible );

    if ( $has_access &amp;&amp; $group_obj->enable_photos &amp;&amp; function_exists('bp_gallery_install') )
    bp_core_add_subnav_item( $bp->groups->slug, 'photos', __('Photos', 'buddypress'), $group_link, 'groups_screen_group_photos', 'group-photos', $is_visible );

    if ( $has_access )
    bp_core_add_subnav_item( $bp->groups->slug, 'members', __('Members', 'buddypress'), $group_link, 'groups_screen_group_members', 'group-members', $is_visible );

    if ( is_user_logged_in() &amp;&amp; groups_is_user_member( $bp->loggedin_user->id, $group_obj->id ) ) {
    if ( function_exists('friends_install') )
    bp_core_add_subnav_item( $bp->groups->slug, 'send-invites', __('Send Invites', 'buddypress'), $group_link, 'groups_screen_group_invite', 'group-invite', $is_member );

    bp_core_add_subnav_item( $bp->groups->slug, 'leave-group', __('Leave Group', 'buddypress'), $group_link, 'groups_screen_group_leave', 'group-leave', $is_member );
    }
    }
    }
    }
    }
    add_action( 'wp', 'bp_group_admin_only',1);
    add_action( 'wp', 'manoj_groups_setup_nav',2);

    @talk2manoj

    Participant

    I have done this by

    1. If user is not is_site_admin() it calls remove_action

    2. Added a new action to my own function, which basically is a copy of BuddyPress function except the code to add bp_core_add_subnav_item

    Is it a good practice to avoid any hacking to the core? Please suggest.

    @talk2manoj

    Participant

    I will work towards enhancing this plugin whenever I get time.

    Please put your wishlist regarding bulk import users at plugin page.

    @talk2manoj

    Participant

    Thanks for the reply, But both your suggestions seems to be removing just menu, if some goes directly to /groups/create he can still fill a form.

    @talk2manoj

    Participant

    You can find documentation at https://codex.buddypress.org/

    For photo album you can use http://bp-dev.org/plugins/bpdev-flickr/ plugin

    @talk2manoj

    Participant

    Check your wp-config.php around line no. 40 for

    ‘define(‘PATH_CURRENT_SITE’, ‘current_site_path’ );’

    @talk2manoj

    Participant

    Can you provide me blog URL.

    @talk2manoj

    Participant

    Hi Nicola,

    I have tried method suggested by you but its not working…

    $bp->bp_options_nav[\'groups\'][\'create\']=false;

    Can you provide some help on this

    @talk2manoj

    Participant

    Are you using BuddyPress or Just WPMU?

    Please let me know the error while activating the plugin.

    @talk2manoj

    Participant

    No, It will import all data from the given box in [|] delimit format. So you can format your data as per given example and import.

    Also currently it doesn’t have any functionality to import the password.

    Are you using any data encryption for password?

    @talk2manoj

    Participant

    You need to add a filter to the content which check for external link and accordingly modify the same.

    @talk2manoj

    Participant

    In that case you can take the code or functions from widget and use them in your theme.

    @talk2manoj

    Participant

    You can make use of widgets available in BuddyPress and WordPress.

    @talk2manoj

    Participant

    You might make use of following code

    //Main blog has always id as 1, so you can write

    get_header();

    if($wpdb->blogid == 1) {
    //do something
    } else{
    //do this
    }

    @talk2manoj

    Participant

    Hi,

    We had same problem when we moved our installation to WordPress MU + BuddyPress

    So, I have developed a plugin for importing members to WordPress MU + BuddyPress installation.

    It might be useful for you as well, please check it in https://buddypress.org/extend/plugins/

    @talk2manoj

    Participant

    Hi Andy,

    If I want to implement this in RC-1, where do I need to make changes?

    Regards

    Manoj

    @talk2manoj

    Participant

    There seems to be permission issue

    First check your mod_rewrite and try following

    chown -R yourusername wwwdirectory

    or

    chown -R yourusername 755 wwwdirectory

    Hope this helps

Viewing 17 replies - 51 through 67 (of 67 total)
Skip to toolbar