Default field values in profiles set at reg...

17 years 9 months ago #17666 by p0stman911
I'm not sure if this is the right place, seems like we need a 'hacks' category in this forum. Anyway, I'm trying to set a default field value in a drop down list in users' profiles that is read-only (only the admin can change it). I searched for hours and found this post about adding default values for fields shown on the registration page, which has been integrated into 1.0 stable. But even though the field has a default value, users can still change it even though its set to 'read-only'.

Since this is a field that only admins can change I would like to set the field value without it even being visible on the registration page, so that after registration it will appear in the user profiles with the default field value selected.

Something to that effect has to be possible, but I don't have the php knowledge to accomplish it. Any help is greatly appreciated.

Thanks,
Kyle

Please Log in to join the conversation.

17 years 9 months ago #17862 by rogmann
I had the same problem: How do you assign defaulkt values to fiels not shown on the registration page?

I tried the following:

Instead of altering the "default" column entries in the ´jos_comprofiler_fields´-table (as suggested by the post you mentioned for fields appearing at registration ), one may also alter the table structure of the ´jos_comprofiler´-table for those fields that do not appear on the registration page to force CB to accept DEFAULT values when new users are added.

This can be used, for example, to make fields appear on a profile page where they would otherwise remain hidden or even to make tabs appear where they would be hidden due to all tab fields remaining unpopulated.

The MySQL-Syntax (e.g. for phpMyAdmin) for this essentially is

ALTER table `[your database name]`.`jos_comprofiler`
ALTER column `[fieldname1]` SET DEFAULT "[Defaulttext1]" ,
ALTER column `[fieldname2]` SET DEFAULT "[Defaulttext2]" ,
... ;


I just hope that in revised versions of CB there will be the possibility to assign DEFAULT values on the Field Manager-> Field Edit page of the comprofiler component irrespective of a field appearing on the registration page or not.

Hope this helps



J.J.R.

Post edited by: rogmann, at: 2006/07/30 15:32

Please Log in to join the conversation.

17 years 3 weeks ago #36322 by tayhow
Yes, allowing a default value for fields within CB backend field definition seems like a good and useful idea.

Is there a reason why (other than the team being rushed off their feet with everything else!) it hasn't been implemented? ... a technical reason?

I've looked at the jos_comprofiler_fields 'default' field, which is now a medium text as discussed ... but if this only applies to fields visible at registration, that's a bit restrictive.

Like Rogmann I thought of setting the default values in the table definition, but that's not ideal ... I'm not sure how well that will work with future upgrades.

My reason for wanting defaults is two fold:

- Partly to have a lot of info in a profile, with required fields, but to allow members to update from the standard settings 'over time'

and

- Partly to work with Mikko's APC to control visibility of some tabs and allow required fields on tabs that are initially hidden, but revealed later if members make them visible.

( Maybe this doesn't mean much to you unless you are working in detail on this area. :) )

Post edited by: tayhow, at: 2007/04/25 19:42

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.205 seconds

Facebook Twitter LinkedIn