Hi,
this is not possible with a simple way, I think that the best way to do this without hack the code of Easy Profile is to use another field to order:
1) Create a text field type with alias "birthdate_order" (no available in profile, edit profile, registration pages, basically it is a system field useful only for the order)
2) Create a plugin that store in this field only the month and the day
- Download (at the end of docs page at
http://docs.easy-profile.com/index.php/article/triggers ), install and enable (Extensions->Plugins) skeleton plugin
- Open the edit the file at /plugins/jsn/skeleton/skeleton.php
- Replace entire code with this
<?php
defined('_JEXEC') or die;
class PlgJsnSkeleton extends JPlugin
{
public function triggerProfileUpdate($user, &$data, $changed, $isNew)
{
if( !empty( $data[ 'birthday' ] ) ){
$data[ 'birthdate_order' ] = substr( $data[ 'birthday' ] , 5 ); /* date field have a format like 1983-03-28, so we need to remove the first 5 characters to have something like 03-28 */
}
}
}
3) set "birthdate_order" as first order field
This code will fill the field "birthdate_order" with only month and day when you register or update some user, so for existing users you need to fill "birthdate_order" with a simple SQL like:
UPDATE #__jsn_users SET birthdate_order = SUBSTRING(birthday, 6)
NOTES:
- in the PHP substr function the first character position is 0, so with substr( $data[ 'birthday' ] ,
5 ) we remove the first 5 chars (YYYY-), the new string start from
5th char
- in the MYSQL SUBSTRING function the first character position is 1, so with SUBSTRING(birthday,
6) we remove the first 5 chars (YYYY-), the new string start from
6th char
- This code is not tested, I wrote this quickly therefore I recommend you to do some tests