wiki says :
An example of event is ‘render_user_comment_content’. PWG will give in input the raw content of a comment, you can modify it at your will (for example allow bbcode or add smilies) and return the value:
register_event_handler('render_user_comment_content', 'my_function');
function my_function($content)
{
$content = str_replace(':)', '<img src="http://example.com/icon_smile.gif" alt=":)" />', $content);
return $content; //<-- NOTE: this is how you return the value to PWG
}
i search'd in piwigo code, but i can't find where $content is assigned.
later, i found that by a plugin :
add_event_handler('render_element_content', array(&$obj, 'paMOOramics_load'),51,2);
and
add_event_handler('render_element_content', array(&$obj, 'paMOOramics_load'),50,2);
didn't get the same result for $content:
with priority 50 : $content is empty
with priority 51 : $content is "<img src="./galleries/panorama3/autrans.jpg" style="width:3954px;height:600px;" alt="autrans.jpg">"
nb: tested on RC4 without modifications, and 1 active plugin (the one who get $content results)
Last edited by repié38 (2008-11-28 21:13:28)
Offline
It's normal... $content is assigned in picture.php, line 136:
add_event_handler(
'render_element_content',
'default_picture_content',
EVENT_HANDLER_PRIORITY_NEUTRAL,
2
);
If you want to assign your own content, you can use any event priority...
If you want to modify default content, you must use priority > 50
If it's not clear enough... I can explain better in french section ;-)
Last edited by P@t (2008-11-28 21:23:33)
Offline
thanks a lot!
that's clear enough ;)
Offline