Getting joined data for widget scope

The poster-name widget has access to the entire post as attrs. If you want to attach a new widget within it, you can just pass along attrs and get access to everything.

Custom fields in particular are quite commonly needed in plugin widgets, so you can just access them like `attrs.userCustomFields.

Remember to make sure you whitelist the custom field if you want it accessible in your plugin:

whitelist_staff_user_custom_field('your_field_name')

If you want to see how we use it, the staff notes plugin uses user custom fields and extends widgets.

5 Likes