(I have spent most of the weekend reading about hooks and I do not believe this hook has been requested. I apologize in advance if so and I missed it, long time phpBB user, and done some mods on my own system, but have not done so here yet.)
Name: hook_alter_display_content
Rationale: This lets you change the display text in a message prior to output. You could add a "rel=nofollow" to all outbound links in order to help control link spam and make phpBB less attractive to spammers. You could add tracking for outbound link clicks (e.g. insert an on-click event in Javascript to track via Google Analytics or implement a similar solution in php with redirects, e.g. and outbound like like http://www.example.com/ might be re-written as http://myexamplesite.com/tracking.php?www.example.com/ to do internal tracking). This could be used to re-implement the "smileys" or implement them in a different fashion making it more modular. One could even re-implement the word filter here if that was desirable for some reason. It might also be possible to automatically run the text through one of the online language translation services and return the results in another language (although how good that result would be is unknown). There are a number other uses for being able to alter the message text prior to display, no doubt even more than come to mind immediately.
Placement: in generate_text_for_display() in functions_content.php
probably before/after
$text = smiley_text($text, !($flags & OPTION_FLAG_SMILIES));
Input arguments: 1, Certainly the text of the message to be displayed
Output format:$text the altered text of the message
Output semantics: $text = the revised text of the message
Infrastructure: None.
Related: None of which I am aware.
[RFC|Implemented]hook_alter_display_content
- imkingdavid
- Registered User
- Posts: 1050
- Joined: Thu Jul 30, 2009 12:06 pm
Re: [RFC]hook_alter_display_content
I have implemented two events, one before text is parsed, and one afterwards, within generate_text_for_display().
Here are the changes I made: https://github.com/imkingdavid/phpbb3/c ... de03d6422d
Here are the changes I made: https://github.com/imkingdavid/phpbb3/c ... de03d6422d
- imkingdavid
- Registered User
- Posts: 1050
- Joined: Thu Jul 30, 2009 12:06 pm
Re: [RFC]hook_alter_display_content
This has been merged.