Typo in "Here's the code in cache_hooks.com".
First, I'd check what kind of variable pun_pm_unread_messages() returns.
After reading 'functions.php' inside pun_pm's directory, the function returns a string formatted like so: "New Messages (X)".
So, you should use a regex check for that. Basically,
if(preg_match('/^'.str_replace(array('/','(%d)'), array('\/','\([0-9]*\)'), $lang_pun_pm['New link active']).'$/i', pun_pm_unread_messages()) > 0)
{
/* whatever you want in here */
}
Note: that could possibly not work with languages other than English.
As for the 'flashy image' you want, I'd use some JavaScript instead. Example:
if(confirm('You have one or more unread private messages. Would you like to read them?'))
window.location = '/pun_pm/inbox/'; /* or whatever your relative URL to the inbox is */
All together:
if(preg_match('/^'.str_replace(array('/','(%d)'), array('\/','\([0-9]*\)'), $lang_pun_pm['New link active']).'$/i', pun_pm_unread_messages()) > 0)
{
$visit_elements['<!-- forum_visit -->'] .= "<script type=\"text/javascript\">if(confirm('You have one or more unread private messages. Would you like to read them?'))
window.location = '/pun_pm/inbox/'; /* or whatever your relative URL to the inbox is */</script>";
}
FYI: do that change on Line 458 in 'extensions/pun_pm/manifest.xml'.
Let me know if that doesn't work.
Notes
The $visit_elements['<!-- forum_visit -->'] variable is probably not the best place to add the javascript, but it just seems to work for me. If it doesn't work for you, let met know and I'll find some other variable to put that in.
The alert message shows up as the page is loading. Meaning that the browser will stop loading until the user click Ok/Cancel. To fix this, you'd have to use jQuery or other JS framework that has an 'onload' event to run the alert in.
I just made this "mod" in 3-5 minutes so don't just say it doesn't work. It just needs some polishing.
- Garciat