Getting the userId and date created values

Nov 7, 2014 at 8:15 AM
Hi all,

I have started to play about with this module and I'm beginning to see the potential of using it in our solutions for our clients.

At the moment I'm looking at creating a simple blog/news system that the user can enter a blog/news items.

I don't want the client to enter his/her name every time they create a new blog entry so, is there a way to get the users userId or name automatically with the razor template (CreatedByUser)?

The same applies to the date the blog/news item was created, is there a way to get this value automatically with the razor template as well (DateCreated)?

Regards,

Geoff
Nov 7, 2014 at 8:48 AM
Hi geoff

Good yo see uou amongst the converts

I have done something like this before but it involved adding inline. Code and script to the popup skin so thtas not a solution

I did however sponor some features that would allow you to do all this and more within a month or so

Armand
Nov 7, 2014 at 9:12 AM
Hi Armand,

I would have thought that there would be a database value for the CreatedByUser and DateCreated (for example).

Had a look in the database tables but couldn't find what I was looking for.

Regrads,
Geoff
Nov 10, 2014 at 9:36 PM
for my blog system I just made a dropdown of users and let user select ( untill the sponsored features kick in and we can do this in another way )

same goes for the data it has to be slected from a date input type for now
Coordinator
Nov 11, 2014 at 2:04 PM
@geoff

Created
DateCreated and DateModifed exists - but I believe it wasn't surfaced to the Razor till 6.4. It should now be there as Content.Modified or Content.DateModified (not sure, just try it).

Users
There are various ways to do this, but basically the system doesn't provide you with this data. It logs who made what changes, but it's at a data-level and not available for content-use; you also shouldn't rely on it. The easiest way is probably to
  1. Create a field where you store that info
  2. prefill it (so change the "add" button to prefill that field - there's some documentation on that in the docs and some demos (like the new JavaScript API-Demos) show you how to do that...
Nov 11, 2014 at 2:57 PM
oh totally forget about the pre-fill option have to look better into whats possible with that one
Nov 11, 2014 at 3:04 PM
@Daniel

Where are the Javascript api demo;s I am finding a few online but the link to 404 pages
Coordinator
Nov 12, 2014 at 10:21 AM