How to create a Gender field - with auto gender specific Image, language and search compliant in CB 1.2.3
chrissy6930 posted on 2010/03/27 an interesting post for a gender field adjusting the gender image displayed
As I'm using gender support, that display the default gender image and integrates in a multilanguages website, I have adapt chrissy6930 codes and propose it here.
1 - Create new field:
type Dropdown(single select) or Radio Buttons
Name: cb_gender
Title: _UE_GENDER
with 2 values : _UE_MALE and _UE_FEMALE
Searchable in users-lists: Yes (works fine)
2 - As _UE_MALE and _UE_FEMALE already exist in all CB language files, just add a line for _UE_GENDER translation. Example for english: DEFINE ('_UE_GENDER','Gender');
Language files are located in root/components/com_comprofiler/plugin/language/language name/language name.php
3 - Make the gender specific nophoto images display on component stuff by replacing "cb.core.php" with attached "cb.core.php".
Adaptations have been made in "function _avatarLivePath" (line 2580)
File is located in root/components/com_comprofiler/plugin/user/plug_cbcore/
Note : don't forget to keep a copy of the original file (Example: by renaming it "cb.core_ORIG.php".
4 - Make the gender specific nophoto images display in plugins by replacing "plugin.foundation.php" with attached "plugin.foundation.php".
Adaptations have been made in "function avatarFilePath" (line 994)
File is located in root/administrator/components/com_comprofiler/
Note : don't forget to keep a copy of the original file (Example: by renaming it "plugin.foundation_ORIG.php"
Now once a user has update is gender profile, the standard nophoto image will be replaced with the gender specific nophoto image and also in member lists and in plugins
Attachment gender_support_int.zip not found
Hope will help up to CB 2.0 release, that will probably integrate such field.
Post edited by: nicophp, at: 2010/07/16 15:18
Post edited by: nicophp, at: 2010/07/16 16:12