Support Forum
Hello,
here's my code...
On sp-custom-profile-fields-plugin.php I added:
function sp_CustomProfileShow($userid = null, $names = null, $tags = null) { include_once(CPFLIBDIR.'sp-custom-profile-fields-components.php'); include_once(CPFTAGSDIR.'sp-custom-profile-fields-display-tag.php'); echo sp_custom_profile_fileds_display_tag($userid, $names, $tags); }
On sp-custom-profile-fields-display-tag.php I added:
function sp_custom_profile_fileds_display_tag($userid = null, $names = null, $template = null){ if (!isset($userid)) { global $spThisUser; } if(isset($names) && !is_array($names)){ $names = explode(',', $names); } if(!isset($template)){ $template = '<div class="spColumnSection spProfileLeftCol"><p>[name]</p></div>' . '<div class="spColumnSection spProfileSpacerCol"></div>' . '<div class="spColumnSection spProfileRightCol">[data]</div>'; } $cfields = sp_custom_profile_fields_get_data(); $res = array(); if (!empty($cfields)){ foreach ($cfields as $fields) { $name = $fields['name']; $type = $fields['type']; $slug = $fields['slug']; if (!isset($names) || in_array($name, $names)) { if (!isset($userid)) { $data = $spThisUser->$slug; } else { $data = get_usermeta($userid, $slug, true); if ($type == 'textarea') { $data = sp_filter_text_display($data); } } $res[] = str_replace(array('[name]', '[data]'), array($name, $data), $template); } } } return implode(' ', $res); }
Thank you,
Lorenzo
the biggest problem here is that you have assumed the custom profile field will be displayed on the profile form... many users of the plugin are also displaying the info on each users post... so all that extra styling would be in error... if you want to do that, it needs to be a distinct function explicitly for displaying on the profile form only...
interesting on the include... I have not had an issue displaying two items, but clearly need to think through that a bit more...
agree on the filter of meta data from the user object... I had forgotten the user class already filters it... wont hurt anything but not needed and slightly wasteful...
Visit Cruise Talk Central and Mr Papa's World
I have committed the changes...
and more than willing to consider adding new template tags or functionality to this plugin... absolutely... just wanted to make sure you understood the nuances...
if you would like to make some updates for growth and flexibility, giving me a patch file with the changes would allow me to review easiest...
Visit Cruise Talk Central and Mr Papa's World
1 Guest(s)