Commit c65ca411 authored by Nigel McNie's avatar Nigel McNie

Don't do queries to get profile field values that are in the session. Saves...

Don't do queries to get profile field values that are in the session. Saves three queries every page load.
parent 8865e8c4
......@@ -727,7 +727,15 @@ function auth_check_required_fields() {
require_once('pieforms/pieform.php');
$elements = array();
$alwaysmandatoryfields = array_keys(ArtefactTypeProfile::get_always_mandatory_fields());
foreach(ArtefactTypeProfile::get_mandatory_fields() as $field => $type) {
// Always mandatory fields are stored in the usr table, so are part of
// the user session object. We can save a query by grabbing them from
// the session.
if (in_array($field, $alwaysmandatoryfields) && $USER->get($field) != null) {
continue;
}
// Not cached? Get value the standard way.
if (get_profile_field($USER->get('id'), $field) != null) {
continue;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment