Sync::onGroupUpdated( $groupId )
Run the sync when new group is created / updated
Description
Source
File: bp-integrations/learndash/learndash/Sync.php
public function onGroupUpdated( $groupId ) { if ( ! $this->preCheck() ) { return false; } // created from backend if ( bp_ld_sync()->isRequestExists( 'bp-ld-sync-enable' ) && ! bp_ld_sync()->getRequest( 'bp-ld-sync-enable' ) ) { $group_id = get_post_meta( $groupId, '_sync_group_id', true ); if ( ! empty( $group_id ) ) { bp_ld_sync( 'buddypress' )->sync->generator( $group_id )->desyncFromLearndash(); } return false; } // created programmatically //if ( ! bp_ld_sync( 'settings' )->get( 'learndash.default_auto_sync' ) ) { //return false; //} $newGroup = bp_ld_sync()->getRequest( 'bp-ld-sync-id', null ); $generator = $this->generator( null, $groupId ); if ( $generator->hasBpGroup() && $generator->getBpGroupId() == $newGroup ) { $generator->fullSyncToBuddypress(); return false; } $generator->associateToBuddypress( $newGroup )->syncLdAdmins()->syncLdUsers(); }
Changelog
Version | Description |
---|---|
BuddyBoss 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.