In using the staff notes plugin for reference, I have tried to make a custom field available to the post-name
widget by doing the following:
In plugin.rb
:
after_initialize do
require_dependency 'user'
whitelist_staff_user_custom_field("myCustomField")
end
In initializer:
import { withPluginApi } from 'discourse/lib/plugin-api';
export default {
name: "alt-topic-initializer",
initialize: function(container) {
withPluginApi('0.2', api => {
api.decorateWidget('poster-name:after', dec => {
console.log(dec.attrs.userCustomFields);
});
});
});
The result of my console.log
is undefined
.
I have tried whitelisting the custom field in Discourse site settings as well.