Current time: 03-22-2010, 02:41 AM Hello There, Guest! (LoginRegister)


 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[F] Find user posts - not displaying new posts (when hitting limit) [R]
04-22-2009, 07:23 AM (This post was last modified: 04-22-2009 08:00 AM by koziolek.)
Post: #1
[F] Find user posts - not displaying new posts (when hitting limit) [R]
MyBB 1.4.5

While searching for user posts (by clicking "Find All Posts") MyBB does not display new posts, only old. Condition: user has more then 'searchhardlimit' posts.

The SELECT query in search.php in block elseif($mybb->input['action'] == "finduser") does not have ORDER BY:
PHP Code:
    $query $db->simple_select("posts""pid""{$where_sql} {$limitsql}");
    while(
$pid $db->fetch_field($query"pid"))
    {
            
$pids .= $comma.$pid;
            
$comma ',';
    } 
So it gets up to 'searchhardlimit' posts in default order. On results page we will have listing of users posts ordered by date descending... but without the newest ones.

The same problem applies to another query while showing the results (block if($mybb->input['action'] == "results")). The query gets real user-visible posts, also with LIMIT and without ORDER BY:
PHP Code:
        // Make sure the posts we're viewing we have permission to view.
        
$query $db->simple_select("posts""pid, tid""pid IN(".$db->escape_string($search['posts']).") AND {$p_unapproved_where} {$limitsql}");
        while(
$post $db->fetch_array($query))
        {
            
$pids[$post['pid']] = $post['tid'];
            
$tids[$post['tid']][$post['pid']] = $post['pid'];
        } 

Solution - get rid of $limitsql or add an "order by" according to user needs. Probably only the first solution is good (remove $limitsql from this query) because user may re-sort search results by date.


Proof of concept of patch - attachment.


Attached File(s)
.diff  mybb-1.4.5-search-limiting-to-old-posts.diff (Size: 1.15 KB / Downloads: 153)

www.kozik.net.pl
- So... Maybe you shouldn't have hacked it.
- And why don't you try not breathing. Hurts, dunnit. (userfriendly.org)
Visit this user's website Find all posts by this user
04-22-2009, 12:56 PM
Post: #2
RE: Find user posts - not displaying new posts (when hitting limit)
Hello,
its also affected on my forum and even in this board i guess.
Is there a way to solve this problem?
Thank you

Visit this user's website Find all posts by this user
04-22-2009, 01:03 PM
Post: #3
RE: Find user posts - not displaying new posts (when hitting limit)
(04-22-2009 12:56 PM)ripper Wrote:  Is there a way to solve this problem?
Yes, attached (in my first post) patch for file search.php works for me.

www.kozik.net.pl
- So... Maybe you shouldn't have hacked it.
- And why don't you try not breathing. Hurts, dunnit. (userfriendly.org)
Visit this user's website Find all posts by this user
04-22-2009, 03:27 PM
Post: #4
RE: Find user posts - not displaying new posts (when hitting limit)
i have change search.php file on the block: elseif($mybb->input['action'] == "finduser" become:

PHP Code:
$query $db->simple_select("posts""pid""{$where_sql}");
    while(
$pid $db->fetch_field($query"pid"))
    {
            
$pids .= $comma.$pid;
            
$comma ',';
    } 

and the block: if($mybb->input['action'] == "results to become
PHP Code:
// Make sure the posts we're viewing we have permission to view.
        
$query $db->simple_select("posts""pid, tid""pid IN(".$db->escape_string($search['posts']).") AND {$p_unapproved_where}");
        while(
$post $db->fetch_array($query))
        {
            
$pids[$post['pid']] = $post['tid'];
            
$tids[$post['tid']][$post['pid']] = $post['pid'];
        } 

and yes you right its working fine now.
is there an official patch to fix this bug?

thank you bro for your advice.

Visit this user's website Find all posts by this user
04-22-2009, 08:51 PM
Post: #5
RE: Find user posts - not displaying new posts (when hitting limit)
I won't be using your exact patch, but I see the problem and will be fixing it soon.

[Image: ryangordon.png]
My Blog - My Mods
Visit this user's website Find all posts by this user
04-25-2009, 05:59 PM
Post: #6
RE: Find user posts - not displaying new posts (when hitting limit)
I tried the solution and didn't worked for me, I did modified the right lines but didn't worked, I used the data on the patch but didn't worked, so for now I put the search.php from the version 1.4.4 instead of the one of version 1.4.5 and that fixed my problem.

at least till an official fix comes around.
Find all posts by this user
05-02-2009, 06:35 PM
Post: #7
RE: Find user posts - not displaying new posts (when hitting limit)
Any updates on an official fix for this?
Visit this user's website Find all posts by this user
05-03-2009, 06:01 AM
Post: #8
RE: Find user posts - not displaying new posts (when hitting limit)
(05-02-2009 06:35 PM)YCMaker Wrote:  Any updates on an official fix for this?

Nope.

[Image: ryangordon.png]
My Blog - My Mods
Visit this user's website Find all posts by this user
05-04-2009, 01:12 PM (This post was last modified: 05-05-2009 09:47 AM by koziolek.)
Post: #9
RE: Find user posts - not displaying new posts (when hitting limit)
Updated unofficial patch for MyBB 1.4.5/1.4.6 - it works for me, but I do not guarantee that it will work for you Smile. Use at your own risk Smile .



Update: fixed in patch errors while sorting by some columns (not existing in mybb_posts table).


Attached File(s)
.diff  610_mybb-1.4.5-search-limiting-to-old-posts.bug.diff (Size: 1.99 KB / Downloads: 127)

www.kozik.net.pl
- So... Maybe you shouldn't have hacked it.
- And why don't you try not breathing. Hurts, dunnit. (userfriendly.org)
Visit this user's website Find all posts by this user
05-05-2009, 07:13 PM
Post: #10
RE: Find user posts - not displaying new posts (when hitting limit)
Marked as reproducible.

[Image: 01686afternoonshadows10.png]
Visit this user's website Find all posts by this user


Forum Jump: