set_prefilter('picture', 'EA_add_to_pic_info'); } // Insert the template for the author display function EA_add_to_pic_info($content, &$smarty) { // Add the information after the author - so before the createdate $search = '/.*?<\/tr>/is'; $replacement = ' {\'Author\'|@translate} {if $EA_INFO_NAME} {if $EA_INFO_URL} {/if} {$EA_INFO_NAME} {if $EA_INFO_URL} {/if} {else} {\'N/A\'|@translate} {/if} '; return preg_replace($search, $replacement, $content); } // Assign values to the variables in the template function EA_add_image_vars_to_template() { global $page, $template; // Show block only on the photo page if ( !empty($page['image_id']) ) { // Get the author name and url that belongs to the current media_item $query = sprintf(' select a.name, a.url FROM %s i, %s a WHERE i.author = a.name AND i.id = %d ;', IMAGES, AUTHORS, $page['image_id']); $result = pwg_query($query); $row = pwg_db_fetch_row($result); $name = ''; $url = ''; if(count($row) > 0) { $name = $row[0]; $url = $row[1]; } // Sending data to the template $template->assign( array( 'EA_INFO_NAME' => $name, 'EA_INFO_URL' => $url ) ); } } ?>