show profile fields as currency and %
-
Hi there,
i´am looking for a way to show profile fields as a currency or a percentage. I use the xprofile custom profile fields plugin to use some profile fields as number fields. However it doesn´t support a currency filter jet. I tried to following code in the custom profile fields plugin on advice as a first step:
add_filter( 'bxcft_show_field_value', 'my_show_field', 15, 4); function my_show_field($value_to_return, $type, $id, $value) { if ($type == 'number') { $value = str_replace("<p>", "", $value); $value = str_replace("</p>", "", $value); $field = new BP_XProfile_Field($id); if ($field->name == 'Waarde van je gadget (€)') { setlocale(LC_MONETARY, 'nl_NL'); $value = money_format('%.2n', $value) . "\n"; $new_value = money_format('%.2n', $value) . "\n"; } else { $new_value = $value; } return '<p>'.$new_value.'</p>'; } return $value_to_return; }
this code should change profile field 15 to a currency, unfortunatly it didn’t work. I hope there is a way to do this in buddypress itself. Can somebody please help me to the right direction? many many thanks in advance 🙂
- The topic ‘show profile fields as currency and %’ is closed to new replies.