Replies
- Brajesh Singh on August 15, 2021 at 4:44 am in reply to: [Resolved] Auto join groups – cron job #40070
Hi Darshan,
You were right. The code from Ravi used an API function that did not return hidden group if the user is context was not logged.Here is the updated code. Please make sure to update the profile field id with your own.
/** * Retrieves all group ids of which the user is a member or has requested membership or is banned. * * @param int $user_id user id. * @param int $limit per page. * @param int $page page number. * * @return array */ function bd_get_user_group_ids( $user_id, $limit = false, $page = false ) { global $wpdb; $pag_sql = ''; if ( $limit && $page ) { $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit ), intval( $limit ) ); } $bp = buddypress(); $group_sql = $wpdb->prepare( "SELECT DISTINCT group_id FROM {$bp->groups->table_name_members} WHERE user_id = %d {$pag_sql}", $user_id ); return $wpdb->get_col( $group_sql ); } /** * Sync user's groups * * @param int $user_id User id. * @param array $new_group_ids New group ids. */ function buddydev_sync_user_groups( $user_id, $new_group_ids ) { if ( ! $user_id || ! $new_group_ids || ! function_exists( 'groups_leave_group' ) ) { return; } $existing_user_group_ids = bd_get_user_group_ids($user_id ); $removable_group_ids = array_diff( $existing_user_group_ids, $new_group_ids ); $new_join_group_ids = array_diff( $new_group_ids, $existing_user_group_ids ); foreach ( $removable_group_ids as $group_id ) { groups_leave_group( $group_id, $user_id ); } foreach ( $new_join_group_ids as $group_id ) { groups_join_group( $group_id, $user_id ); } } /** * Sync user's groups on field save. */ add_action( 'xprofile_data_after_save', function ( BP_XProfile_ProfileData $object ) { $field_id = $object->field_id; // Replace field id with yours field id. $group_field_id = 5; // If not our field id return. if ( $group_field_id != $field_id ) { return; } $new_group_ids = wp_parse_id_list( $object->value ); if ( empty( $new_group_ids ) ) { // should we remove existing groups? // let us avoid that for now. return; } buddydev_sync_user_groups( $object->user_id, $new_group_ids ); } );This code does not need the the Auto group join plugin. You can still use the plugin for other purpose.
Regards
Brajesh - Brajesh Singh on August 15, 2021 at 3:58 am in reply to: [Resolved] BuddyPress Xprofile – Search URLs #40069
Thank you.
- Brajesh Singh on August 15, 2021 at 3:57 am in reply to: BuddyPress Conditional field – multiple conditions #40068
Hi mdc,
Thank you for the question.No, The plugin is not able to handle multiple conditions currently. The plugin does not load fields/options via ajax, It simply shows/hides them.
If you are referring to our Ajax Registration plugin, then yes, the current code is compatible.
Regards
Brajesh Hi David,
When you change a file url, BuddyPress will not know of its existence. So, you will need to load it on your own to make it available on the front end.Regards
Brajesh- Brajesh Singh on August 15, 2021 at 3:52 am in reply to: [Resolved] BuddyPress Profile Visibility Manager #40066
Hi James,
Thank you for the question.Yes, you can do that with Profile Visibility Manager.
Regards
Brajesh - Brajesh Singh on August 13, 2021 at 4:32 pm in reply to: [Resolved] Auto join groups – cron job #40059
Hi Darshan,
It seems you are referring to the custom code section. Please allow me to check and get back to you by tomorrow.Regards
Brajesh - Brajesh Singh on August 13, 2021 at 4:32 pm in reply to: [Resolved] BuddyPress Xprofile – Search URLs #40058
Hi James,
The search functionality is not offered by Xprofile Custom Field Types plugin.It is offered by the BuddyBoss platform and is same for the native fields/custom fields. If you are able to use the link for native fields(such as Web etc), you can apply the same for custom field types.
Regards
Brajesh Hi Tosin,
The change has no effect on Branded login. It is currently allowing you to edit the slug part after the members page. Branded login has no page for tat.You can edit branded login slug from your pages screen. Slugs have no special meaning in the case of branded login plugin.
Regards
Brajesh- Brajesh Singh on August 13, 2021 at 3:23 pm in reply to: [Resolved] Number of Members Displayed – Member Directory #40055
Hi James,
Thank you for confirming. I am glad it worked.Regards
Brajesh - Brajesh Singh on August 13, 2021 at 3:23 pm in reply to: [Resolved] BuddyPress Xprofile – Search URLs #40054
Hi James,
Thank you for letting me know.I will suggest contacting BuddyBoss support as we do not offer any support for BuddyBoss’s product here.
We do provide support for our plugin’s compatibility with them.Regards
Brajesh