SimpleMachines/SMF2.1 — pull request #578 by MissAllSunday (2013-08-18 21:57:51+00:00)
Title: Declare vars on specific places in poster list

This is just an idea to let mod authors to add their own data to the poster list area on each message.

It is a simple declared var echoed on very specific locations inside the poster list. Made it to be fillable via integrate_prepare_display_context hook.

The custom HTML var is declared on a per-message basics.

I didn't wrapped any var on any HTML tag on purpose, the idea is to let multiple mods to add their own independent HTML code.

Things to look out for newbie mod authors:

- The data needs to be appended, not assigned. Perhaps a nice note on each comment would help.
- Each mod needs to properly check their resulting HTML before append it, there is no special checking other than a mere !empty() To avoid adding more logic to the template file and make it easier for theme authors to relocate the vars if needed.
- Each mod needs to check for things like $message['member']['is_guest'] and any other "visibility" check.
- Each mod should take care of proper indentation and tabs and append their code with a new line at the beginning. This isn't really mandatory but it would be nice if the resulting HTML still follows the original indentation.

Since this deals with view code, the exact place and even the names can be changed, I just chose some of the most common places mod authors use to add their data.

Suffices to say, this isn't a panacea, it won't cover every specific need out there but will surely help to reduce template edits at least in the most common places.

If going further with the idea, a couple more vars can be declared for before and after the post body itself or other places for things like a ratings mod or something like that.