-
Hi,
I use now ‘date picket’ to let members fill in their birthday date.
But I want to show their ‘Age’ in numbers on the profiles. Is there a trick that they can see the age instead of the date they filled in?Strange that there is no ‘Age’ field. Pretty important for a profile..
You can use hooks to do this task as there is no age field automatically. The logic is simple, you need to hook into the action that prepends key value e.g. convert a youtube link to video embed as used in this example
See functions/fields-hooks.php
/* Pre-value: Vimeo, YouTube */
if (strpos($value, “vimeo.com”) !== false || strpos($value, “youtube.com”) !== false ) {
if ( substr( $value, 0, 7 ) === “http://” || substr( $value, 0, 8 ) === “https://” ) {
global $wp_embed;
$post_embed = $wp_embed->run_shortcode(‘[embed height="200"]‘.$value.’[/embed]‘);
return $post_embed;
}
}Hm, I don’t rly get this..
I need to put in fields-hooks.php a code so it will convert the display to a age-number. But I don’t get this youtube example doing something like that. I assume I need to do this with a ‘date-picker’ field?e.g. If field key == age, compute the date and find age from date, the hook usage assumes you have basic php knowledge. Do you? Did you deal with wordpress actions/hooks before?
I don’t have enough php knowledge for it, no.
I thought it would be a general-code I just could use, but it seems it’s more difficult to do it.But why is the age field here on the site but not in the script? Maybe cool to add this in some update, or not?
The age field allow user to put his age and not a datepicker that automatically transforms inputted date to age.
Can admin share the hooks for this.This is very mandatory requirement for everyone who use the software.This will save everyone
You must be logged in to reply to this topic.