{let requiredAttributes=ezini("RequiredClassAttributes","RequiredAttributes","site.ini")
myClassAttributeID=$myAttribute.contentclassattribute_id}
{section show=or($requiredAttributes|contains($myClassAttributeID),$myAttribute.contentclass_attribute.is_required)}
Hey, im required.
{section-else}
Im not required.
{/section}
{/let}
I feel this is a little easier to do than with the class system or with a workflow.
The only problem: when validating the input, eZ publish itself won't check if there is input given in the additional required fields because they are not defined as required in the class definition. One solution (but not very nice): declare all attributes as required and fill e.g. the company name with nonsens in a hidden HTML input field if it is a normal user.
Any better idea. Am I right, that there is no simple way to tell eZ publish "When validation this user's data consider the attribute 'company name' as required."
Putting a workflow for before user/register would allow you get by this but its a little messy to implement :(
I've used hidden fields in the past to 'prefill' such information. You could use the example code i gave earlier to decide whether to show a proper input field or a hidden one. And set the hidden field to 'No company'. If the text is suitable its not actually too bad.
If you dont this information shown to users you could always test for this string, and whether anything was chosen in your other attributes, and show or not show in other templates.