Search Results for 'group_id'
-
AuthorSearch Results
-
July 21, 2010 at 4:57 pm #86485
In reply to: is_admin for group admin, can’t find it?
Boone Gorges
KeymasterFrom 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 ) )July 10, 2010 at 1:32 pm #85020In reply to: How to query for groups
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.
July 4, 2010 at 4:07 pm #84218rich! @ etiviti
ParticipantThat is because the check within
groups_post_updateallows 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;
July 4, 2010 at 12:38 am #84150In reply to: Activation email is not sent from ’Dashboard Site’
harderstuff
MemberIt 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
July 2, 2010 at 8:03 pm #83984In reply to: Can’t delete user
LPH2005
ParticipantAnyway, 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.
July 2, 2010 at 7:57 pm #83981In reply to: Can’t delete user
LPH2005
ParticipantI 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 ) );
}June 30, 2010 at 5:54 am #83562In reply to: WP 3.0 – BP 1.2.5 500 Error on User Delete
shamus
ParticipantMichael 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.
June 30, 2010 at 2:28 am #83543In reply to: Fatal Error when trying to Delete User
Pisanojm
Participant$group_ids = $this->get_group_ids( $user_id ); is on LINE 2105
foreach ( $group_ids->groups as $group_id ) { is on LINE 2107I can CONFIRM this fix has worked for me. @r-a-y
June 29, 2010 at 6:03 pm #83442In reply to: Fatal Error when trying to Delete User
Michael Sumner
ParticipantOpen 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.
June 22, 2010 at 11:36 pm #82328Olivia
ParticipantThanks 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…
June 22, 2010 at 4:26 pm #81808r-a-y
KeymasterDepending 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;June 16, 2010 at 3:56 pm #81666In reply to: Forum Posts Not Showing Up
rich! @ etiviti
Participantregards 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)
June 15, 2010 at 7:04 pm #81578In reply to: Admin posts with unique css in forums
rich! @ etiviti
Participantfor 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_cachedJune 14, 2010 at 11:36 am #81461In reply to: group membership: double membership bug?
Hans-Juergen Philippi
ParticipantTo 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.
June 12, 2010 at 3:09 am #81347In reply to: Changing the way group avatars are fetched
Aditya Singh
ParticipantHi @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….
June 8, 2010 at 11:05 pm #81019In reply to: Add field description to fullname (core)
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_fieldChange example.com to your website address.
June 4, 2010 at 1:21 pm #80641rich! @ etiviti
Participantsure
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
June 3, 2010 at 4:45 pm #80519In reply to: Join all public groups at once
techguy
ParticipantYou’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 WPMUThen, 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.
May 21, 2010 at 12:48 pm #79071In reply to: Issues with adding a new profile field group!
Hugo Ashmore
ParticipantThe registration page is set up thusly:
if ( bp_has_profile( 'profile_group_id=1' ):profile_group_id=1 being the primary or base group
May 20, 2010 at 1:57 pm #78975Boone Gorges
KeymasterHi @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
May 20, 2010 at 12:25 am #78932Sarah Gooding
Member@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…May 18, 2010 at 10:16 pm #78779In reply to: Adding Subnav Link to Group Pages
techguy
ParticipantI’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?May 17, 2010 at 10:36 pm #78626In 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?May 17, 2010 at 2:12 pm #78504Boone Gorges
KeymasterIf 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.
May 17, 2010 at 1:34 pm #78497rich! @ 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 )
-
AuthorSearch Results