Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'group_id'

Viewing 25 results - 451 through 475 (of 564 total)
  • Author
    Search Results
  • #86485
    Boone Gorges
    Keymaster

    From inside of the group, to check if the logged in user is the group admin,
    if ( bp_group_is_admin() )
    Elsewhere:
    if ( groups_is_user_admin( $user_id, $group_id ) )

    #85020
    Boone Gorges
    Keymaster

    @ajaxmac – If you want to get group activity updates, you’ll want to query for *activities* rather than groups. Check out bp_has_activities() https://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-activity-stream-loop/. For example, you can get the last five activity updates from a group with a loop containing the following query:
    if ( bp_has_activities( 'max=5&object=groups&primary_id=' . $group_id ) ) (obviously you’ll have to get that $group_id from somewhere).

    Then use the rest of the activity loop to display the content. Check out buddypress/bp-themes/bp-default/activity/entry.php to see how bp-default displays a single activity item within the loop, and activity-loop.php to see an (albeit complicated) example of how bp-default initializes the loop with a query.

    rich! @ etiviti
    Participant

    That is because the check within groups_post_update allows the site_admin


    /* Be sure the user is a member of the group before posting. */
    if ( !is_site_admin() && !groups_is_user_member( $user_id, $group_id ) )
    return false;

    #84150
    harderstuff
    Member

    It looks like the fix is to change:
    $group_ids = $this->get_group_ids( $user_id );

    to:
    $group_ids = BP_Groups_Member::get_group_ids( $user_id );

    in bp-groups-classes.php

    #83984

    In reply to: Can’t delete user

    LPH2005
    Participant

    Anyway, it looks like $this is being used improperly.

    $group_ids = $this->get_group_ids( $user_id );

    http://php.syntaxerrors.info/index.php?title=Using_$this_when_not_in_object_context

    It’s a php4 versus php5 issue … but … hopefully a programmer can help here.

    #83981

    In reply to: Can’t delete user

    LPH2005
    Participant

    I can’t help much (hopefully others will chime in here) but the error comes from this function:

    function delete_all_for_user( $user_id ) {
    global $wpdb, $bp;

    // Get all the group ids for the current user’s groups and update counts
    $group_ids = $this->get_group_ids( $user_id );
    foreach ( $group_ids->groups as $group_id ) {
    groups_update_groupmeta( $group_id, ‘total_member_count’, groups_get_total_member_count( $group_id ) – 1 );
    }

    return $wpdb->query( $wpdb->prepare( “DELETE FROM {$bp->groups->table_name_members} WHERE user_id = %d”, $user_id ) );
    }

    #83562
    shamus
    Participant

    Michael Sumner said 11 hours, 41 minutes ago:
    Open the file mentioned, and replace this:

    $group_ids = $this->get_group_ids( $user_id );

    with this:

    $group_ids = BP_Groups_Member::get_group_ids( $user_id );

    And right below that, replace this:

    foreach ( $group_ids->groups as $group_id ) {

    with this:

    foreach ( $group_ids as $group_id ) {

    That fixed the issue for me.

    #83543
    Pisanojm
    Participant

    $group_ids = $this->get_group_ids( $user_id ); is on LINE 2105
    foreach ( $group_ids->groups as $group_id ) { is on LINE 2107

    I can CONFIRM this fix has worked for me. @r-a-y

    #83442
    Michael Sumner
    Participant

    Open the file mentioned, and replace this:

    $group_ids = $this->get_group_ids( $user_id );

    with this:

    $group_ids = BP_Groups_Member::get_group_ids( $user_id );

    And right below that, replace this:

    foreach ( $group_ids->groups as $group_id ) {

    with this:

    foreach ( $group_ids as $group_id ) {

    That fixed the issue for me.

    #82328
    Olivia
    Participant

    Thanks ray,
    I tried both

    <?php if ( bp_get_group_id(1) ) { echo ‘yes’; } ?>

    and

    <?php global $bp; if ( $bp->groups->current_group->id == 1 ) { echo ‘yes’; } ?>

    but they are not working…

    r-a-y
    Keymaster

    Depending on the context you’re using this in, this might not work correctly but try:
    bp_get_group_id()

    or:

    global $bp;
    $bp->groups->current_group->id;

    #81666
    rich! @ etiviti
    Participant

    regards to the drop down… the group loop (in theme forums/index.php) which only displays public groups needs another || check for:
    groups_is_user_member( $bp->loggedin_user->id, bp_get_group_id() )

    but if you disable bbPress buddypress component you won’t be able to post any forum topics ;)

    though, if a family site – why not lock down the entire site only to logged in users? (a few threads floating around here how to do that)

    #81578
    rich! @ etiviti
    Participant

    for group admin and group mod?

    built into bp-core:
    function groups_is_user_admin( $user_id, $group_id )
    function groups_is_user_mod( $user_id, $group_id )

    BUT
    those statements will ping the database each time and is not wp_cached

    #81461

    To whom it may concern: I solved the issue by manipulating (not deleting) the doubled DB entry. In the wp_bp_groups_members table, I manually set both the group_id and user_id fields to high values that have no corresponding real equivalents (group, user). Think this now orphaned row won’t do any harm and as far as I can see, the searches like “groups of this user” or “users of this group” result in what I want now.

    #81347
    Aditya Singh
    Participant

    Hi @r-a-y
    Its again you to my rescue! :)
    Thanks. Yeah I had looked up on Bp_core_fetch_avatar function in bp-core-avatars.php file, and that it has a parameter ‘object’ => with the comment that we can use it if we are using filter.

    Its just that I could not figure out how to do it. Tried few things unsuccessfully.

    Would it be possible for you to guide me here. Lets say I am uploading my avatars in the standard file-size in some folder in the format “grpavtr_(group_id).png”, then how do I do it…. Have been stuck with this problem (and one more) for a week now… :(
    I am sure I would go out and have a beer once I’m done with this…. :D

    #81019
    r-a-y
    Keymaster

    @danhay – It’s disabled, but you can still edit it! ;) (it’s kind of a hack!)

    Make sure you’re logged in to the WP admin area, then go to:
    http://example.com/wp-admin/admin.php?page=bp-profile-setup&group_id=1&field_id=1&mode=edit_field

    Change example.com to your website address.

    #80641
    rich! @ etiviti
    Participant

    sure
    https://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-activity-stream-loop/

    set the action to new_blog_post, object to groups, primary_id to the group_id

    #80519
    techguy
    Participant

    You’ll have to know some coding to do this. This will get you started if you know some code.

    You can add the hook to the following:
    add_action( ‘bp_core_signup_user’, ‘join_all_public_groups’, 10, 3 ); //For WP
    add_action( ‘bp_core_activated_user’, ‘join_all_public_groups’, 10, 3 );//For WPMU

    Then, in the “join_all_public_groups” function, you can use this call to have them join groups: groups_join_group( $group_id, $user_id ); You’ll just need to loop through the list of groups.

    #79071
    Hugo Ashmore
    Participant

    The registration page is set up thusly:

    if ( bp_has_profile( 'profile_group_id=1' ):

    profile_group_id=1 being the primary or base group

    Boone Gorges
    Keymaster

    Hi @pollyplummer. You have basically got the right idea, but there are a few problems.

    First, your check for usermeta is not formatted correctly. See https://codex.wordpress.org/Function_Reference/get_usermeta for get_usermeta syntax. In any case, get_usermeta gets stuff from the wp_usermeta table, and I used it as an example in my code to give you a sense of the kind of check you’d want to do. But that’ll only work if you’re checking against a piece of data that is stored using update_usermeta. BP xprofile fields are not. If the “114” information is stored in a bp xprofile field, you will probably have to do some magic with xprofile_get_field() to get it to work. The following will check for a field called “Type” and check to see if the current user’s Type value is 114:

    $field_id = xprofile_get_field_id_from_name( 'Type' );
    $field = xprofile_get_field( $field_id );
    $value = $field->data->value;

    if ( bp_the_profile_group_name() == 'awesome' && $value == '114' ) {

    There’s probably a slicker way to do this, but it works. Again, this is only relevant if you’re storing the salient data in the xprofile tables.

    The second problem is that you don’t want to repeat the bp_has_profile etc stuff inside of the if statement. If you want to feed a profile_group_id argument to bp_has_profile, you should do it in the initial loop.

    Then make sure that you include the markup inside of the conditional if statement. In edit.php, that means everything, including the

    tag, that creates the markup enabling the user to edit that group of profile items.

    @Boone Gorges – thanks for putting me on the right track. I’m still not getting it right. Forgive me if this is really wonky:

    So I’m in the edit.php file and after this part:
    if ( bp_has_profile( ‘profile_group_id=’ . bp_get_current_profile_group_id() ) ) : while ( bp_profile_groups() ) : bp_the_profile_group();

    I have added the following:
    if ( bp_the_profile_group_name() == ‘personal’ && get_usermeta( $bp->loggedin_user->id, ‘114’ ) ) {
    ( bp_has_profile( ‘profile_group_id=1,3,4’ ) ) : while ( bp_profile_groups() ) : bp_the_profile_group();
    }

    The 114 is the meta_value for personal selection in the profile field wherein I ask them to select Personal, Business, or Artist. The profile group name ‘personal’ is one of the field groups that applies only to ‘personal’ accounts. (<- definitely not sure if I'm doing that right)
    I’m thinking I have a few things out of order…

    #78779
    techguy
    Participant

    I’m not sure why bp_get_group_id() wasn’t working in the above function, but this works instead: $bp->groups->current_group->id

    That still leaves these questions:
    1. Is there a simpler way to add an external link to the Group Subnav menu than the code above?
    2. Can you pass variables into the “screen_function” that the nav calls?

    #78626

    In reply to: New to buddypress

    Aditya Singh
    Participant

    @ray
    I have created an excel parser/loader, that enables a user to import data directly into the table they want to from excel….as long as a user customizes the code-fragment depending on the fields present in the table, it is good to go…Will try to frame this into a plugin after 21st of this month…trying to get my site live by 21st…

    re#4 (extra items in group header)
    what i meant was : lets say I want to add “description2”, “description3”, “description4” besides the default “description”, and I want all of them appear on the group header page….now, I have modified the table structure so that it now has few more fields, i.e. “desc2”, “desc3” and “desc4”.
    Here are my follow-up questions on this:
    a. would it be a bad idea to do this way…i mean i have done it hoping that whenever buddypress is updated, my database will be left untouched…wouldn’t it?
    b. I tried creating the functions for fetching desc2 etc based on function bp_group_description() in the bp-groups-templatetags.php, and calling it finally in group-header.php, but it does not work….am i doing something wrong??

    Now this may be asking a lot but could you tell me what possibly could be going wrong here, or may be show be how this should be done, assuming a person has to
    “fetch the details of a field XYZ in the table bp_groups”
    OR
    in case altering with the table bp_groups is a bad idea, I could create a second meta-table with my parameters that has the group_id of the group whom the values of these fields correspond to….but in this case also, how do i fetch the results?

    Boone Gorges
    Keymaster

    If you just want to display static content on the group’s home page in place of the activity stream, I wouldn’t go hacking activity-loop.php (it’s too far upstream, so to speak). In [your-theme]/groups/single/home.php, there’s a string of conditionals starting around line 28. Play with them to get what you want.

    As for the current group id, you can get that from bp_get_group_id() when inside the bp_has_groups() loop.

    rich! @ etiviti
    Participant

    $bp->groups->current_group->id would be the actual group_id for the group you are viewing (within the group component)

    Now if you needed the group_id from an activity record, then the item_id contains the group_id (whereas the component is $bp->group->id )

Viewing 25 results - 451 through 475 (of 564 total)
Skip to toolbar