Support

  1. desoxire
  2. General
  3. Tuesday, May 15 2018, 05:24 PM
  4.  Subscribe via email
Hello!

I would like to have a hidden date-field which always has the current date/time as value.
This would help us know, when a profile was updated the last time.

Is this possible? Can you please give me a hint, how to do so?

Thank you very much!
admin Accepted Answer
Admin
Hi,
Easy Profile does not do this natively but you can create a plugin that update a date field, follow these steps:
- Create a Date field type (not shown in edit profile and registration pages)
- Download, Install and Enable Skeleton Plugin (you will find it at http://docs.easy-profile.com/index.php/article/triggers)
- Open file /plugins/jsn/skeleton/skeleton.php
- remove samples functions: triggerFieldAvatarUpdate, triggerProfileUpdate
- add function like this:
public function triggerProfileUpdate($user, &$data, $changed, $isNew)
{
if(!$isNew)
{
$data['alias_of_the_field'] = date("Y-m-d H:i:s");
}
}
Replace alias_of_the_field with alias of your field.

NOTE: This code is not tested and not supported, this is only for example purpose.
  1. one week ago
  2. General
  3. # 1
desoxire Accepted Answer
Pro
Hello! Thank you very much. Unfortunatedly this has no effect on my date fields. in the database is the value 0000-00-00 00:00:00

In my date fields i selected following date formats: See attachment

The skeleton plugin is installed and active.

Here is my code. I have two date fields. One should contain the date of user registration. The other should alwasys contain the date of the last edit.


<?php
defined('_JEXEC') or die;

class PlgJsnSkeleton extends JPlugin
{
public function triggerProfileUpdate($user, &$data, $changed, $isNew)
{
if(!$isNew)
{
$data['datum_profil_bearbeitet'] = date("d.m.Y H:i:s");
}

if($isNew)
{
$data['datum_profil_angelegt'] = date("d.m.Y H:i:s");
}
}
}
?>


Can you please help me to get this work? Thank you!!!
Attachments (1)
  1. one week ago
  2. General
  3. # 2
admin Accepted Answer
Admin
Hi,
you need to store in database the raw format, so the format of the date field need to be compliant with SQL date format.

In date function you need to use "Y-m-d" instead "d.m.Y"
  1. one week ago
  2. General
  3. # 3
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Request Support

Support is currently Offline

Support Availability

Working days: Monday to Friday. The support staff is not available on weekends; in the most of cases tickets will not be answered during that time.

Reply time: Depending on the complexity of your support issue it's usually between a few minutes and 24 hours for paid members and about one week for free members. When we expect longer delays we will notify you.

Guidelines

Before you post: read the documentation and search the forums for an answer to your question.

When you post: include Site Details if you request a support (you can use the form below the reply in Site Details tab).

Auto Solved Question: If after a week the author of the post does not reply to a request by moderator, the question will be marked as resolved.

Language: only English

Easy ProfileĀ® is not affiliated with or endorsed by Open Source Matters or the Joomla Project. Joomla is Free Software released under the GNU/GPL License.