- Profile Extra Fields Module v0.2, packaged with the Pligg CMS (Created by: AshDigg) ** we miss him. Where is he? **. The functionality of this module is to take whatever extra fields defined in the second module and display them in the “Modify profile” template /templates/yourtemplate/profile_center.tpl.
- Extended Profile Module v0.1, that requires the above module to work (Created by: Andrew Egenes and outlined in this thread http://forums.pligg.com/pligg-modules/11360-extended-user-profile-v0-1-almost-done-need-help.html). The functionality of this module is supposed to display the extra fields in the “user profile” template template /templates/yourtemplate/user_center.tpl (the public viewable profile). I hope that Andrew’s module will find its way to the core of the new version.
While I have contributed to this thread by providing some guidelines on how to add extra fields, etc. I did it without going through the code of the module (my bad!); therefore my contribution is insignificant and null because I explained how to manually add extra fields, which defeats the purpose of Andrew’s module and it does not really help his intentions to provide easy means to lift the burden of manually adding new fields to the profile.
I am correcting my shortcomings by providing a complete fix and improvement to both modules.
I volunteered, yesterday, to help a fellow Pligger add new fields using the above mentioned two modules. While I was going through the code, I have noticed that Profile Extra Fields Module v0.2 does only provide for fields that are <input type="text">. Furthermore, I discovered what is missing from Andrew’s module to display the user’s info.
Let’s start with the latter, Andrew’s module.
1. A module system hook to fill the smarty variables in the /libs/user.php was missing. These variables are needed to pass the info to the appropriate templates. To fix this issue:
Open /libs/user.php and look for the “function fill_smarty(” and add the following code right below it:
Code:
function fill_smarty($main_smarty, $stats = 1){
// add this code
// module system hook
$vars = '';
check_actions('profile_show', $vars);
2. The /modules/profiles/templates/profile_extend.tpl used the incorrect method to fetch the variables that are passed by /modules/users_extra_fields/users_extra_fields_main.php. I completely changed the code in this template file and commented every chunk of code to understand how it is processing the variables.
The issue with the Profile Extra Fields Module v0.2 is that it does only provide for fields that are <input type="text">. To rectify this problem, I have created new template files to ensure that all type of fields are addressed and processed (I.e. textarea, radio buttons, select options, and input text).
The new created templates (in /modules/users_extra_fields/templates) are for:
- Type Select Options
- Countries, it include 245 entries (according to Wikipedia)
- State/Province for the United States and Canada
- Years, from 1900 t0 2008
- Months by name, January to December
- Months by number, 01 to 12
- Day of the month, 01 to 31
- Days of the week, Monday to Sunday
- Gender, Male / Female
- Cars, sedan, sports, convertible, etc.
- Smoking, Non-smoking
- Age, from 15 to 99
- Marital status
- Type textarea:
- Bio
- Type radio buttons
I also have created a file /modules/profiles/ready select options.txt which contains ready code for the above mentioned select options for you to use any where you need to put some or all of them in HTML pages.
**** See the tutorial in the next post. ****






Linear Mode




