HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

ocPortal Developer's Guide: OCF members

» Return to Contents



sources/ocf_members.php

Global_functions_ocf_members.php

Function summary

void init__ocf_members ()
array ocf_get_filter_cats (boolean only_exists_now)
?integer ocf_authusername_is_bound_via_httpauth (string authusername)
boolean ocf_is_ldap_member (MEMBER member_id)
boolean ocf_is_httpauth_member (MEMBER member_id)
array ocf_get_all_custom_fields_match (?array groups, ?BINARY public_view, ?BINARY owner_view, ?BINARY owner_set, ?BINARY required, ?BINARY show_in_posts, ?BINARY show_in_post_previews, BINARY special_start, ?boolean show_on_join_form)
array ocf_get_all_custom_fields_match_member (MEMBER member_id, ?BINARY public_view, ?BINARY owner_view, ?BINARY owner_set, ?BINARY encrypted, ?BINARY required, ?BINARY show_in_posts, ?BINARY show_in_post_previews, BINARY special_start, ?boolean show_on_join_form)
?AUTO_LINK find_cpf_field_id (SHORT_TEXT title)
array ocf_get_custom_field_mappings (MEMBER member_id)
array ocf_get_custom_fields_member (MEMBER member_id)
GROUP ocf_get_member_primary_group (MEMBER member_id)

void init__ocf_members()

Standard code module initialisation function.

Parameters…

(No return value)


Return to the function index for this class Expand: View the source code to this function

array ocf_get_filter_cats(boolean only_exists_now)

Find all the Private Topic filter categories employed by the current member.

Parameters…

Name only_exists_now
Description Whether to only show ones that already have things in (i.e. not default ones)
Default value boolean-false
Type boolean

Returns…

Description List of filter categories
Type array

Return to the function index for this class Expand: View the source code to this function

?integer ocf_authusername_is_bound_via_httpauth(string authusername)

Find whether a member of a certain username is bound to HTTP authentication (an exceptional situation, only for sites that use it).

Parameters…

Name authusername
Description The username.
Type string

Returns…

Description The member ID, if it is (NULL: not bound).
Type ?integer

Return to the function index for this class Expand: View the source code to this function

boolean ocf_is_ldap_member(MEMBER member_id)

Find whether a member is bound to HTTP LDAP (an exceptional situation, only for sites that use it).

Parameters…

Name member_id
Description The member.
Type MEMBER

Returns…

Description The answer.
Type boolean

Return to the function index for this class Expand: View the source code to this function

boolean ocf_is_httpauth_member(MEMBER member_id)

Find whether a member is bound to HTTP authentication (an exceptional situation, only for sites that use it).

Parameters…

Name member_id
Description The member.
Type MEMBER

Returns…

Description The answer.
Type boolean

Return to the function index for this class Expand: View the source code to this function

array ocf_get_all_custom_fields_match(?array groups, ?BINARY public_view, ?BINARY owner_view, ?BINARY owner_set, ?BINARY required, ?BINARY show_in_posts, ?BINARY show_in_post_previews, BINARY special_start, ?boolean show_on_join_form)

Gets all the system custom fields that match certain parameters.

Parameters…

Name groups
Description That are applicable only to one of the usergroups in this list (empty: CPFs with no restriction) (NULL: disregard restriction).
Type ?array

Name public_view
Description That are publicly viewable (NULL: don't care).
Default value
Type ?BINARY

Name owner_view
Description That are owner viewable (NULL: don't care).
Default value
Type ?BINARY

Name owner_set
Description That are owner settable (NULL: don't care).
Default value
Type ?BINARY

Name required
Description That are required (NULL: don't care).
Default value
Type ?BINARY

Name show_in_posts
Description That are to be shown in posts (NULL: don't care).
Default value
Type ?BINARY

Name show_in_post_previews
Description That are to be shown in post previews (NULL: don't care).
Default value
Type ?BINARY

Name special_start
Description That start 'ocp_'
Default value 0
Type BINARY

Name show_on_join_form
Description That are to go on the join form (NULL: don't care).
Default value
Type ?boolean

Returns…

Description A list of rows of such fields.
Type array

Return to the function index for this class Expand: View the source code to this function

array ocf_get_all_custom_fields_match_member(MEMBER member_id, ?BINARY public_view, ?BINARY owner_view, ?BINARY owner_set, ?BINARY encrypted, ?BINARY required, ?BINARY show_in_posts, ?BINARY show_in_post_previews, BINARY special_start, ?boolean show_on_join_form)

Gets all a member's custom fields that match certain parameters.

Parameters…

Name member_id
Description The member.
Type MEMBER

Name public_view
Description That are publically viewable (NULL: don't care).
Default value
Type ?BINARY

Name owner_view
Description That are owner viewable (NULL: don't care).
Default value
Type ?BINARY

Name owner_set
Description That are owner settable (NULL: don't care).
Default value
Type ?BINARY

Name encrypted
Description That are encrypted (NULL: don't care).
Default value
Type ?BINARY

Name required
Description That are required (NULL: don't care).
Default value
Type ?BINARY

Name show_in_posts
Description That are to be shown in posts (NULL: don't care).
Default value
Type ?BINARY

Name show_in_post_previews
Description That are to be shown in post previews (NULL: don't care).
Default value
Type ?BINARY

Name special_start
Description That start 'ocp_'
Default value 0
Type BINARY

Name show_on_join_form
Description That are to go on the join form (NULL: don't care).
Default value
Type ?boolean

Returns…

Description A mapping of field title to a map of details: 'RAW' as the raw field value, 'RENDERED' as the rendered field value.
Type array

Return to the function index for this class Expand: View the source code to this function

?AUTO_LINK find_cpf_field_id(SHORT_TEXT title)

Get the ID for a CPF if we only know the title. Warning: Only use this with custom code, never core code! It assumes a single language and that fields aren't renamed.

Parameters…

Name title
Description The title.
Type SHORT_TEXT

Returns…

Description The ID (NULL: could not find).
Type ?AUTO_LINK

Return to the function index for this class Expand: View the source code to this function

array ocf_get_custom_field_mappings(MEMBER member_id)

Returns a list of all field values for user. Doesn't take translation into account. Doesn't take anything permissive into account.

Parameters…

Name member_id
Description The member.
Type MEMBER

Returns…

Description The list.
Type array

Return to the function index for this class Expand: View the source code to this function

array ocf_get_custom_fields_member(MEMBER member_id)

Returns a mapping between field number and field value. Doesn't take translation into account. Doesn't take anything permissive into account.

Parameters…

Name member_id
Description The member.
Type MEMBER

Returns…

Description The mapping.
Type array

Return to the function index for this class Expand: View the source code to this function

GROUP ocf_get_member_primary_group(MEMBER member_id)

Get the primary of a member (supports consulting of LDAP).

Parameters…

Name member_id
Description The member.
Type MEMBER

Returns…

Description The primary.
Type GROUP

Return to the function index for this class Expand: View the source code to this function

sources/ocf_members_action.php

Global_functions_ocf_members_action.php

Function summary

AUTO_LINK ocf_make_member (SHORT_TEXT username, SHORT_TEXT password, SHORT_TEXT email_address, ?array groups, ?integer dob_day, ?integer dob_month, ?integer dob_year, array custom_fields, ?ID_TEXT timezone, ?GROUP primary_group, BINARY validated, ?TIME join_time, ?TIME last_visit_time, ID_TEXT theme, ?URLPATH avatar_url, LONG_TEXT signature, BINARY is_perm_banned, BINARY preview_posts, BINARY reveal_age, SHORT_TEXT title, URLPATH photo_url, URLPATH photo_thumb_url, BINARY views_signatures, ?BINARY auto_monitor_contrib_content, ?LANGUAGE_NAME language, BINARY allow_emails, BINARY allow_emails_from_staff, LONG_TEXT personal_notes, ?IP ip_address, SHORT_TEXT validated_email_confirm_code, boolean check_correctness, ?ID_TEXT password_compatibility_scheme, SHORT_TEXT salt, BINARY zone_wide, ?TIME last_submit_time, ?AUTO_LINK id, BINARY highlighted_name, SHORT_TEXT pt_allow, LONG_TEXT pt_rules_text)
AUTO_LINK ocf_make_boiler_custom_field (ID_TEXT type)
array get_cpf_storage_for (ID_TEXT type)
AUTO_LINK ocf_make_custom_field (SHORT_TEXT name, BINARY locked, SHORT_TEXT description, LONG_TEXT default, BINARY public_view, BINARY owner_view, BINARY owner_set, BINARY encrypted, ID_TEXT type, BINARY required, BINARY show_in_posts, BINARY show_in_post_previews, ?integer order, LONG_TEXT only_group, boolean no_name_dupe, BINARY show_on_join_form)

AUTO_LINK ocf_make_member(SHORT_TEXT username, SHORT_TEXT password, SHORT_TEXT email_address, ?array groups, ?integer dob_day, ?integer dob_month, ?integer dob_year, array custom_fields, ?ID_TEXT timezone, ?GROUP primary_group, BINARY validated, ?TIME join_time, ?TIME last_visit_time, ID_TEXT theme, ?URLPATH avatar_url, LONG_TEXT signature, BINARY is_perm_banned, BINARY preview_posts, BINARY reveal_age, SHORT_TEXT title, URLPATH photo_url, URLPATH photo_thumb_url, BINARY views_signatures, ?BINARY auto_monitor_contrib_content, ?LANGUAGE_NAME language, BINARY allow_emails, BINARY allow_emails_from_staff, LONG_TEXT personal_notes, ?IP ip_address, SHORT_TEXT validated_email_confirm_code, boolean check_correctness, ?ID_TEXT password_compatibility_scheme, SHORT_TEXT salt, BINARY zone_wide, ?TIME last_submit_time, ?AUTO_LINK id, BINARY highlighted_name, SHORT_TEXT pt_allow, LONG_TEXT pt_rules_text)

Add a member.

Parameters…

Name username
Description The username.
Type SHORT_TEXT

Name password
Description The password.
Type SHORT_TEXT

Name email_address
Description The e-mail address.
Type SHORT_TEXT

Name groups
Description A list of usergroups (NULL: default/current usergroups).
Type ?array

Name dob_day
Description Day of date of birth (NULL: unknown).
Type ?integer

Name dob_month
Description Month of date of birth (NULL: unknown).
Type ?integer

Name dob_year
Description Year of date of birth (NULL: unknown).
Type ?integer

Name custom_fields
Description A map of custom field values (field-id=>value).
Type array

Name timezone
Description The member timezone (NULL: auto-detect).
Default value
Type ?ID_TEXT

Name primary_group
Description The member's primary (NULL: default).
Default value
Type ?GROUP

Name validated
Description Whether the profile has been validated.
Default value 1
Type BINARY

Name join_time
Description When the member joined (NULL: now).
Default value
Type ?TIME

Name last_visit_time
Description When the member last visited (NULL: now).
Default value
Type ?TIME

Name theme
Description The member's default theme.
Default value
Type ID_TEXT

Name avatar_url
Description The URL to the member's avatar (blank: none) (NULL: choose one automatically).
Default value
Type ?URLPATH

Name signature
Description The member's signature (blank: none).
Default value
Type LONG_TEXT

Name is_perm_banned
Description Whether the member is permanently banned.
Default value 0
Type BINARY

Name preview_posts
Description Whether posts are previewed before they are made.
Default value 0
Type BINARY

Name reveal_age
Description Whether the member's age may be shown.
Default value 1
Type BINARY

Name title
Description The member's title (blank: get from primary).
Default value
Type SHORT_TEXT

Name photo_url
Description The URL to the member's photo (blank: none).
Default value
Type URLPATH

Name photo_thumb_url
Description The URL to the member's photo thumbnail (blank: none).
Default value
Type URLPATH

Name views_signatures
Description Whether the member sees signatures in posts.
Default value 1
Type BINARY

Name auto_monitor_contrib_content
Description Whether the member automatically is enabled for notifications for content they contribute to (NULL: get default from config).
Default value
Type ?BINARY

Name language
Description The member's language (NULL: auto detect).
Default value
Type ?LANGUAGE_NAME

Name allow_emails
Description Whether the member allows e-mails via the site.
Default value 1
Type BINARY

Name allow_emails_from_staff
Description Whether the member allows e-mails from staff via the site.
Default value 1
Type BINARY

Name personal_notes
Description Personal notes of the member.
Default value
Type LONG_TEXT

Name ip_address
Description The member's IP address (NULL: IP address of current user).
Default value
Type ?IP

Name validated_email_confirm_code
Description The code required before the account becomes active (blank: already entered).
Default value
Type SHORT_TEXT

Name check_correctness
Description Whether to check details for correctness.
Default value boolean-true
Type boolean

Name password_compatibility_scheme
Description The compatibility scheme that the password operates in (blank: none) (NULL: none [meaning normal ocPortal salted style] or plain, depending on whether passwords are encrypted).
Default value
Type ?ID_TEXT

Name salt
Description The password salt (blank: password compatibility scheme does not use a salt / auto-generate).
Default value
Type SHORT_TEXT

Name zone_wide
Description Whether the member likes to view zones without menus, when a choice is available.
Default value 1
Type BINARY

Name last_submit_time
Description The time the member last made a submission (NULL: set to now).
Default value
Type ?TIME

Name id
Description Force an ID (NULL: don't force an ID)
Default value
Type ?AUTO_LINK

Name highlighted_name
Description Whether the member username will be highlighted.
Default value 0
Type BINARY

Name pt_allow
Description Usergroups that may PT the member.
Default value *
Type SHORT_TEXT

Name pt_rules_text
Description Rules that other members must agree to before they may start a PT with the member.
Default value
Type LONG_TEXT

Returns…

Description The ID of the new member.
Type AUTO_LINK

Return to the function index for this class Expand: View the source code to this function

AUTO_LINK ocf_make_boiler_custom_field(ID_TEXT type)

Make a custom profile field from one of the predefined templates (this is often used by importers).

Parameters…

Name type
Description The identifier of the boiler custom profile field.
Type ID_TEXT

Returns…

Description The ID of the new custom profile field.
Type AUTO_LINK

Return to the function index for this class Expand: View the source code to this function

array get_cpf_storage_for(ID_TEXT type)

Find how to store a field in the database.

Parameters…

Name type
Description The field type.
Type ID_TEXT

Returns…

Description A pair: the DB field type, whether to index.
Type array

Return to the function index for this class Expand: View the source code to this function

AUTO_LINK ocf_make_custom_field(SHORT_TEXT name, BINARY locked, SHORT_TEXT description, LONG_TEXT default, BINARY public_view, BINARY owner_view, BINARY owner_set, BINARY encrypted, ID_TEXT type, BINARY required, BINARY show_in_posts, BINARY show_in_post_previews, ?integer order, LONG_TEXT only_group, boolean no_name_dupe, BINARY show_on_join_form)

Make a custom profile field.

Parameters…

Name name
Description Name of the field.
Type SHORT_TEXT

Name locked
Description Whether the field is locked (i.e. cannot be deleted from the system).
Default value 0
Type BINARY

Name description
Description Description of the field.
Default value
Type SHORT_TEXT

Name default
Description The default value for the field.
Default value
Type LONG_TEXT

Name public_view
Description Whether the field is publically viewable.
Default value 0
Type BINARY

Name owner_view
Description Whether the field is viewable by the owner.
Default value 0
Type BINARY

Name owner_set
Description Whether the field may be set by the owner.
Default value 0
Type BINARY

Name encrypted
Description Whether the field is encrypted.
Default value 0
Type BINARY

Name type
Description The type of the field.
Default value long_text
Type ID_TEXT
Values restricted to short_text long_text short_trans long_trans integer upload picture url list tick float

Name required
Description Whether it is required that every member have this field filled in.
Default value 0
Type BINARY

Name show_in_posts
Description Whether this field is shown in posts and places where member details are highlighted (such as an image in a member gallery).
Default value 0
Type BINARY

Name show_in_post_previews
Description Whether this field is shown in preview places, such as in the teaser for a member gallery.
Default value 0
Type BINARY

Name order
Description The order of this field relative to other fields (NULL: next).
Default value
Type ?integer

Name only_group
Description The usergroups that this field is confined to (comma-separated list).
Default value
Type LONG_TEXT

Name no_name_dupe
Description Whether to check that no field has this name already.
Default value boolean-false
Type boolean

Name show_on_join_form
Description Whether the field is to be shown on the join form
Default value 0
Type BINARY

Returns…

Description The ID of the new custom profile field.
Type AUTO_LINK

Return to the function index for this class Expand: View the source code to this function