1

(9 replies, posted in Programming)

Good point.  My "quest" to find the source originally took me to the manifest and I made the change there.  Then I realized, "that did nothing" and my quest continued.

I'll update the manifest to reflect the changes.  Thanks so much. smile

2

(9 replies, posted in Programming)

I wondered if that would happen, thanks for the heads up!

Since it's just a snippet, I'll replace it when I install another extension.  I don't think it happens enough for me to go "back to the drawing board" on this.

3

(9 replies, posted in Programming)

@Garciat: Thanks so much for taking the time to work through it.  It helped me get on the right track

@Sirena: Perhaps.  Either way I would still have to code in an "if unread messages count > 0" statement which is where the real hang up was.  In other words "If unread message count > 0, use this style, otherwise this style" at least I think(?)

Here's my final solution.

I added a function to the pun_pm functions.php file to return an integer instead of a string.  I did this because I think it's cleaner and less clutter than parsing through a string in order to get a number.  So now I don't have to parse the "New Messages (1)" in order to just grab the integer value (which is all I care about for my if statement)

function pun_pm_unread_messages_integer()
{
    global $forum_db, $forum_user, $forum_config, $lang_pun_pm, $pun_pm_inbox_full;

    list($new_messages, $pun_pm_inbox_full) = pun_pm_read_cache();

    if ($new_messages === false)
    {
        pun_pm_deliver_messages();

        //How much delivered messages do we have?
        $query = array(
            'SELECT'    => 'count(id)',
            'FROM'        => 'pun_pm_messages',
            'WHERE'        => 'receiver_id = '.$forum_user['id'].' AND status = \'delivered\' AND deleted_by_receiver = 0'
        );

        $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);

        list($new_messages) = $forum_db->fetch_row($result);

        pun_pm_write_cache($forum_user['id'], $new_messages, $pun_pm_inbox_full);
    }

    return $new_messages;
}

Secondly, I modified the cache_hooks.php file to do the "if statement" and perform the swap.

        if(pun_pm_unread_messages_integer() > 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="myimage.gif"></a></span>$2\', $visit_elements[\'<!-- forum_visit -->\']);            
            }
        else
            {
                $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 -->\']);    
            }

I realize there are always many ways to solve a problem and this is just one.  I also realize that it's another database query that needs to happen, but performance isn't an issue.  This is for a small forum with maybe 15-20 active posters and only 3-4 online at a time.  It may not be the best or what you think is the best, but I understand it and like it.  Mission accomplished!

Thanks for the input again Garcia/Sirena.

4

(2 replies, posted in PunBB 1.3 extensions)

No luck.  Also tried on two different web browsers.

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

6

(2 replies, posted in PunBB 1.3 extensions)

I'm using the auto install method (repository?)

1) I click hyperlink "install extension"
2) I click the button "install extension"

After turning on the debug mode in config.php, I get the following:

The error occurred on line 94 in E:\websites\Ashentep\forum\admin\extensions.php(176) : eval()'d code

Database reported: ERROR: column "p_pun_poll_enable_read" does not exist LINE 1: SELECT 1 FROM config WHERE conf_name = "p_pun_poll_enable_re... ^ .

Please advise, thanks

Edit: current version is Powered by PunBB 1.3.4, supported by Informer Technologies, Inc