API - Triggers
Technical documentation
09 May 2010
Community Builder has an assortment of triggers which can be used to alter CB data or even Joomla data without hacking the code. There are multiple use scenarios for these triggers. You can use them in modules, components, bots, plugins, or essentially anything you include the CB API in.
To initiate a trigger you'll need to add the call for it. At the top of your php file add the following just below direct access check. You must ALWAYS include the Global for $_PLUGINS to avoid any errors.
global $_PLUGINS;
$_PLUGINS->registerFunction( 'TRIGGER', 'FUNCTION', 'CLASS' );
The format above is mandatory with the exception of Class, This allows you to call Function when Trigger is executed. Class allows you to trigger Function in Class. Some triggers pass variables upon execution. You can specify these variables at the end of the Function with the format of Function( $var1, $var2 ). Optionally you can ignore this and specify the variables in your function it self such as:
function Function( $var1, $var2 ) {
Now that the formatting and preparation is understood you'll need to know the list of available triggers. Below is a rather large list of triggers found all throughout CB which are all available for your usage. Keep in mind some due contain variables; generally all have the starting variable of $user.
//Community Builder
onBeforeEmailUserForm
onAfterEmailUserForm
onBeforeUserProfileEditDisplay
onAfterUserProfileEditDisplay
onBeforeUserProfileRequest
onBeforeUserProfileDisplay
onAfterUserProfileDisplay
onBeforeDisplayUsersList
onLostPassForm
onBeforeLoginFormDisplay
onBeforeRegisterFormDisplay
onBeforeEmailUser
onBeforeUserAvatarUpdate
onAfterUserAvatarUpdate
onStartUsersList
onAfterUsersListFieldsSql
onBeforeUsersListBuildQuery
onBeforeUsersListQuery
onStartNewPassword
onBeforeUsernameReminder
onAfterUsernameReminder
onBeforeNewPassword
onNewPassword
onBeforeRegisterForm
onStartSaveUserRegistration
onAfterUserRegistrationMailsSent
onBeforeLogin
onLoginAuthentication
onDuringLogin
onBeforeFirstLogin
onDoLoginNow
onAfterLogin
onBeforeLogout
onDoLogoutNow
onAfterLogout
onBeforeUserConfirm
onAfterUserConfirm
onBeforeUserApproval
onAfterUserApproval
onBeforeUserApproval
onBeforeBackendUsersListBuildQuery
onAfterBackendUsersList
onBeforeUserBlocking
onBeforeSyncUser
onAfterSyncUser
onAfterCheckCbDb
onAfterCheckCbFieldsDb
onBeforeFixDb
onAfterFixDb
onBeforeFixFieldsDb
onBeforeUserActive
onUserActive
onBeforeDeleteUser
onAfterDeleteUser
onAfterTabsFetch
onPrepareMenus
onAfterEditATab
onAfterFieldsFetch
onBeforeAddConnection
onAfterAddConnection
onBeforeRemoveConnection
onAfterRemoveConnection
onBeforeDenyConnection
onAfterDenyConnection
onBeforeAcceptConnection
onAfterAcceptConnection
onFieldIcons
onLogChange
onBeforeUserUpdate
onBeforeNewUser
onBeforeUpdateUser
onBeforeUserRegistration
onSaveUserError
onAfterUserUpdate
onAfterNewUser
onAfterUpdateUser
onAfterUserRegistration
onBeforegetFieldRow
//Community Builder Captcha
onGetCaptchaHtmlElements