Topic: Little PHP help please (PunBB related)
Don't shoot me, but I'm a SQL Server, ASP, ASP.Net guy, but like all good programmers, we can quickly adapt to other languages given time.
So I'm trying to edit a bit of the PunBB "pun_pm" extension. After several hours of tracing code back and reading on the forum, I've found that cache_hooks.php is where I want to make my edit. I've also found the exact snippet I want to update, but I can't get it to work yet.
Idea: When a user gets a PM, show a large flashy image or something to actually get attention. I've gone several weeks not noticing the New Message (1) hyperlink. I'm not the only one either. So basically I want to say "when New Message count > 0, show big flashy image, otherwise, business as usual"
Here's the code in cache_hooks.com
$visit_elements[\'<!-- forum_visit -->\'] = preg_replace(\'#(<p id="visit-links" class="options">.*?)(</p>)#\', \'$1 <span><a href="\'.forum_link($forum_url[\'pun_pm_inbox\']).\'">\'.pun_pm_unread_messages().\'</a></span>$2\', $visit_elements[\'<!-- forum_visit -->\']);
Here's what I'm trying to do:
If (pun_pm_unread_messages() > 0)
{
$visit_elements[\'<!-- forum_visit -->\'] = preg_replace(\'#(<p id="visit-links" class="options">.*?)(</p>)#\', \'$1 <span><a href="\'.forum_link($forum_url[\'pun_pm_inbox\']).\'"><img src="http://www.blah.com/mybigflashygif.gif"></a></span>$2\', $visit_elements[\'<!-- forum_visit -->\']);
}
else (same as original)
{
$visit_elements[\'<!-- forum_visit -->\'] = preg_replace(\'#(<p id="visit-links" class="options">.*?)(</p>)#\', \'$1 <span><a href="\'.forum_link($forum_url[\'pun_pm_inbox\']).\'">\'.pun_pm_unread_messages().\'</a></span>$2\', $visit_elements[\'<!-- forum_visit -->\']);
}
Thanks for all help