How to set default (Admin Only Changeable) field

14 years 4 weeks ago #127274 by rspack
I am using Joomla 1.5.15, CB 1.2.2 and have a radio button field titled, "Experience Level".

The field has four choices:

VSM A-List
VSM Proven Professional
VSM Up and Coming Actor
VSM Fresh New Faces

I have set the default as VSM Fresh New Faces.

My issue is that if I hide the field from the registration form, it will not set and populate the field in the database. If I show the field on the registration form it will set the default and populate the database field, but when shown on the register form it can be changed by the user, even when I have the field set to Read Only.

The only time the read only works is when the user is in edit mode, and then the field is greyed out or unchangeable (which is what I want), but it is not pre-filled unless I show it on the register form, or populate the field during registration.

Basically I want to set the default during registration and not show it on the register form. The field is an Admin changeable field only, and can only be changed from the backend by an admin after the user registers and upon later review of the user's credentials.

Any ideas what I need to do to get this to work?

Please Log in to join the conversation.

14 years 4 weeks ago #127279 by krileon

My issue is that if I hide the field from the registration form, it will not set and populate the field in the database. If I show the field on the registration form it will set the default and populate the database field, but when shown on the register form it can be changed by the user, even when I have the field set to Read Only.

Correct, it's default on registration; if field is not present on registration it will not populate with default value.

You could create a CB Plugin to use onAfterUserRegistration trigger to populate this field however and you would then not need to show it at registration. Please see tutorials in signature for how to use CB triggers in a plugin.

Basically I want to set the default during registration and not show it on the register form. The field is an Admin changeable field only, and can only be changed from the backend by an admin after the user registers and upon later review of the user's credentials.

Read only does not affect registration, this is only for profile edit. Placing the field on registration will permit it to be editable by anyone.

A better approach maybe to use CB Privacy and set the field to be editable only by moderators, this way you (as a moderator) can also edit it from frontend or backend; while the user can not edit it at all (except at registration of course).

Post edited by: krileon, at: 2010/03/18 21:01


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.

14 years 4 weeks ago #127306 by nant
Another possibility would be to use phpmyadmin to create the default value for this column in the comprofiler table.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.193 seconds

Facebook Twitter LinkedIn