bsw/jbe@1309: local profile = app.session.member.profile bsw@286: bsw/jbe@1309: for i, field in ipairs(config.member_profile_fields) do bsw/jbe@1309: if not util.is_profile_field_locked(app.session.member, field.id) then bsw/jbe@1309: local value = param.get(field.id) bsw/jbe@1309: if value == "" then bsw/jbe@1309: value = null bsw/jbe@1309: end bsw/jbe@1309: profile.profile[field.id] = value bsw@286: end bsw@286: end bsw@286: bsw/jbe@1309: if not util.is_profile_field_locked(profile, "statement") then bsw@1045: local formatting_engine = param.get("formatting_engine") or config.enforce_formatting_engine bsw@931: bsw@931: local formatting_engine_valid = false bsw@1045: for i, fe in pairs(config.formatting_engines) do bsw@1045: if formatting_engine == fe.id then bsw@931: formatting_engine_valid = true bsw@931: end bsw@931: end bsw@931: if not formatting_engine_valid then bsw@931: error("invalid formatting engine!") bsw@931: end bsw@931: bsw@931: bsw@397: local statement = param.get("statement") bsw@931: bsw/jbe@1309: if statement ~= profile.statement or bsw/jbe@1309: formatting_engine ~= profile.formatting_engine then bsw/jbe@1309: profile.formatting_engine = formatting_engine bsw/jbe@1309: profile.statement = statement bsw/jbe@1309: profile:render_content(true) bsw@397: end bsw@931: bsw@397: end bsw@397: bsw/jbe@1309: if not util.is_profile_field_locked(profile, "birthday") then bsw/jbe@1309: if tostring(profile.birthday) == "invalid_date" then bsw/jbe@1309: profile.birthday = nil bsw@286: slot.put_into("error", _"Date format is not valid. Please use following format: YYYY-MM-DD") bsw@286: return false bsw@286: end bsw@75: end bsw@75: bsw/jbe@1309: local search_strings = {} bsw/jbe@1309: for i, field in ipairs(config.member_profile_fields) do bsw/jbe@1309: if field.index and profile.profile[field.id] and #(profile.profile[field.id]) > 0 then bsw/jbe@1309: search_strings[#search_strings+1] = profile.profile[field.id] bsw/jbe@1309: end bsw/jbe@1309: end bsw/jbe@1309: bsw/jbe@1309: if profile.statement and #(profile.statement) > 0 then bsw/jbe@1309: search_strings[#search_strings+1] = profile.statement bsw/jbe@1309: end bsw/jbe@1309: bsw/jbe@1309: profile.profile_text_data = table.concat(search_strings, " ") bsw/jbe@1309: bsw/jbe@1309: profile:save() bsw/jbe@0: bsw/jbe@0: bsw@931: slot.put_into("notice", _"Your page has been updated")