-
Notifications
You must be signed in to change notification settings - Fork 38
Members API
A reference to interacting with the Members extension with other extensions.
This delegate fires as soon as possible to allow other extensions the chance to overwrite the default Member class. This allows for other types of Member objects to be used with the Members extension. If the given $member
is left as null, then the default SymphonyMember
will be initialised.
Fired just before a member is logged out (and page redirection), this delegate provides the current Member ID
Fired just after a Member has successfully logged in, this delegate provides the current Member ID. This delegate is fired just before the page redirection (if it is provided)
Fired just after a Member has successfully activated their account. This delegate is fired just before the user is logged in (if the auto login setting is truthy)
Fired just after a Member has requested a recovery code so they can reset their password.
Fired just after a Member has regenerated their activation code for their account.
Fired just after a Member has reset their password.
The Members extension has a static variable, extension_Members::$_errors
that holds an associative array of errors that have occurred during processing
Returns an instance active Member class, which for this version will always be
SymphonyMember
. This class provides the functions that will allow a Member of this type to login, logout, change password etc. Future versions may include different class that represent different types of Members.
Returns the active Member's Section id that is set in the configuration or null if one has not been set.
Given a $handle
, this function will return a value from the Members configuration. Typically this is an shortcut accessor to Symphony::Configuration()->get($handle, 'members')
. If no $handle
is given
this function will return all the configuration values for the Members extension as an array.
Where $name
is one of the following values, role
, timezone
, email
, activation
, authentication
and identity
, this function will return a Field instance. Typically this allows extensions to access the Fields that are currently being used in the active Members section. If no $name
is given, an array of all Member fields will be returned.
Where $name
is one of the following values, role
, timezone
, email
, activation
, authentication
and identity
, this function will return the Field's element_name
. element_name
is a handle of the Field's label, used most commonly by events in $_POST
data. If no $name
is given, an array of all Member field handles will be returned.
The Members extension provides a Members
interface that outlines the minimum functions required to create a working Member type. At the moment, only one is supported, SymphonyMember
. Member classes can be autoloaded using the member.*.php
convention and by placing the file in the /lib
directory, although this feature has not been implemented fully in the 1.0 release.
Returns the current logged in Member entry object, or null if no member is logged in. If the function returns null, it is possible that the Member has not yet been loaded. This can be forced using initialiseMemberObject()
which will attempt fetch a Member.
Returns the Entry ID of the currently logged in Member, or null otherwise
Returns boolean on if the current Member is logged in or not. This loads the credentials from a Cookie to verify that the current Member is logged in. If the credentials are incorrect, this function will return false.
Expects an associative array of member information to log a user in where the key is the Field element_name
, ie. 'My Username' becomes 'my-username'. When providing a password, setting the $isHashed
parameter to true, will let the function know that the password field's value has already hashed, and not attempt to rehash it. By default this is false, which will take a plaintext password and hashed it according to the Members authentication field (which by default is Member: Password). Should any errors occur, they populate extension_Members::$_errors
.
This will logout a user by removing their saved cookie information. This change is effective on page reload and should be accompanied by a redirect.
This function parses $credentials
data attempting to map the key's to Field instances by using the Field's element_name
to determine an Identity field. By default, $simplified
is parameter be true, which assumes the current $credentials
has keys of email
or username
. If false, the function will map the $credentials
keys to Identity fields element_name
. The Members extension currently comes with two fields that extend the Identity class, Member: Username and Member: Email.
In the instance where both fields are provided in the $credentials
, Member: Email takes preference over Member: Username. The function will return a Field instance should a mapping be able to be found, or null
otherwise.
Given a $member_id
, this function will return the corresponding Entry object for that Member. If no Member is found, the function returns null
.
This function, given a simplified associative array with possible keys of email
, username
or password
, will return a Member's ID based on the given set of credentials. Should any errors occur, they populate extension_Members::$_errors
.
This function is called by the FrontendParamsResolve
delegate and allows the Member class to add parameters for use on the Frontend. The default Member class adds parameters for $member-id
, $member-role
and $member-activated
when necessary.
This function is called by the FrontendProcessEvents
delegate and allows the Member class to append login status information about a Member onto a Symphony page. The default implementation returns whether the member is logged in and their member-id. If a Member is not logged in, but has attempted to do so, this function iterates over extension_Members::$_errors
to simulate a real event by providing the <post-values>
and error messages.
The RoleManager class can be leveraged to add, edit, delete and fetch Roles used by the Member: Role field and Symphony to determine if users (that includes users who are not authenticated) can access pages or execute events
Given an associative array of data with the keys being the relevant table names, and the values being an associative array of data to insert, add a new Role to the Database. Roles are spread across three tables, tbl_members_roles
, tbl_members_roles_forbidden_pages
and tbl_members_roles_event_permissions
. This function will return the ID of the Role after it has been added to the database.
Given a $role_id
and an associative array of data in the same fashion as RoleManager::add()
, this will update a Role record returning true on success, false otherwise
Will delete the Role given a $role_id
. Should $purge_members
be passed, this function will remove all Members associated with this role as well
This function will return Roles from the database. If the $role_id
is given the function will return a Role object (should it be found) otherwise
an array of Role objects will be returned.
This function will find a Role by it's handle. Should $asObject
be passed as true, this function will return a Role object, otherwise just the $role_id
.
Given a $name
and a $value
, this will set it into the Role's
$this->settings
array. By default, $name
maps the tbl_member_roles
column names.
Convenience function to set an associative array without using multiple
set()
calls. This function expects an associative array.
Sets the permissions for the current Role by loading them from
tbl_member_roles_forbidden_pages
and tbl_member_roles_event_permissions
.
The permissions are set under forbidden_pages
and event_permissions
keys
that can be accessed via Role->get('event_permissions')
.
Given a $name
, this function returns the setting for this Role. If
no setting is found, this function will return null.
If $name
is not provided, the entire $this->settings
array will
be returned.
Given a $page_id
, this functions return true if this role is
allowed to view the page with that ID.
Given an event handle, the desired action, either create or edit, and
the required permission level, this function will return boolean if
the user can process the event. The $required_level
is one of the
EventPermissions
constants, NO_PERMISSIONS
, OWN_ENTRIES
, ALL_ENTRIES
or CREATE
.