I was wondering if there was a way I could list the newest post made by a user.
For example, I need a way to have the last post a user makes be listed in their post bit. I can't seem to get the last post to show up without requiring a user to click a search link.
As well as adding the expand and collapse feature.
Just do a query for 1 result ordering by timeline.
(2010-03-16, 07:38 PM)Jammerx2 Wrote: [ -> ]Just do a query for 1 result ordering by timeline.
Oh wow, I always over think these things.
I should've done that in the first place. Thanks for your help.
Actually, that's easier said then done, since templates don't allow PHP o.0
How, and better yet, where would I write that query?
(2010-03-17, 05:08 AM)Jammerx2 Wrote: [ -> ]Get this.
http://community.mybboard.net/thread-31860.html
Also this would be the query:
$db->query("SELECT * FROM ".TABLE_PREFIX."posts ORDER BY timeline
DESC LIMIT 0,1");
I just quickly wrote that so tell me if I made any errors.
Well most of it works, but the order isn't working, it's listing the post of each post.
Like if a user posts twice in a thread, the first post will list that post as the latest post made by the user, and the second post will list the second post made by the user.
<?php $query = $db->query("SELECT * FROM mybb_posts WHERE uid='{$post['uid']}' ORDER BY
dateline
DESC LIMIT 1");
$tid = $db->fetch_array($query);
$pid = $db->fetch_array($query);
$subject = $db->fetch_array($query);
$dateline = $db->fetch_array($query);
?>
{$post['dateline']}
<a href="/showthread.php?tid={$post['tid']}&pid={$post['pid']}#pid{$post['pid']}">{$post['subject']}</a><br />
Is what I have, I have the dateline being posted to see if the order was working, which it isn't
(2010-03-17, 04:21 PM)Avarice Wrote: [ -> ] (2010-03-17, 05:08 AM)Jammerx2 Wrote: [ -> ]Get this.
http://community.mybboard.net/thread-31860.html
Also this would be the query:
$db->query("SELECT * FROM ".TABLE_PREFIX."posts ORDER BY timeline
DESC LIMIT 0,1");
I just quickly wrote that so tell me if I made any errors.
Well most of it works, but the order isn't working, it's listing the post of each post.
Like if a user posts twice in a thread, the first post will list that post as the latest post made by the user, and the second post will list the second post made by the user.
<?php $query = $db->query("SELECT * FROM mybb_posts WHERE uid='{$post['uid']}' ORDER BY dateline
DESC LIMIT 1");
$tid = $db->fetch_array($query);
$pid = $db->fetch_array($query);
$subject = $db->fetch_array($query);
$dateline = $db->fetch_array($query);
?>
{$post['dateline']}
<a href="/showthread.php?tid={$post['tid']}&pid={$post['pid']}#pid{$post['pid']}">{$post['subject']}</a><br />
Is what I have, I have the dateline being posted to see if the order was working, which it isn't
Why are the values $dateline, $pid, $tid, etc set if you don't use them? And where is this being displayed?
(2010-03-17, 04:46 PM)Jammerx2 Wrote: [ -> ] (2010-03-17, 04:21 PM)Avarice Wrote: [ -> ] (2010-03-17, 05:08 AM)Jammerx2 Wrote: [ -> ]Get this.
http://community.mybboard.net/thread-31860.html
Also this would be the query:
$db->query("SELECT * FROM ".TABLE_PREFIX."posts ORDER BY timeline
DESC LIMIT 0,1");
I just quickly wrote that so tell me if I made any errors.
Well most of it works, but the order isn't working, it's listing the post of each post.
Like if a user posts twice in a thread, the first post will list that post as the latest post made by the user, and the second post will list the second post made by the user.
<?php $query = $db->query("SELECT * FROM mybb_posts WHERE uid='{$post['uid']}' ORDER BY dateline
DESC LIMIT 1");
$tid = $db->fetch_array($query);
$pid = $db->fetch_array($query);
$subject = $db->fetch_array($query);
$dateline = $db->fetch_array($query);
?>
{$post['dateline']}
<a href="/showthread.php?tid={$post['tid']}&pid={$post['pid']}#pid{$post['pid']}">{$post['subject']}</a><br />
Is what I have, I have the dateline being posted to see if the order was working, which it isn't
Why are the values $dateline, $pid, $tid, etc set if you don't use them? And where is this being displayed?
Better yet, why are you trying to fetch_array on them all when what you want is fetch_field?
(2010-03-17, 04:46 PM)Jammerx2 Wrote: [ -> ] (2010-03-17, 04:21 PM)Avarice Wrote: [ -> ] (2010-03-17, 05:08 AM)Jammerx2 Wrote: [ -> ]Get this.
http://community.mybboard.net/thread-31860.html
Also this would be the query:
$db->query("SELECT * FROM ".TABLE_PREFIX."posts ORDER BY timeline
DESC LIMIT 0,1");
I just quickly wrote that so tell me if I made any errors.
Well most of it works, but the order isn't working, it's listing the post of each post.
Like if a user posts twice in a thread, the first post will list that post as the latest post made by the user, and the second post will list the second post made by the user.
<?php $query = $db->query("SELECT * FROM mybb_posts WHERE uid='{$post['uid']}' ORDER BY dateline
DESC LIMIT 1");
$tid = $db->fetch_array($query);
$pid = $db->fetch_array($query);
$subject = $db->fetch_array($query);
$dateline = $db->fetch_array($query);
?>
{$post['dateline']}
<a href="/showthread.php?tid={$post['tid']}&pid={$post['pid']}#pid{$post['pid']}">{$post['subject']}</a><br />
Is what I have, I have the dateline being posted to see if the order was working, which it isn't
Why are the values $dateline, $pid, $tid, etc set if you don't use them? And where is this being displayed?
They are being used:
<a href="/showthread.php?tid={$post['tid']}&pid={$post['pid']}#pid{$post['pid']}">{$post['subject']}</a>
This is all being displayed in the postbit.
(2010-03-17, 07:03 PM)ralgith Wrote: [ -> ] (2010-03-17, 04:46 PM)Jammerx2 Wrote: [ -> ] (2010-03-17, 04:21 PM)Avarice Wrote: [ -> ] (2010-03-17, 05:08 AM)Jammerx2 Wrote: [ -> ]Get this.
http://community.mybboard.net/thread-31860.html
Also this would be the query:
$db->query("SELECT * FROM ".TABLE_PREFIX."posts ORDER BY timeline
DESC LIMIT 0,1");
I just quickly wrote that so tell me if I made any errors.
Well most of it works, but the order isn't working, it's listing the post of each post.
Like if a user posts twice in a thread, the first post will list that post as the latest post made by the user, and the second post will list the second post made by the user.
<?php $query = $db->query("SELECT * FROM mybb_posts WHERE uid='{$post['uid']}' ORDER BY dateline
DESC LIMIT 1");
$tid = $db->fetch_array($query);
$pid = $db->fetch_array($query);
$subject = $db->fetch_array($query);
$dateline = $db->fetch_array($query);
?>
{$post['dateline']}
<a href="/showthread.php?tid={$post['tid']}&pid={$post['pid']}#pid{$post['pid']}">{$post['subject']}</a><br />
Is what I have, I have the dateline being posted to see if the order was working, which it isn't
Why are the values $dateline, $pid, $tid, etc set if you don't use them? And where is this being displayed?
Better yet, why are you trying to fetch_array on them all when what you want is fetch_field?
Because I have never used fetch_array, or fetch_field, and therefore am not sure which one to use.
(2010-03-17, 09:00 PM)Avarice Wrote: [ -> ] (2010-03-17, 04:46 PM)Jammerx2 Wrote: [ -> ] (2010-03-17, 04:21 PM)Avarice Wrote: [ -> ] (2010-03-17, 05:08 AM)Jammerx2 Wrote: [ -> ]Get this.
http://community.mybboard.net/thread-31860.html
Also this would be the query:
$db->query("SELECT * FROM ".TABLE_PREFIX."posts ORDER BY timeline
DESC LIMIT 0,1");
I just quickly wrote that so tell me if I made any errors.
Well most of it works, but the order isn't working, it's listing the post of each post.
Like if a user posts twice in a thread, the first post will list that post as the latest post made by the user, and the second post will list the second post made by the user.
<?php $query = $db->query("SELECT * FROM mybb_posts WHERE uid='{$post['uid']}' ORDER BY dateline
DESC LIMIT 1");
$tid = $db->fetch_array($query);
$pid = $db->fetch_array($query);
$subject = $db->fetch_array($query);
$dateline = $db->fetch_array($query);
?>
{$post['dateline']}
<a href="/showthread.php?tid={$post['tid']}&pid={$post['pid']}#pid{$post['pid']}">{$post['subject']}</a><br />
Is what I have, I have the dateline being posted to see if the order was working, which it isn't
Why are the values $dateline, $pid, $tid, etc set if you don't use them? And where is this being displayed?
They are being used:
<a href="/showthread.php?tid={$post['tid']}&pid={$post['pid']}#pid{$post['pid']}">{$post['subject']}</a>
This is all being displayed in the postbit.
(2010-03-17, 07:03 PM)ralgith Wrote: [ -> ] (2010-03-17, 04:46 PM)Jammerx2 Wrote: [ -> ] (2010-03-17, 04:21 PM)Avarice Wrote: [ -> ] (2010-03-17, 05:08 AM)Jammerx2 Wrote: [ -> ]Get this.
http://community.mybboard.net/thread-31860.html
Also this would be the query:
$db->query("SELECT * FROM ".TABLE_PREFIX."posts ORDER BY timeline
DESC LIMIT 0,1");
I just quickly wrote that so tell me if I made any errors.
Well most of it works, but the order isn't working, it's listing the post of each post.
Like if a user posts twice in a thread, the first post will list that post as the latest post made by the user, and the second post will list the second post made by the user.
<?php $query = $db->query("SELECT * FROM mybb_posts WHERE uid='{$post['uid']}' ORDER BY dateline
DESC LIMIT 1");
$tid = $db->fetch_array($query);
$pid = $db->fetch_array($query);
$subject = $db->fetch_array($query);
$dateline = $db->fetch_array($query);
?>
{$post['dateline']}
<a href="/showthread.php?tid={$post['tid']}&pid={$post['pid']}#pid{$post['pid']}">{$post['subject']}</a><br />
Is what I have, I have the dateline being posted to see if the order was working, which it isn't
Why are the values $dateline, $pid, $tid, etc set if you don't use them? And where is this being displayed?
Better yet, why are you trying to fetch_array on them all when what you want is fetch_field?
Because I have never used fetch_array, or fetch_field, and therefore am not sure which one to use.
Your not setting them to $post, your setting it to $tid, etc.
What you should do is use $cpost (since $post is set by default, make it different).
Then do $cpost = $query->fetch_array();
Then in your code do $cpost['tid'].
[spoiler]
(2010-03-20, 05:23 PM)Jammerx2 Wrote: [ -> ] (2010-03-17, 09:00 PM)Avarice Wrote: [ -> ] (2010-03-17, 04:46 PM)Jammerx2 Wrote: [ -> ] (2010-03-17, 04:21 PM)Avarice Wrote: [ -> ] (2010-03-17, 05:08 AM)Jammerx2 Wrote: [ -> ]Get this.
http://community.mybboard.net/thread-31860.html
Also this would be the query:
$db->query("SELECT * FROM ".TABLE_PREFIX."posts ORDER BY timeline
DESC LIMIT 0,1");
I just quickly wrote that so tell me if I made any errors.
Well most of it works, but the order isn't working, it's listing the post of each post.
Like if a user posts twice in a thread, the first post will list that post as the latest post made by the user, and the second post will list the second post made by the user.
<?php $query = $db->query("SELECT * FROM mybb_posts WHERE uid='{$post['uid']}' ORDER BY dateline
DESC LIMIT 1");
$tid = $db->fetch_array($query);
$pid = $db->fetch_array($query);
$subject = $db->fetch_array($query);
$dateline = $db->fetch_array($query);
?>
{$post['dateline']}
<a href="/showthread.php?tid={$post['tid']}&pid={$post['pid']}#pid{$post['pid']}">{$post['subject']}</a><br />
Is what I have, I have the dateline being posted to see if the order was working, which it isn't
Why are the values $dateline, $pid, $tid, etc set if you don't use them? And where is this being displayed?
They are being used:
<a href="/showthread.php?tid={$post['tid']}&pid={$post['pid']}#pid{$post['pid']}">{$post['subject']}</a>
This is all being displayed in the postbit.
(2010-03-17, 07:03 PM)ralgith Wrote: [ -> ] (2010-03-17, 04:46 PM)Jammerx2 Wrote: [ -> ] (2010-03-17, 04:21 PM)Avarice Wrote: [ -> ] (2010-03-17, 05:08 AM)Jammerx2 Wrote: [ -> ]Get this.
http://community.mybboard.net/thread-31860.html
Also this would be the query:
$db->query("SELECT * FROM ".TABLE_PREFIX."posts ORDER BY timeline
DESC LIMIT 0,1");
I just quickly wrote that so tell me if I made any errors.
Well most of it works, but the order isn't working, it's listing the post of each post.
Like if a user posts twice in a thread, the first post will list that post as the latest post made by the user, and the second post will list the second post made by the user.
<?php $query = $db->query("SELECT * FROM mybb_posts WHERE uid='{$post['uid']}' ORDER BY dateline
DESC LIMIT 1");
$tid = $db->fetch_array($query);
$pid = $db->fetch_array($query);
$subject = $db->fetch_array($query);
$dateline = $db->fetch_array($query);
?>
{$post['dateline']}
<a href="/showthread.php?tid={$post['tid']}&pid={$post['pid']}#pid{$post['pid']}">{$post['subject']}</a><br />
Is what I have, I have the dateline being posted to see if the order was working, which it isn't
Why are the values $dateline, $pid, $tid, etc set if you don't use them? And where is this being displayed?
Better yet, why are you trying to fetch_array on them all when what you want is fetch_field?
Because I have never used fetch_array, or fetch_field, and therefore am not sure which one to use.
Your not setting them to $post, your setting it to $tid, etc.
What you should do is use $cpost (since $post is set by default, make it different).
Then do $cpost = $query->fetch_array();
Then in your code do $cpost['tid'].
[/spoiler]
That doesn't work, it won't even show the link when I use that.
<?php
$query = $db->query("SELECT * FROM mybb_posts WHERE uid='.$uid.' ORDER BY dateline DESC LIMIT 0,1");
$cpost = $query->fetch_array();
?>
<a href="{$mybb->settings['bburl']}/showthread.php?tid={$cpost['tid']}&pid={$cpost['pid']}#pid{$cpost['pid']}">{$cpost['subject']}</a><br />
I've tried it with, and without the query. Everytime, it either doesn't show a link, or it only gives a link to that specific post.