Reputation: 341
I would like to modify the required fields for the registration and the edit-profile forms in PyroCMS.
Unfortunately I cannot find the code which does the form handling (the part where the required fields are passed).
Can anybody point me to it?
Thanks.
Upvotes: 1
Views: 1106
Reputation: 1147
Assuming you are using PyroCMS 2.2.3 Community :
The "edit-profile" form is handled by the Users module.
system/cms/modules/users/views/profile/edit.php
system/cms/modules/users/controllers/users.php
, method edit
(line 649).At the beginning of the code, you can see the validation rules.
$this->validation_rules = array(
array(
'field' => 'email',
'label' => lang('user:email'),
'rules' => 'required|xss_clean|valid_email'
),
array(
'field' => 'display_name',
'label' => lang('profile_display_name'),
'rules' => 'required|xss_clean'
)
);
email
and display_name
are "hard coded" profile fields and so they are natively handled by the Users module. The rest are "soft" fields, I mean that they can be added/removed/edited by site admins into the Control Panel. These "soft fields" are handled by the Streams Core API. It means that you don't have to manage them in code.
All the metadata of streams is stored into the database. 3 tables are involved : default_data_streams
, default_data_field_assignments
and default_data_fields
, where default
is the prefix of your site.
If you want to add some custom profile fields then connect as an admin, go to Control Panel > Users tab > Users > Profile fields
then click "Add User Profile Field". You'll have a form where you can tell if the field is unique and required. The rest of the validation is handled by Streams.
If you really need to do that programmatically, see the developers docs of Streams Core API.
Helpful links :
Upvotes: 1