@maarty
For me, I added them under the player metrics – you can create your own Variable name :
https://nghapoe.ca/players/avery-norman/
Thread Starter
maarty
(@maarty)
Yes, I understand that, but what is the value of the variable for age?
variable for Matches played is “eventsplayed”
and
variable for age is what? “age” does not work
Thread Starter
maarty
(@maarty)
yes, I thought the value would be displayed automatically. by the player’s date of birth.
I can do it manually
@maarty
Oh! You mean you want a generated value for the age based on a birth year metric ?
I’ll wait for @roch or @savvas to comment if it is configurable within the SportsPress GUI.
Otherwise, you can write a php function in your template.
Thread Starter
maarty
(@maarty)
Yes, that’s exactly what I want. we’ll see.
thanks for the help π
Hi!
That’s a great idea, but we don’t have this at the moment. This would require some PHp code indeed.
Thanks!
Hi!
Just a quick update on this one. I’ve been playing around with it, and the easiest approach I could find was to create a player metric and populate it with the player’s birthdate.
Then you can use PHP or even JS code to convert that one to age.
Thanks!
Plugin Contributor
Savvas
(@savvasha)
Hi there to all,
Almost 2 years ago I created a branch to achieve exactly that!
https://github.com/ThemeBoy/SportsPress/tree/feature-dob-age-player-lists
Can you try to CAREFULLY merge the changes and see if it is what you want?
Thanks,
Savvas
Thread Starter
maarty
(@maarty)
Thanks for helping @savvasha
I’m sorry, but I’m a beginner
I downloaded the plugin
Installed plugin
and now I did: Sport Press | Configure | Player Metrics | Add New
What should I write in the Variable field? https://ibb.co/1X8yGG9
maarty
Hi @savvasha
Oh, I should have seen this one before diving to much into the code.
As far as I can see, only this file is changed:
https://github.com/ThemeBoy/SportsPress/commit/8d037f8a87b74f4cdadfd8cc86abb305c03adb52
Is that right?
Thanks!
Plugin Contributor
Savvas
(@savvasha)
You need to check the three commits made on 28th of November https://github.com/ThemeBoy/SportsPress/commits/feature-dob-age-player-lists
Thanks,
Savvas
Plugin Contributor
Savvas
(@savvasha)
Take care though, the commits and changes were made to a very very old version of SportsPress!
Hey @maarty
I have just tested Savvas’ code and it works like magic.
If you want I can give you instructions on how to implement it in the current SP version.
Thanks!
-
This reply was modified 6 years ago by
Roch.
Thread Starter
maarty
(@maarty)
Hey @rochesterj
Yes please, thank you very much!