CRM_Utils_System_WordPress
extends CRM_Utils_System_Base
in package
WordPress specific stuff goes here
Table of Contents
Properties
- $is_drupal : bool
- Deprecated property to check if this is a drupal install.
- $is_joomla : bool
- Deprecated property to check if this is a joomla install. The correct method is to have functions on the UF classes for all UF specific functions and leave the codebase oblivious to the type of CMS
- $is_wordpress : bool
- deprecated property to check if this is a wordpress install. The correct method is to have functions on the UF classes for all UF specific functions and leave the codebase oblivious to the type of CMS
- $supports_form_extensions : bool
- $supports_UF_Logging : bool
- Does this CMS / UF support a CMS specific logging mechanism?
Methods
- __construct() : mixed
- _showHTMLHead() : mixed
- WP action callback.
- addHTMLHead() : mixed
- Append a string to the head of the html file.
- addScript() : bool
- Add an inline script.
- addScriptUrl() : bool
- Add a script file.
- addStyle() : bool
- Add an inline style.
- addStyleUrl() : bool
- Add a css file.
- allowSynchronizeUsers() : bool
- Whether to allow access to CMS user sync action
- alterAssetUrl() : mixed
- Modify dynamic assets.
- appendBreadCrumb() : mixed
- Append an additional breadcrumb tag to the existing breadcrumb.
- appendCoreResources() : mixed
- Append WP js to coreResourcesList.
- authenticate() : array<string|int, mixed>|bool
- Authenticate the user against the CMS db.
- canSetBasePage() : bool
- Can set base page for CiviCRM By default, CiviCRM will generate front-facing pages using the home page. This allows a different template for CiviCRM pages.
- checkCleanurls() : array<string|int, CRM_Utils_Check_Message>
- Make sure clean URLs are properly set in settings file.
- checkPermissionAddUser() : bool
- Is the current user permitted to add a user.
- checkUserNameEmailExists() : mixed
- Check if username and email exists in the CMS.
- clearResourceCache() : mixed
- Flush css/js caches.
- cmsRootPath() : string|null
- Determine the location of the CMS root.
- createUser() : int|bool
- Create a user in the CMS.
- currentPath() : string|null
- Path of the current page e.g. 'civicrm/contact/view'
- flush() : mixed
- Reset any system caches that may be required for proper CiviCRM integration.
- getAbsoluteBaseURL() : bool|mixed|string
- Get the absolute path to the site's base url.
- getBasePage() : mixed
- Get a normalized version of the wpBasePage.
- getBasePageUrl() : string|bool
- Get the URL of the WordPress Base Page.
- getBaseUrl() : mixed|null|string
- Get either the relative Base Page URL or the relative Admin Page URL.
- getBestUFID() : int
- Return a UFID (user account ID from the UserFramework / CMS system.
- getBestUFUniqueIdentifier() : string
- Return a unique identifier (usually an email address or username) from the UserFramework / CMS system.
- getCiviSourceStorage() : array<string|int, mixed>
- Determine the location of the CiviCRM source tree.
- getCMSPermissionsUrlParams() : array<string|int, mixed>
- Return the CMS-specific url for its permissions page
- getContactDetailsFromUser() : array<string|int, mixed>
- Get Contact details from User The contact parameters here will be used to create a Contact record to match the user record.
- getContentTemplate() : string
- Returns the Smarty template path to the main template that renders the content.
- getCRMDatabasePrefix() : string
- Get the CRM database as a 'prefix'.
- getDefaultBlockLocation() : string
- getDefaultFileStorage() : array<string|int, mixed>
- Moved from CRM_Utils_System_Base
- getDefaultSiteSettings() : array<string|int, mixed>
- Return default Site Settings.
- getEmailFieldName() : string
- Get email field name from form values
- getLoggedInUfID() : int|null
- Get currently logged in user uf id.
- getLoggedInUniqueIdentifier() : string|null
- Get currently logged in user unique identifier - this tends to be the email address or user name.
- getLoggedInUserObject() : mixed
- getLoginDestination() : null|string
- Get the login destination string.
- getLoginURL() : string
- Get user login URL for hosting CMS (method declared in each CMS system class)
- getModules() : array<string|int, mixed>
- List modules installed in the CMS, including enabled and disabled ones.
- getNotifyUrl() : string
- Return the Notification URL for Payments.
- getRelativeBaseURL() : string|false
- Get the relative path to the sites base url.
- getRoleNames() : array<string|int, mixed>
- Get role names
- getSessionId() : mixed
- This exists because of https://www.drupal.org/node/3006306 where they changed so that they don't start sessions for anonymous, but we want that.
- getTimeZoneOffset() : string|false|null
- Get timezone offset from CMS
- getTimeZoneString() : string
- Get timezone from CMS as a string.
- getUfGroupTypes() : array<string|int, mixed>
- Return the CMS-specific UF Group Types for profiles.
- getUfId() : int|null
- Determine the native ID of the CMS user.
- getUFLocale() : string|null
- Get the locale set in the CMS.
- getUniqueIdentifierFromUserObject() : mixed
- Get Unique Identifier from UserFramework system (CMS).
- getUser() : array<string|int, mixed>
- Get an array of user details for a contact, containing at minimum the user ID & name.
- getUserIDFromUserObject() : int|null
- Get User ID from UserFramework system (Joomla)
- getUserRecordUrl() : string|null
- Get Url to view user record.
- getVersion() : string
- Get CMS Version.
- hasUsersTable() : bool
- Has CMS users table
- hooks_core_add() : mixed
- Add back CiviCRM's callbacks.
- hooks_core_remove() : mixed
- Remove CiviCRM's callbacks.
- initialize() : mixed
- invalidateRouteCache() : mixed
- Invalidates the cache of dynamic routes and forces a rebuild.
- ipAddress() : string
- Get the client's IP address.
- isFrontEndPage() : bool
- Is a front end page being accessed.
- isPasswordUserGenerated() : bool
- Check if user can create passwords or is initially assigned a system-generated one.
- isUserLoggedIn() : bool
- Check if user is logged in to the CMS.
- isUserRegistrationPermitted() : bool
- Check if user registration is permitted.
- languageNegotiationURL() : string
- Format the url as per language Negotiation.
- loadBootStrap() : bool
- Tries to bootstrap WordPress.
- loadUser() : bool
- Load user into session.
- logger() : mixed
- Log error to CMS.
- logout() : mixed
- Immediately stop script execution, log out the user and redirect to the home page.
- mailingWorkflowIsEnabled() : bool
- Check if mailing workflow is enabled
- mapConfigToSSL() : mixed
- Rewrite various system urls to https.
- modifyStandaloneProfile() : string
- Modify standalone profile
- outputError() : mixed
- Output code from error function.
- permissionDenied() : mixed
- FIXME: Use CMS-native approach
- postContainerBoot() : void
- Hook for further system boot once the main CiviCRM Container is up (only used in Standalone currently)
- postURL() : string
- Figure out the post url for QuickForm.
- prePostRedirect() : mixed
- Perform any necessary actions prior to redirecting via POST.
- resetBreadCrumb() : mixed
- Reset an additional breadcrumb tag to the existing breadcrumb.
- sendResponse() : mixed
- Send an HTTP Response base on PSR HTTP RespnseInterface response.
- sessionStart() : mixed
- Start a new session if there's no existing session ID.
- setHttpHeader() : mixed
- setMessage() : mixed
- FIXME: Do something
- setMySQLTimeZone() : mixed
- Set MySQL timezone so that timestamp fields show the correct time.
- setPhpTimeZone() : mixed
- Set PHP timezone
- setTimeZone() : mixed
- Set system timezone (both PHP + MySQL)
- setTitle() : mixed
- Sets the title of the page.
- setUFLocale() : bool
- Set the localisation from the user framework.
- setUserSession() : mixed
- Set a init session with user object.
- showPasswordFieldWhenAdminCreatesUser() : mixed
- Depending on configuration, either let the admin enter the password when creating a user or let the user do it via email link.
- suppressProfileFormErrors() : bool
- Suppress profile form errors
- synchronizeUsers() : array<string|int, mixed>
- Create CRM contacts for all existing CMS users
- synchronizeUsersIfAllowed() : array<string|int, mixed>
- Run CMS user sync if allowed, otherwise just returns empty array
- theme() : string|null
- If we are using a theming system, invoke theme, else just print the content.
- updateCategories() : mixed
- Clear CMS caches related to the user registration/profile forms.
- updateCMSName() : mixed
- Update a user's email address in the CMS.
- url() : string
- Generate the url string to a CiviCRM path.
- userLoginFinalize() : mixed
- Perform any post login activities required by the CMS.
- validInstallDir() : bool
- verifyPassword() : mixed
- Verify password
- viewsExists() : bool
- Determine if the Views module exists.
- viewsIntegration() : string
- CiviCRM Table prefixes To display for CMS integration.
- registerPathVars() : void
- Specify the default computation for various paths/URLs.
- checkCleanPage() : mixed
- setAuthCookie() : mixed
- Set cookie with "SameSite" flag.
- setAuthCookies() : mixed
- Explicitly set WordPress authentication cookies.
Properties
$is_drupal
Deprecated property to check if this is a drupal install.
TRUE, if the CMS is Drupal.
public
bool
$is_drupal
= \FALSE
The correct method is to have functions on the UF classes for all UF specific functions and leave the codebase oblivious to the type of CMS
$is_joomla
Deprecated property to check if this is a joomla install. The correct method is to have functions on the UF classes for all UF specific functions and leave the codebase oblivious to the type of CMS
TRUE, if the CMS is Joomla!.
public
bool
$is_joomla
= \FALSE
$is_wordpress
deprecated property to check if this is a wordpress install. The correct method is to have functions on the UF classes for all UF specific functions and leave the codebase oblivious to the type of CMS
TRUE, if the CMS is WordPress.
public
bool
$is_wordpress
= \FALSE
$supports_form_extensions
public
bool
$supports_form_extensions
= \FALSE
TRUE, if the CMS allows CMS forms to be extended by hooks.
$supports_UF_Logging
Does this CMS / UF support a CMS specific logging mechanism?
public
bool
$supports_UF_Logging
= \FALSE
Tags
Methods
__construct()
public
__construct() : mixed
_showHTMLHead()
WP action callback.
public
static _showHTMLHead() : mixed
addHTMLHead()
Append a string to the head of the html file.
public
addHTMLHead(mixed $head) : mixed
Parameters
- $head : mixed
-
The new string to be appended.
Tags
addScript()
Add an inline script.
public
addScript(string $code, string $region) : bool
Note: This function is not to be called directly
Parameters
- $code : string
-
javascript code
- $region : string
-
location within the document: 'html-header', 'page-header', 'page-footer'.
Tags
Return values
bool —TRUE if we support this operation in this CMS, FALSE otherwise
addScriptUrl()
Add a script file.
public
addScriptUrl(string $url, string $region) : bool
Note: This function is not to be called directly
Parameters
- $url : string
-
absolute path to file
- $region : string
-
location within the document: 'html-header', 'page-header', 'page-footer'.
Tags
Return values
bool —TRUE if we support this operation in this CMS, FALSE otherwise
addStyle()
Add an inline style.
public
addStyle(string $code, string $region) : bool
Note: This function is not to be called directly
Parameters
- $code : string
-
css code
- $region : string
-
location within the document: 'html-header', 'page-header', 'page-footer'.
Tags
Return values
bool —TRUE if we support this operation in this CMS, FALSE otherwise
addStyleUrl()
Add a css file.
public
addStyleUrl(string $url, string $region) : bool
Note: This function is not to be called directly
Parameters
- $url : string
-
absolute path to file
- $region : string
-
location within the document: 'html-header', 'page-header', 'page-footer'.
Tags
Return values
bool —TRUE if we support this operation in this CMS, FALSE otherwise
allowSynchronizeUsers()
Whether to allow access to CMS user sync action
public
allowSynchronizeUsers() : bool
Return values
boolalterAssetUrl()
Modify dynamic assets.
public
alterAssetUrl(GenericHookEvent $e) : mixed
Parameters
- $e : GenericHookEvent
Tags
appendBreadCrumb()
Append an additional breadcrumb tag to the existing breadcrumb.
public
appendBreadCrumb(mixed $breadCrumbs) : mixed
Parameters
- $breadCrumbs : mixed
Tags
appendCoreResources()
Append WP js to coreResourcesList.
public
appendCoreResources(GenericHookEvent $e) : mixed
Parameters
- $e : GenericHookEvent
authenticate()
Authenticate the user against the CMS db.
public
authenticate(mixed $name, mixed $password[, mixed $loadCMSBootstrap = FALSE ][, mixed $realPath = NULL ]) : array<string|int, mixed>|bool
Parameters
- $name : mixed
-
The user name.
- $password : mixed
-
The password for the above user.
- $loadCMSBootstrap : mixed = FALSE
-
Load cms bootstrap?.
- $realPath : mixed = NULL
-
Filename of script
Tags
Return values
array<string|int, mixed>|bool —[contactID, ufID, unique string] else false if no auth
canSetBasePage()
Can set base page for CiviCRM By default, CiviCRM will generate front-facing pages using the home page. This allows a different template for CiviCRM pages.
public
canSetBasePage() : bool
Tags
Return values
boolcheckCleanurls()
Make sure clean URLs are properly set in settings file.
public
checkCleanurls() : array<string|int, CRM_Utils_Check_Message>
Return values
array<string|int, CRM_Utils_Check_Message>checkPermissionAddUser()
Is the current user permitted to add a user.
public
checkPermissionAddUser() : bool
Tags
Return values
boolcheckUserNameEmailExists()
Check if username and email exists in the CMS.
public
checkUserNameEmailExists(mixed &$params, mixed &$errors[, mixed $emailName = 'email' ]) : mixed
Parameters
- $params : mixed
-
Array of name and mail values.
- $errors : mixed
-
Array of errors.
- $emailName : mixed = 'email'
-
Field label for the 'email'.
Tags
clearResourceCache()
Flush css/js caches.
public
clearResourceCache() : mixed
cmsRootPath()
Determine the location of the CMS root.
public
cmsRootPath() : string|null
Return values
string|null —local file system path to CMS root, or NULL if it cannot be determined
createUser()
Create a user in the CMS.
public
createUser(mixed &$params, mixed $mailParam) : int|bool
Parameters
- $params : mixed
- $mailParam : mixed
-
Name of the $param which contains the email address. Because. Right. OK. That's what it is.
Tags
Return values
int|bool —uid if user exists, false otherwise
currentPath()
Path of the current page e.g. 'civicrm/contact/view'
public
static currentPath() : string|null
Return values
string|null —the current menu path
flush()
Reset any system caches that may be required for proper CiviCRM integration.
public
flush() : mixed
getAbsoluteBaseURL()
Get the absolute path to the site's base url.
public
getAbsoluteBaseURL() : bool|mixed|string
Return values
bool|mixed|stringgetBasePage()
Get a normalized version of the wpBasePage.
public
static getBasePage() : mixed
getBasePageUrl()
Get the URL of the WordPress Base Page.
public
getBasePageUrl() : string|bool
Return values
string|bool —The Base Page URL, or false on failure.
getBaseUrl()
Get either the relative Base Page URL or the relative Admin Page URL.
public
getBaseUrl(bool $absolute, bool $frontend, bool $forceBackend) : mixed|null|string
Parameters
- $absolute : bool
-
Whether to force the output to be an absolute link beginning with http(s).
- $frontend : bool
-
True if this link should be to the CMS front end.
- $forceBackend : bool
-
True if this link should be to the CMS back end.
Return values
mixed|null|stringgetBestUFID()
Return a UFID (user account ID from the UserFramework / CMS system.
public
getBestUFID([object $user = NULL ]) : int
ID is based on the user object passed, defaulting to the logged in user if not passed.
Note that ambiguous situation occurs in CRM_Core_BAO_UFMatch::synchronize - a cleaner approach would seem to be resolving the user id before calling the function.
Note there is already a function getUFId which takes $username as a param - we could add $user as a second param to it but it seems messy - just overloading it because the name is taken.
Parameters
- $user : object = NULL
Return values
int —User ID of UF System
getBestUFUniqueIdentifier()
Return a unique identifier (usually an email address or username) from the UserFramework / CMS system.
public
getBestUFUniqueIdentifier([object $user = NULL ]) : string
This is based on the user object passed, defaulting to the logged in user if not passed.
Note that ambiguous situation occurs in CRM_Core_BAO_UFMatch::synchronize - a cleaner approach would seem to be resolving the unique identifier before calling the function.
Parameters
- $user : object = NULL
Return values
string —unique identifier from the UF System
getCiviSourceStorage()
Determine the location of the CiviCRM source tree.
public
getCiviSourceStorage() : array<string|int, mixed>
Return values
array<string|int, mixed> —- url: string. ex: "http://example.com/sites/all/modules/civicrm"
- path: string. ex: "/var/www/sites/all/modules/civicrm"
getCMSPermissionsUrlParams()
Return the CMS-specific url for its permissions page
public
getCMSPermissionsUrlParams() : array<string|int, mixed>
Return values
array<string|int, mixed>getContactDetailsFromUser()
Get Contact details from User The contact parameters here will be used to create a Contact record to match the user record.
public
getContactDetailsFromUser(mixed $uf_match) : array<string|int, mixed>
Parameters
- $uf_match : mixed
-
Array of user object, unique ID.
Tags
Return values
array<string|int, mixed> —Array of contact parameters.
getContentTemplate()
Returns the Smarty template path to the main template that renders the content.
public
static getContentTemplate([mixed $print = 0 ]) : string
In CMS contexts, this goes inside their theme, but Standalone needs to render the full HTML page.
Parameters
- $print : mixed = 0
Return values
stringgetCRMDatabasePrefix()
Get the CRM database as a 'prefix'.
public
getCRMDatabasePrefix() : string
This returns a string that can be prepended to a query to include a CRM table.
However, this string should contain backticks, or not, in accordance with the CMS's drupal views expectations, if any.
Return values
stringgetDefaultBlockLocation()
public
getDefaultBlockLocation() : string
Return values
stringgetDefaultFileStorage()
Moved from CRM_Utils_System_Base
public
getDefaultFileStorage() : array<string|int, mixed>
Return values
array<string|int, mixed> —- url: string. ex: "http://example.com/sites/foo.com/files/civicrm"
- path: string. ex: "/var/www/sites/foo.com/files/civicrm"
getDefaultSiteSettings()
Return default Site Settings.
public
getDefaultSiteSettings(string $dir) : array<string|int, mixed>
Parameters
- $dir : string
Return values
array<string|int, mixed> —- $url, (Joomla - non admin url)
- $siteName,
- $siteRoot
getEmailFieldName()
Get email field name from form values
public
getEmailFieldName(CRM_Core_Form $form, array<string|int, mixed> $fields) : string
Parameters
- $form : CRM_Core_Form
- $fields : array<string|int, mixed>
Tags
Return values
stringgetLoggedInUfID()
Get currently logged in user uf id.
public
getLoggedInUfID() : int|null
Tags
Return values
int|null —logged in user uf id.
getLoggedInUniqueIdentifier()
Get currently logged in user unique identifier - this tends to be the email address or user name.
public
getLoggedInUniqueIdentifier() : string|null
Tags
Return values
string|null —logged in user unique identifier
getLoggedInUserObject()
public
getLoggedInUserObject() : mixed
getLoginDestination()
Get the login destination string.
public
getLoginDestination(CRM_Core_Form &$form) : null|string
Parameters
- $form : CRM_Core_Form
Return values
null|stringgetLoginURL()
Get user login URL for hosting CMS (method declared in each CMS system class)
public
getLoginURL([mixed $destination = '' ]) : string
Parameters
- $destination : mixed = ''
-
If present, add destination to querystring (works for Drupal and WordPress only).
Tags
Return values
string —loginURL for the current CMS
getModules()
List modules installed in the CMS, including enabled and disabled ones.
public
getModules() : array<string|int, mixed>
Return values
array<string|int, mixed> —[CRM_Core_Module]
getNotifyUrl()
Return the Notification URL for Payments.
public
getNotifyUrl([mixed $path = NULL ][, mixed $query = NULL ][, mixed $absolute = FALSE ][, mixed $fragment = NULL ][, mixed $frontend = FALSE ][, mixed $forceBackend = FALSE ]) : string
Parameters
- $path : mixed = NULL
-
The path being linked to, such as "civicrm/add".
- $query : mixed = NULL
-
A query string to append to the link.
- $absolute : mixed = FALSE
-
Whether to force the output to be an absolute link (beginning with http). Useful for links that will be displayed outside the site, such as in an RSS feed.
- $fragment : mixed = NULL
-
A fragment identifier (named anchor) to append to the link.
- $frontend : mixed = FALSE
-
This link should be to the CMS front end (applies to WP & Joomla).
- $forceBackend : mixed = FALSE
-
This link should be to the CMS back end (applies to WP & Joomla).
Tags
Return values
string —The Notification URL.
getRelativeBaseURL()
Get the relative path to the sites base url.
public
getRelativeBaseURL() : string|false
Return values
string|falsegetRoleNames()
Get role names
public
getRoleNames() : array<string|int, mixed>
Return values
array<string|int, mixed>getSessionId()
This exists because of https://www.drupal.org/node/3006306 where they changed so that they don't start sessions for anonymous, but we want that.
public
getSessionId() : mixed
getTimeZoneOffset()
Get timezone offset from CMS
public
getTimeZoneOffset() : string|false|null
Return values
string|false|nullgetTimeZoneString()
Get timezone from CMS as a string.
public
getTimeZoneString() : string
Tags
Return values
string —Timezone string e.g. 'America/Los_Angeles'
getUfGroupTypes()
Return the CMS-specific UF Group Types for profiles.
public
getUfGroupTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>getUfId()
Determine the native ID of the CMS user.
public
getUfId(string $username) : int|null
Parameters
- $username : string
Return values
int|nullgetUFLocale()
Get the locale set in the CMS.
public
getUFLocale() : string|null
Tags
Return values
string|null —Locale or null for none
getUniqueIdentifierFromUserObject()
Get Unique Identifier from UserFramework system (CMS).
public
getUniqueIdentifierFromUserObject(mixed $user) : mixed
Parameters
- $user : mixed
-
Object as described by the User Framework.
Tags
Return values
mixed —Unique identifier from the user Framework system
getUser()
Get an array of user details for a contact, containing at minimum the user ID & name.
public
getUser(int $contactID) : array<string|int, mixed>
Parameters
- $contactID : int
Return values
array<string|int, mixed> —CMS user details including
- id
- name (ie the system user name.
getUserIDFromUserObject()
Get User ID from UserFramework system (Joomla)
public
getUserIDFromUserObject(object $user) : int|null
Parameters
- $user : object
-
Object as described by the CMS.
Return values
int|nullgetUserRecordUrl()
Get Url to view user record.
public
getUserRecordUrl(mixed $contactID) : string|null
Parameters
- $contactID : mixed
-
Contact ID.
Tags
Return values
string|nullgetVersion()
Get CMS Version.
public
getVersion() : string
Tags
Return values
stringhasUsersTable()
Has CMS users table
public
hasUsersTable() : bool
Return values
boolhooks_core_add()
Add back CiviCRM's callbacks.
public
hooks_core_add() : mixed
This method undoes the removal of the callbacks above.
Tags
hooks_core_remove()
Remove CiviCRM's callbacks.
public
hooks_core_remove() : mixed
These may cause recursive updates when creating or editing a WordPress user. This doesn't seem to have been necessary in the past, but seems to be causing trouble when newer versions of BuddyPress and CiviCRM are active.
Based on the civicrm-wp-profile-sync plugin by Christian Wach.
Tags
initialize()
public
initialize() : mixed
invalidateRouteCache()
Invalidates the cache of dynamic routes and forces a rebuild.
public
invalidateRouteCache() : mixed
ipAddress()
Get the client's IP address.
public
ipAddress() : string
Return values
string —IP address
isFrontEndPage()
Is a front end page being accessed.
public
isFrontEndPage() : bool
Generally this would be a contribution form or other public page as opposed to a backoffice page (like contact edit).
Tags
Return values
boolisPasswordUserGenerated()
Check if user can create passwords or is initially assigned a system-generated one.
public
isPasswordUserGenerated() : bool
Tags
Return values
boolisUserLoggedIn()
Check if user is logged in to the CMS.
public
isUserLoggedIn() : bool
Tags
Return values
boolisUserRegistrationPermitted()
Check if user registration is permitted.
public
isUserRegistrationPermitted() : bool
Tags
Return values
boollanguageNegotiationURL()
Format the url as per language Negotiation.
public
languageNegotiationURL(string $url[, bool $addLanguagePart = TRUE ][, bool $removeLanguagePart = FALSE ]) : string
Parameters
- $url : string
- $addLanguagePart : bool = TRUE
- $removeLanguagePart : bool = FALSE
Return values
string —Formatted url.
loadBootStrap()
Tries to bootstrap WordPress.
public
loadBootStrap([array<string|int, mixed> $params = [] ][, bool $loadUser = TRUE ][, bool $throwError = TRUE ][, mixed $realPath = NULL ]) : bool
Parameters
- $params : array<string|int, mixed> = []
-
Optional credentials
- name: string, cms username
- pass: string, cms password
- $loadUser : bool = TRUE
- $throwError : bool = TRUE
- $realPath : mixed = NULL
Tags
Return values
boolloadUser()
Load user into session.
public
loadUser(string $user) : bool
Parameters
- $user : string
Return values
boollogger()
Log error to CMS.
public
logger(string $message[, string|null $priority = NULL ]) : mixed
Parameters
- $message : string
- $priority : string|null = NULL
logout()
Immediately stop script execution, log out the user and redirect to the home page.
public
logout() : mixed
Tags
mailingWorkflowIsEnabled()
Check if mailing workflow is enabled
public
mailingWorkflowIsEnabled() : bool
Return values
boolmapConfigToSSL()
Rewrite various system urls to https.
public
mapConfigToSSL() : mixed
modifyStandaloneProfile()
Modify standalone profile
public
modifyStandaloneProfile(mixed $profile, mixed $params) : string
Parameters
- $profile : mixed
- $params : mixed
Tags
Return values
stringoutputError()
Output code from error function.
public
outputError(string $content) : mixed
Parameters
- $content : string
permissionDenied()
FIXME: Use CMS-native approach
public
permissionDenied() : mixed
Tags
postContainerBoot()
Hook for further system boot once the main CiviCRM Container is up (only used in Standalone currently)
public
postContainerBoot() : void
postURL()
Figure out the post url for QuickForm.
public
postURL(string $action) : string
Parameters
- $action : string
-
The default url if one is pre-specified.
Return values
string —The url to post the form.
prePostRedirect()
Perform any necessary actions prior to redirecting via POST.
public
prePostRedirect() : mixed
Redirecting via POST means that cookies need to be sent with SameSite=None.
resetBreadCrumb()
Reset an additional breadcrumb tag to the existing breadcrumb.
public
resetBreadCrumb() : mixed
Tags
sendResponse()
Send an HTTP Response base on PSR HTTP RespnseInterface response.
public
sendResponse(ResponseInterface $response) : mixed
Parameters
- $response : ResponseInterface
sessionStart()
Start a new session if there's no existing session ID.
public
sessionStart() : mixed
Checks are needed to prevent sessions being started when not necessary.
setHttpHeader()
public
setHttpHeader(string $name, string $value) : mixed
Parameters
- $name : string
- $value : string
setMessage()
FIXME: Do something
public
setMessage(string $message) : mixed
Parameters
- $message : string
setMySQLTimeZone()
Set MySQL timezone so that timestamp fields show the correct time.
public
setMySQLTimeZone([string|null $timeZone = NULL ]) : mixed
Parameters
- $timeZone : string|null = NULL
-
Timezone string - if none provided will be fetched from system
setPhpTimeZone()
Set PHP timezone
public
setPhpTimeZone([string|null $timeZone = NULL ]) : mixed
Parameters
- $timeZone : string|null = NULL
-
Timezone string - default value will be fetched using getTimeZoneString if not provided or falsey
setTimeZone()
Set system timezone (both PHP + MySQL)
public
setTimeZone([string|null $timeZone = NULL ]) : mixed
Parameters
- $timeZone : string|null = NULL
setTitle()
Sets the title of the page.
public
setTitle(mixed $title[, mixed $pageTitle = NULL ]) : mixed
Parameters
- $title : mixed
-
Title to set in html header
- $pageTitle : mixed = NULL
-
Title to set in html body (if different)
Tags
setUFLocale()
Set the localisation from the user framework.
public
setUFLocale(mixed $civicrm_language) : bool
Parameters
- $civicrm_language : mixed
Tags
Return values
boolsetUserSession()
Set a init session with user object.
public
setUserSession(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>
-
Array with user specific data
showPasswordFieldWhenAdminCreatesUser()
Depending on configuration, either let the admin enter the password when creating a user or let the user do it via email link.
public
showPasswordFieldWhenAdminCreatesUser() : mixed
suppressProfileFormErrors()
Suppress profile form errors
public
suppressProfileFormErrors() : bool
Return values
boolsynchronizeUsers()
Create CRM contacts for all existing CMS users
public
synchronizeUsers() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>synchronizeUsersIfAllowed()
Run CMS user sync if allowed, otherwise just returns empty array
public
synchronizeUsersIfAllowed() : array<string|int, mixed>
Return values
array<string|int, mixed>theme()
If we are using a theming system, invoke theme, else just print the content.
public
theme(mixed &$content[, mixed $print = FALSE ][, mixed $maintenance = FALSE ]) : string|null
Parameters
- $content : mixed
-
The content that will be themed.
- $print : mixed = FALSE
-
Are we displaying to the screen or bypassing theming?.
- $maintenance : mixed = FALSE
-
For maintenance mode.
Tags
Return values
string|null —NULL, If $print is FALSE, and some other criteria match up. The themed string, otherwise.
updateCategories()
Clear CMS caches related to the user registration/profile forms.
public
updateCategories() : mixed
Used when updating/embedding profiles on CMS user forms.
Tags
updateCMSName()
Update a user's email address in the CMS.
public
updateCMSName(mixed $ufID, mixed $ufName) : mixed
Parameters
- $ufID : mixed
-
User ID in CMS.
- $ufName : mixed
Tags
url()
Generate the url string to a CiviCRM path.
public
url([mixed $path = NULL ][, mixed $query = NULL ][, mixed $absolute = FALSE ][, mixed $fragment = NULL ][, mixed $frontend = FALSE ][, mixed $forceBackend = FALSE ]) : string
Parameters
- $path : mixed = NULL
-
The path being linked to, such as "civicrm/add".
- $query : mixed = NULL
-
A query string to append to the link.
- $absolute : mixed = FALSE
-
Whether to force the output to be an absolute link (beginning with http). Useful for links that will be displayed outside the site, such as in an RSS feed.
- $fragment : mixed = NULL
-
A fragment identifier (named anchor) to append to the link.
- $frontend : mixed = FALSE
-
This link should be to the CMS front end (applies to WP & Joomla).
- $forceBackend : mixed = FALSE
-
This link should be to the CMS back end (applies to WP & Joomla).
Tags
Return values
stringuserLoginFinalize()
Perform any post login activities required by the CMS.
public
userLoginFinalize([array<string|int, mixed> $params = [] ]) : mixed
e.g. for drupal: records a watchdog message about the new session, saves the login timestamp, calls hook_user op 'login' and generates a new session.
Parameters
- $params : array<string|int, mixed> = []
-
FIXME: Document values accepted/required by $params
validInstallDir()
public
validInstallDir(string $dir) : bool
Parameters
- $dir : string
Return values
boolverifyPassword()
Verify password
public
verifyPassword(array<string|int, mixed> $params, array<string|int, mixed> &$errors) : mixed
Parameters
- $params : array<string|int, mixed>
-
Array of name, mail and password values.
- $errors : array<string|int, mixed>
-
Array of errors.
viewsExists()
Determine if the Views module exists.
public
viewsExists() : bool
Return values
boolviewsIntegration()
CiviCRM Table prefixes To display for CMS integration.
public
viewsIntegration() : string
Return values
stringregisterPathVars()
Specify the default computation for various paths/URLs.
protected
registerPathVars() : void
checkCleanPage()
private
static checkCleanPage(mixed $slug, mixed $id, mixed $config) : mixed
Parameters
- $slug : mixed
- $id : mixed
- $config : mixed
setAuthCookie()
Set cookie with "SameSite" flag.
private
setAuthCookie(string $name, string $value, array<string|int, mixed> $options) : mixed
The method here is compatible with all versions of PHP. Needed because it is only as of PHP 7.3.0 that the setcookie() method supports the "SameSite" attribute in its options and will accept "None" as a valid value.
Parameters
- $name : string
-
The name of the cookie.
- $value : string
-
The value of the cookie.
- $options : array<string|int, mixed>
-
The header options for the cookie.
setAuthCookies()
Explicitly set WordPress authentication cookies.
private
setAuthCookies(int $user_id[, bool $remember = FALSE ][, bool|string $secure = '' ][, string $token = '' ]) : mixed
Chrome 84 introduced a cookie policy change which prevents cookies for the session and for WordPress user authentication from being indentified when a purchaser returns to the site from PayPal using the "Back to Merchant" button.
In order to comply with this policy, cookies need to be sent with their
"SameSite" attribute set to "None" and with the "Secure" flag set, but this
isn't possible to do via wp_set_auth_cookie()
as it stands.
This method is a modified clone of wp_set_auth_cookie()
which satisfies
the Chrome policy.
Parameters
- $user_id : int
-
The WordPress User ID.
- $remember : bool = FALSE
-
Whether to remember the user.
- $secure : bool|string = ''
-
Whether the auth cookie should only be sent over HTTPS. Default is an empty string which means the value of
is_ssl()
will be used. - $token : string = ''
-
Optional. User's session token to use for this cookie.