profile validation - solution design question

6 years 7 months ago #297377 by fdinkler
Regarding the following use case:
Each time a user's profile is viewed, by anyone with access rights, a validation routine is triggered to evaluate the profile data and return a set of messages to be viewed within the profile itself. (a read-only text area.)
Saves would also trigger validation and update the validation results caused by profile field changes. The updated validation result messages should also appear after a save.

Complications:
The number of validations is large (over 50 fields to be validated, some fields are validated/dependent on other profile fields)
The number of profile fields to be validated may also vary, based on values in certain other profile fields

I'm quite handy with SQL, so I was thinking of building a MySQL procedure that returned the message strings.
Questions:
Assuming this is an auto-action, what are the event triggers for viewing and saving a user profile?
Other suggestions on alternative methods?
Thanks,
Fred

Please Log in to join the conversation.

6 years 7 months ago #297387 by krileon
Replied by krileon on topic profile validation - solution design question
Depending on the validation you can probably just do that using a Custom HTML field and substitutions. Worst case you use a CB Code Field and write the PHP to validate everything and return whatever messages you want displayed, which will display wherever you put the field. You could also use CB Query Field if you wanted to do it entirely with SQL. Validating 50 fields won't be an issue for PHP or substitutions.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

6 years 7 months ago #297407 by fdinkler
Replied by fdinkler on topic profile validation - solution design question
Kyle -
Thanks, appreciate the fast reply.
Is there docy/tutorial on using substitutions?
Fred

Please Log in to join the conversation.

6 years 7 months ago #297412 by krileon
Replied by krileon on topic profile validation - solution design question
See the below tutorial for substitution usage information.

www.joomlapolis.com/documentation/279-community-builder/tutorials/18353-using-substitutions-throughout-cb

You'd just use IF substitutions as shown at the bottom of the tutorial to validate. You can use REGEXP or just simple matches to validate as needed.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

6 years 7 months ago - 6 years 7 months ago #297489 by fdinkler
Replied by fdinkler on topic profile validation - solution design question
Thanks for the tutorial links - good stuff.

To follow on with this use case - I need to set a value in another profile field based on the validation results.
Is that possible from the Custom HTML field, or would I need to move to php Code field and include the db helper classes and all that?

Assuming I would need to move to php, how do I determine what user profile I'm executing on, within the php code? (I found a reference to $user array in a tutorial, so I assume that's the answer...)

Fred

Please Log in to join the conversation.

6 years 7 months ago #297493 by krileon
Replied by krileon on topic profile validation - solution design question

To follow on with this use case - I need to set a value in another profile field based on the validation results.

You could do that dynamically using the Layout features for fields. Edit the field that you need its display to change then under Parameters > Layouts you can adjust how the field displays on profile view based off a IF substitution. Example as follows.

[cb:if username="demo"]This is Demo being displayed.[cb:else][value][/cb:else][/cb:if]

In this example if the username is demo it shows "This is Demo being displayed." otherwise it shows the value of the field. If you actually need this value stored in the database it gets a lot more complicated unfortunately and you'll likely have to use CB Auto Actions acting on profile update triggers and just do that behavior at storage time.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.217 seconds

Facebook Twitter LinkedIn