So I have a WFS layer on QGIS, served by geoserver from a postgis table that around 10 to 20 people contribute to by adding new features or editing existing ones. I have a column called creator but not everyone bothers updating it and it would be most useful to see which user did what edit.

I was able to add a column that automatically gives the date but I wonder if it would be possible to have the creator column being automatically updated depending on the user.

Would different projects do the trick or is there another way?

Edit: I have a table with ids 1 to 24 on one column, and their corresponding names on the second column but trying to figure out how to use QGIS's apparent new feature to do this

Edit2: there seems to be a 2.18 QGIS bug while working with WFS, sometimes the layers don't want to show up and this happens to several users. If there's any other solution that doesn't involve 2.18 it would be most helpful


Since QGIS 2.18, go to fields in the layer properties, click on the edit widget button for the field you want to configure and set the default value to @user_account_name (or whatever other variable you would like to use).

enter image description here

You can either use one of the pre-defined values extracted from the operating system. Or set a new global variable. Or set a variable on the project.


| improve this answer | |
  • Very interesting, is there anyway to match the previewed Matthias Kuhn to a matching id in another table? Also does that also change the feature once it's editted? Say for example a feature had creator 2, but someone else edits it, would it keep creator 2 or change the creator to the new id? – Luffydude Nov 9 '16 at 15:22
  • You can do whatever you want. The full power of the expression engine is ready for you to be used. (get_feature, attribute, aggregate are just the names of a few that could be interesting for "matching"). At the moment this is only done at "add feature" time. The "update" mode only exists in my head so far ;) – Matthias Kuhn Nov 9 '16 at 15:59

If every person has its own database account that s/he uses to connect to a database, then current_user from system information functions is what you're looking for, together with a INSERT/UPDATE trigger.

If all the people share the same database username, I doubt there's any other way.

| improve this answer | |
  • Only me and 1 other person actually connect to the database, the others (who are not GIS people) just use QGIS with the projects provided by me that have the layers set up to input the data – Luffydude Nov 8 '16 at 14:50

QGIS provides you with two variables user_account_name and user_full_name which you could use to populate your created by column. Depending on how your editing is managed you should be able to set some sort of automatic function to fill it in on edit.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.