The created, creator, modified and modifier fields are handled automatically in tiddlywiki. I Imagin they are a function of the editor, but they can also be updated when other tiddlywiki actions modify or create the tiddler.
I would like to reproduce this method to set a created-in wikiname and modified in wikiname and possibly other values. If that value is available in an $:/info or config tiddler.
If any one has some insight as to how to achieve this, please let me know.
If in passing you can explain how when transcluded the created and modified fields receive their formatting that would also help, but is not essential.
Thanks Eric that looks right on target. I suppose I need to redefine those functions in $:/core/modules/wiki.js or is there a way to copy them to a new tiddler before modification so the revised functions override the core functions?
I have found the code and attempted as a script kiddy to make changes, however this is failing;
If anyone can help it would be appreciated.
The following contains what is needed but the resulting wiki fails with;
ReferenceError: assignment to undeclared variable wikicreator
/*
Return a hashmap of the fields that should be set when a tiddler is created
*/
exports.getCreationFields = function() {
if(this.getTiddlerText(TIMESTAMP_DISABLE_TITLE,"").toLowerCase() !== "yes") {
var fields = {
created: new Date()
},
creator = this.getTiddlerText(USER_NAME_TITLE);
wikicreator = this.getTiddlerText(WIKI_NAME_TITLE);
if(creator) {
fields.creator = creator;
fields.creatorwiki = creatorwiki;
}
return fields;
} else {
return {};
}
};
here my only mods were the lines containing wikicreator
Earlier I added the last var in this set;
var widget = require("$:/core/modules/widgets/widget.js");
var USER_NAME_TITLE = "$:/status/UserName",
TIMESTAMP_DISABLE_TITLE = "$:/config/TimestampDisable";
var WIKI_NAME_TITLE = "$:/status/WikiName";
Once I have the correct pattern I will replicate for exports.getModificationFields