Custom fields

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Custom fields

Arjen
Hi,

Does anybody know if it's possible to add custom fields or properties to default dotcms objects?
For example, if I wanted to add a certain date field (join date) to the user properties would that be possible?

I guess ideally I'd be able to add these from within an osgi plugin, but any option would be great.

Thanks
Arjen

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/741b8d25-162b-4894-9b30-ed96f1371d1b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

RE: Custom fields

Nathan Keiter

I wouldn’t mess with the user_ or user_proxy objects.

 

You could create a content type to store meta-data, keyed on username or userid.

 

Then you could pull the content for display somewhere.

 

You’d have to override or intercept the account registration process to save to your content type the extra fields.

 

Nathan I. Keiter | Lead Network Applications Programmer | Benefits Advisory Council Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Arjen
Sent: Wednesday, January 10, 2018 4:54 AM
To: dotCMS User Group
Subject: [dotcms] Custom fields

 

Hi,

 

Does anybody know if it's possible to add custom fields or properties to default dotcms objects?

For example, if I wanted to add a certain date field (join date) to the user properties would that be possible?

 

I guess ideally I'd be able to add these from within an osgi plugin, but any option would be great.

 

Thanks

Arjen

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/741b8d25-162b-4894-9b30-ed96f1371d1b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/e8c3c7cfe9b64ab48062e2da72924ba2%40exch13c.ms.gettysburg.edu.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Custom fields

John Michael Thomas
In reply to this post by Arjen
You can add fields to any object which has a Content Type.  This includes Sites, Page Assets, File Assets, and in 4.2 it also includes Vanity URLs and Language variables.

But you can't easily add fields or properties to any object which is not content.  This includes Users and Roles, Templates, Containers, Menu Links, Rules, Categories, and Workflows.

You might be able to add properties to some of these via a plugin, but I agree with Nathan that it's probably not a good idea to add properties to any of the permission objects (Users and Roles).

Here's a couple other ways you may be able to do this without touching the permissions tables:
  • Linked Content Type: As Nathan said, you could create a separate content type to link to the user ID.
    • This would obviously require some coding and management, but you could make this semi-seamless by updating the UI code to display this on the Users screen without touching the users table in the DB.
  • Use an Existing Field: Hijack one of the other purely informational fields in the existing Users screen (like the Facebook ID, Open ID, etc. fields under the "Additional Info" tab) to display the information you want to keep for each user.
    • Changing the UI to display a different label for one of these (and maybe format the data as a date) would be fairly simple.

Hope it helps.


On Wednesday, January 10, 2018 at 1:53:30 AM UTC-8, Arjen wrote:
Hi,

Does anybody know if it's possible to add custom fields or properties to default dotcms objects?
For example, if I wanted to add a certain date field (join date) to the user properties would that be possible?

I guess ideally I'd be able to add these from within an osgi plugin, but any option would be great.

Thanks
Arjen

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/d798fcf9-d3f0-4e7c-8a6b-951d5414e493%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Custom fields

Arjen
Thank you both very much.

I was hoping to be able to avoid this but I think I'll just have to 'hijack' an exiting field for this purpose, but it would have been nice to be able to customise them instead.

Thanks anyway.

Arjen
 

On Wednesday, January 10, 2018 at 3:38:39 PM UTC, John Michael Thomas wrote:
You can add fields to any object which has a Content Type.  This includes Sites, Page Assets, File Assets, and in 4.2 it also includes Vanity URLs and Language variables.

But you can't easily add fields or properties to any object which is not content.  This includes Users and Roles, Templates, Containers, Menu Links, Rules, Categories, and Workflows.

You might be able to add properties to some of these via a plugin, but I agree with Nathan that it's probably not a good idea to add properties to any of the permission objects (Users and Roles).

Here's a couple other ways you may be able to do this without touching the permissions tables:
  • Linked Content Type: As Nathan said, you could create a separate content type to link to the user ID.
    • This would obviously require some coding and management, but you could make this semi-seamless by updating the UI code to display this on the Users screen without touching the users table in the DB.
  • Use an Existing Field: Hijack one of the other purely informational fields in the existing Users screen (like the Facebook ID, Open ID, etc. fields under the "Additional Info" tab) to display the information you want to keep for each user.
    • Changing the UI to display a different label for one of these (and maybe format the data as a date) would be fairly simple.

Hope it helps.


On Wednesday, January 10, 2018 at 1:53:30 AM UTC-8, Arjen wrote:
Hi,

Does anybody know if it's possible to add custom fields or properties to default dotcms objects?
For example, if I wanted to add a certain date field (join date) to the user properties would that be possible?

I guess ideally I'd be able to add these from within an osgi plugin, but any option would be great.

Thanks
Arjen

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/89bd9de7-9833-4c66-8249-59d84ba934e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.