Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • if you want to modify that behavior you can edit the theme files which i did for my community. users browsing the page don’t see anything unless they register. i used the wordpress-function is_user_logged_in()
    files to consider:
    /wp-content/plugins/buddypress/bp-themes/bp-default/activity/activity-loop.php
    and to hide the rss-button (private groups still in rss if you know the link or browse the source code – but users not logged using the site don’t see anything):
    /wp-content/plugins/buddypress/bp-themes/bp-default/activity/index.php

    for sure – but the bug is open for 15 months ( https://buddypress.trac.wordpress.org/ticket/2576 ) and wasn’t fixed – and therefore i thought if you tidy the code up you could add it to core as a patch.

    As there was a php error if the user who uses the forum directory is not logged in the following modification was done:

    Code:
    //Get current user
    $current_user = wp_get_current_user();

    //Fetch forums IDs to which user has access
    $i = 0;
    $result = mysql_query("SELECT meta_value FROM oba_bp_groups_members, oba_bp_groups_groupmeta WHERE user_id = ".$current_user->ID." and oba_bp_groups_members.group_id = oba_bp_groups_groupmeta.group_id and oba_bp_groups_groupmeta.meta_key=’forum_id’")
    or die ("MySQL-Error: " . mysql_error());
    while ( $row = mysql_fetch_array($result)) {
    $res[$i] = $row["meta_value"];
    $i++;
    }

    //Implode forum ids into a comma sperated list e.g: 3,5,7
    if ( !empty( $res ) )
    $comma_separated = implode(",", $res);

    // Set this for groups
    //Old //$parts[‘groups’] = "(gm.meta_key = ‘forum_id’ AND gm.meta_value = t.forum_id)";
    $parts[‘groups’] = "(gm.meta_key = ‘forum_id’ AND gm.meta_value = t.forum_id AND gm.meta_value IN (".$comma_separated."))";

    You also need to add the functionality that logged in users can potentially see all forums (the above code then filters out forums the user is not member of):

    after

    Code:
    // Are we a super admin?
    elseif ( is_super_admin() )
    unset( $parts[‘private’] );

    add

    Code:
    // Allow the forum directory to display private forums for users
    elseif ( is_user_logged_in() )
    unset( $parts[‘private’] );

    I still struggle to get this view running corectly.

    I managed to find out how to pull all group ID’s for a given userid:

    SELECT group_id FROM `xyz_bp_groups_members` where `user_id` = 1

    And how to get all forum_id’s for a given group:

    SELECT meta_value FROM `xyz_bp_groups_groupmeta` where group_id = 1 and meta_key = ‘forum_id’

    My idea was to do a join as i didn’t know how to follow your directions correctly @boonebgorges.
    Therefore i tried to modify the original $sql (line 83 in bp-group-filters.php):

    $sql .= ‘JOIN ‘ . $bp->groups->table_name . ‘ AS g LEFT JOIN ‘ . $bp->groups->table_name_groupmeta . ‘ AS gm ON g.id = gm.group_id ‘;

    with this extended version:

    $sql .= ‘JOIN ‘ . $bp->groups->table_name . ‘ AS g LEFT JOIN ‘ . $bp->groups->table_name_groupmeta . ‘ AS gm, oba_bp_groups_members AS gu ON g.id = gm.group_id AND gu.group_id = gm.group_id’;

    unfortunately i have not enough know-how how the buddypress-core is working correctly. Any hints on how to do this properly?

    Many Thanks!

    are you using bp 1.5.1? if so there seems to be a bug if you change the label of the “Display Name” Profile-Field. You have to leave it to the default value.

    i try to get it running and provide my version if it works.

    maybe interesting for other users with private groups heavily used:
    i modified the function “groups_add_forum_where_sql” starting at line 88 in /bp-groups/bp-groups-filters.php.
    I added the following block at line 110:
    elseif ( is_user_logged_in() )
    unset( $parts );
    therefore all logged in users get the same view as an admin and see updates in all private group forums (error message when clicking of threads they are not allowed to). next step would be to filter out group forums where the user has no permission.
    ==
    is there an function which could be used for that filtering in bp (replacing is_user_logged_in())?
    or is custom sql code needed here?

    there is not to much activity on this ticket unfortunately.

    especially if private groups are heavily used it is hardly comprehensible for users that some threads appear, but others are not displayed. this was the feedback of my beta test users (i’am just in the process of launching a new community for gamers and some power users of my old page are testing my bp installation).

    If it is not possible to use the Group-Forums-Directory- is there any other Point where a user can view all new threads they are able to read?

    is it still that hard to implement the bugfix with the new 1.5 api?

    and already fixed – god are you fast – I’am impressed :)

Viewing 9 replies - 1 through 9 (of 9 total)
Skip to toolbar