$cur_topic['last_poster_id'], not $cur_forum['last_poster_id']
Also, in the viewforum query, you want to join the posts table to the topics table, not the forums table.
2,126 2007-10-21 13:15
Re: Making username a link to profile on index (18 replies, posted in General discussion)
2,127 2007-10-21 12:49
Re: Making username a link to profile on index (18 replies, posted in General discussion)
Oh, right, left join in case there is no last post data
I'm not sure why you would have to enable buffering though, unless you're running a query inside that loop (an unmodded PunBB does not)
2,128 2007-10-21 01:24
Re: Making username a link to profile on index (18 replies, posted in General discussion)
Sure
This code is untested but should work
index.php
FIND
$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.redirect_url, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE fp.read_forum IS NULL OR fp.read_forum=1 ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
REPLACE WITH
$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.redirect_url, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster, p.poster_id as last_poster_id FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') INNER JOIN '.$db->prefix.'posts AS p ON (p.id=f.last_post_id) WHERE fp.read_forum IS NULL OR fp.read_forum=1 ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
FIND
$last_post = '<a href="viewtopic.php?pid='.$cur_forum['last_post_id'].'#p'.$cur_forum['last_post_id'].'">'.format_time($cur_forum['last_post']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_forum['last_poster']).'</span>';
REPLACE WITH
$last_post = '<a href="viewtopic.php?pid='.$cur_forum['last_post_id'].'#p'.$cur_forum['last_post_id'].'">'.format_time($cur_forum['last_post']).'</a> <span class="byuser">'.$lang_common['by'].' <a href="profile.php?id='.$cur_forum['last_poster_id'].'">'.pun_htmlspecialchars($cur_forum['last_poster']).'</a></span>';
2,129 2007-10-21 00:43
Re: Admin Problems. (7 replies, posted in PunBB 1.2 troubleshooting)
Closed, since this was indeed a PunBB-Hosting issue
2,130 2007-10-21 00:41
Re: I cannot login after moved forum to another server (39 replies, posted in PunBB 1.2 troubleshooting)
Hmm, I don't see anything wrong with those settings. What browser is the person using?
2,131 2007-10-19 17:29
Re: I cannot login after moved forum to another server (39 replies, posted in PunBB 1.2 troubleshooting)
I would need to see the cookie settings to tell
2,132 2007-10-19 10:43
Re: Quick way to update Topics and Forums with correct numbers of items? (8 replies, posted in PunBB 1.2 troubleshooting)
I don't know that the form email system is working, my email address is smartys at this domain
2,133 2007-10-19 10:43
Re: I cannot login after moved forum to another server (39 replies, posted in PunBB 1.2 troubleshooting)
config.php has the cookie settings
2,134 2007-10-19 10:36
Re: Making username a link to profile on index (18 replies, posted in General discussion)
It's not so easy, since the user ID isn't stored on the table. You would need to join the posts table on last_post_id and get poster_id from that to use.
2,135 2007-10-19 10:34
Re: Quick way to update Topics and Forums with correct numbers of items? (8 replies, posted in PunBB 1.2 troubleshooting)
Link?
2,136 2007-10-19 10:03
Re: I cannot login after moved forum to another server (39 replies, posted in PunBB 1.2 troubleshooting)
Check the cookie settings
2,137 2007-10-19 00:38
Re: An update (124 replies, posted in News)
Guys, this is not an announcement to say "Use 1.3," it isn't done and is not for production use (and we're not accepting bug reports at this point)
2,138 2007-10-18 21:33
Re: Quick way to update Topics and Forums with correct numbers of items? (8 replies, posted in PunBB 1.2 troubleshooting)
For forums there's the update_forum function, for topics I can't think of a function offhand, you would have to check post.php to see what it does.
2,139 2007-10-18 21:31
Re: Problem viewing old topics after host change (9 replies, posted in PunBB 1.2 troubleshooting)
Don't change the code. Is this the query you ran?:
update topics set moved_to=null where moved_to=0
2,140 2007-10-18 18:26
Re: Problem viewing old topics after host change (9 replies, posted in PunBB 1.2 troubleshooting)
Don't do that. Change the database properly instead.
alter table topics change moved_to moved_to int(10) unsigned default null
2,141 2007-10-17 22:53
Re: spambots illustrate problems with punbb data model (4 replies, posted in PunBB 1.2 troubleshooting)
I would argue that PunBB is scalable. My understanding of replication is somewhat limited, but I believe you would have one master, several slaves, make all selects come from the slaves, and all inserts/deletes/updates go to the master. I don't see any case where PunBB makes that difficult.
Deleting all posts/topics by a user: check out it's done when users are deleted by PunBB.
// Should we delete all posts made by this user?
if (isset($_POST['delete_posts']))
{
require PUN_ROOT.'include/search_idx.php';
@set_time_limit(0);
// Find all posts made by this user
$result = $db->query('SELECT p.id, p.topic_id, t.forum_id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id WHERE p.poster_id='.$id) or error('Unable to fetch posts', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
while ($cur_post = $db->fetch_assoc($result))
{
// Determine whether this post is the "topic post" or not
$result2 = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$cur_post['topic_id'].' ORDER BY posted LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
if ($db->result($result2) == $cur_post['id'])
delete_topic($cur_post['topic_id']);
else
delete_post($cur_post['id'], $cur_post['topic_id']);
update_forum($cur_post['forum_id']);
}
}
}
Now, to optimize that a bit more, you can choose to run update_forum for all forums after the loop is done. And in 1.3, the query inside the loop will be unnecessary thanks to the new topics column first_post_id. However, the code is really not that difficult to understand and I think PunBB handles it quite nicely.
2,142 2007-10-17 22:48
Re: An update (124 replies, posted in News)
april may june july... doesnt matter.. rumor are rumors....
Q
Rumors about something that hadn't even happened at that point are false
Think about it, if I spread a rumor that Apple is going to come out with an iPod extreme and two years later they release one, does that make my rumor valid?
.I'm more concerned about the changes 1.3 will bring about. Will it offer some sort of Upgrade package? THAT would be the ONLY concern I have atm.
Oh yes, we always support upgrading to the newest version
2,143 2007-10-17 20:39
Re: An update (124 replies, posted in News)
Smartys wrote:quaker wrote:I first heard about it back in march of 2007 rumor and such..
I guess we will have to wait and see!Q
That's funny, I never heard about it back then.
lmao.... march time frame is that better might have been a month after ... but... around then..
Q
That's still the wrong timeframe: as Rickard said, it was early in the summer
2,144 2007-10-17 17:29
Re: An update (124 replies, posted in News)
I first heard about it back in march of 2007 rumor and such..
I guess we will have to wait and see!Q
That's funny, I never heard about it back then.
2,145 2007-10-17 10:32
Re: spambots illustrate problems with punbb data model (4 replies, posted in PunBB 1.2 troubleshooting)
It is for efficiency, in some cases: the cost of running the query every time the number is needed outweighs the cost of running the query once and storing the number and keeping it up to date.
In terms of user post count, there's also the fact that we don't want it to decrement automatically when a post is deleted.
In terms of poster/poster_id, what happens when Guests post? We need to store their poster name somewhere and the posts table is where we do it.
Now, if you explain a little more clearly what problems you're having with pruning, we might be able to help you
2,146 2007-10-17 02:21
Re: Having Truble.... (6 replies, posted in PunBB 1.2 troubleshooting)
Moved to Troubleshooting
2,147 2007-10-16 22:27
Re: Viewtopic problem (9 replies, posted in PunBB 1.2 troubleshooting)
http://dev.punbb.org/browser/trunk/uplo … parser.php
As opposed to revision 93 from the 1.3 development branch, which is not what you're running and is not anywhere near the newest version.
2,148 2007-10-16 22:08
Re: Viewtopic problem (9 replies, posted in PunBB 1.2 troubleshooting)
Mmm, don't use 1.3 dev's parser, use trunk
2,149 2007-10-16 15:48
Re: An update (124 replies, posted in News)
I have been using Punbb for over 3 years on very small to very large websites. Unlikely to the other comments, this is the worst news I have heard so far.
I'm very sorry to hear that, lets see if I can address some of your concerns.
First, I believe you did not make this announcement public because you knew it would cause a huge reaction from the community, which you thought would not be funded.
We did make the announcement public, that's why you're posting in this topic
As to why we didn't post it before now, Rickard really summed it up
We haven't made a big song and dance about this because we know it doesn't affect the project in any noticeable way. We haven't even bothered to change the copyright notices yet. The only thing that has changed from before is that we, for obvious reasons, no longer accept donations.
So, we don't know the amount of the transaction and probably never will, we don't know how it was divided between the team, and we learn it weekds (monthes?) later, although I consider this to be a very important news.
It isn't all that important though, it's almost a non-story. I'll go with Rickard again:
Now, it's important to understand that with an application released under the GNU General Public License, the ownership of the copyright is pretty irrelevant. The fact that we don't own the copyright anymore doesn't really change anything. It should also be clear that once code is released under the GPL, it remains that way forever i.e. it cannot be made closed source retrospectively. PunBB stays open source and the core development team is the same. There's no evil conspiracy. Think of it as a way for us developers to make a buck while continuing to work on PunBB in the exact same way we did before.
Then, sorry guys, but that company wanted to sell support - why the heck do they need the copyright for this? What I understand is you wanted to make money easily, sold the name, and thought if everything turns wrong, you'd fork it. It is pretty clear to me that they _will_ use that copyright to make money out of punbb. You usually don't buy things you don't want to use. And I don't see anything good there.
They can add PunBB to their portfolio of work. They can develop "official" services using PunBB and make money off of that. They can develop a "premium" version (although to the best of my knowledge there are no plans for anything like that), which if done wrong by them would result in a fork by the development team.
And finally, I am sick of that "if you don't like it, it's GPL, fork it". Punbb is like many other projects, 20% of the people involved do 80% of the code, and the other 80% 20% of the code. The 80% know the 20% can't maintain a fork, so basically they tell them to fuck off.
Except the core development team is the group that writes most of the code and the group that has said it's more than willing to fork. I really don't see what your problem with that is.
So no, I can not be happy with this news, neither the way this was handled, and people who are should seriously think about it again.
Hopefully I've managed to address your issues, if you have any more points feel free to respond