Topic: Modding punBB, PHP Help

Alright, I'm using punBB and I'm trying to add a small, simple mod. I've added
a column to the users table, which is 'immortal' as a tinyint(1), just like the
other user settings.

1 == immortal
0 == not immortal

Now in viewtopic.php I have this block of code.

                if ($cur_post['immortal'] == 1)
                        $imm = "IMM";
                else
                        $imm = "";


Below it I changed:
$info .= $imm.'<br>'."\n\t\t\t\t\t\t\t".$user_title.'<br>';

to:
$info .= '<br>'."\n\t\t\t\t\t\t\t".$user_title.'<br>';

I thought I had things backwards, as if it would say IMM if the logged in user was, but
even then its not. So what I'm trying to get it to do is display the "IMM" tag next to
the names of anyone who is an imm.

The problem is, even for posts MADE BY users with immortal as 1, it isn't adding the "IMM"

This block of code is in header.php, and it works perfectly.
If ($cur_user['immortal'] == '1')
{
        $tpl_temp .= '<br>Welcome, Immortal!</b>';
}

Any ideaS?

This is what the db looks like:
+----+----------+------------------------------------------+--------------------------+-------+----------+------+------+------+------+-------+----------+------------+-----------+-------------+------------+---------------+-----------+------------------+---------+----------+--------------+----------+-----------------+----------+-------+-----------+--------+------------+------------+------------+-------------+------------+-----------------+--------------+----------+
| id | username | password                                 | email                    | title | realname | url  | icq  | msn  | aim  | yahoo | location | use_avatar | signature | disp_topics | disp_posts | email_setting | save_pass | notify_with_post | smilies | show_img | show_avatars | show_sig | link_to_new_win | timezone | style | num_posts | status | last_post  | registered | last_visit | last_action | admin_note | activate_string | activate_key | immortal |
+----+----------+------------------------------------------+--------------------------+-------+----------+------+------+------+------+-------+----------+------------+-----------+-------------+------------+---------------+-----------+------------------+---------+----------+--------------+----------+-----------------+----------+-------+-----------+--------+------------+------------+------------+-------------+------------+-----------------+--------------+----------+
|  5 | Coredump | secret                                   | tracerah@liquidbrain.net | NULL  | NULL     | NULL | NULL | NULL | NULL | NULL  | NULL     |          0 |           |        NULL |       NULL |             1 |         0 |                0 |       1 |        1 |            1 |        1 |               1 |        0 | Csl   |         3 |      2 | 1090260080 | 1090198606 | 1090258383 |  1090260081 | NULL       | NULL            | NULL         |        1 |
+----+----------+------------------------------------------+--------------------------+-------+----------+------+------+------+------+-------+----------+------------+-----------+-------------+------------+---------------+-----------+------------------+---------+----------+--------------+----------+-----------------+----------+-------+-----------+--------+------------+------------+------------+-------------+------------+-----------------+--------------+----------+

2 (edited by Jansson 2004-07-19 20:25)

Re: Modding punBB, PHP Help

Edit the SQL query to fetch your column.

Line 218:
$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.status, u.registered, u.admin_note, p.id, p.poster, p.poster_id, p.poster_ip, p.poster_email, p.message, p.smilies, p.posted, p.edited, p.edited_by FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id WHERE p.topic_id='.$id.' ORDER BY p.id LIMIT '.$start_from.','.$disp_posts) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());

Replace with:
$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.status, u.registered, u.admin_note, u.immortal, p.id, p.poster, p.poster_id, p.poster_ip, p.poster_email, p.message, p.smilies, p.posted, p.edited, p.edited_by FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id WHERE p.topic_id='.$id.' ORDER BY p.id LIMIT '.$start_from.','.$disp_posts) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());