1

Topic: Link to search-result?

I think it's really handy to look at a users last posts, all in one place. I normally do this by searching for a user, but display the results as "posts" not topics. Then you get a list of their posts lined up.
Is it's possible to make a shortcut to this search-result somehow? The "view all posts" in a users profile should be like this, instead of just showing topics.

Is it possible to make the view all posts show posts instead of threads/topics?

Re: Link to search-result?

I've thought about this, but I'm not sure which is preferable. What do other people think?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

3

Re: Link to search-result?

I think if the option in the profile is "view all posts" then thats exactly what it should do though an option to limit the result by number or by date would be useful on a large board.

4

Re: Link to search-result?

Maybe there could be an option in "admin" so each forum-admin can choose which is best suited for his forum?

5

Re: Link to search-result?

Rather than an admin option wouldn't it be easier just to provide two links in the profile ie. "show all posts" and "show all topics".

6

Re: Link to search-result?

"view all topics" is not very usefull in an active forum. In my forum people tend to reply to virtually every topic there is, so clicking the link pretty much lists all topics I have.

It's especially little usefull if the member whose post I want to locate, hasn't posted in a while. Cause the list of topics has no link to that persons post. The list of topics does not single out that members last post, so I have to go through the thread to find his last post anyway.

7

Re: Link to search-result?

But there must be somewhere I can edit the code, surely, to make this small change?

I see the "view all posts" is just a link to search.php
So I reckon if I find the place in the code for this link, it can be changed so that it shows posts instead of topics.

But I can't find it hmm Help anyone?

Re: Link to search-result?

FIND

            // We want to sort things after last post
            $sort_by = 4;

            $search_ids = array();
            while ($row = $db->fetch_row($result))
                $search_ids[] = $row[0];

            $db->free_result($result);

            $show_as = 'topics';

REPLACE WITH

            // We want to sort things after last post
            $sort_by = 4;

            $search_ids = array();
            while ($row = $db->fetch_row($result))
                $search_ids[] = $row[0];

            $db->free_result($result);
            
            if ($action == 'show_user')
                $show_as = 'posts';
            else
                $show_as = 'topics';

Re: Link to search-result?

How so? It doesn't mess it up for me on a clean board...

10

Re: Link to search-result?

Sorry.. my bad..
I edited in Dreamweaver, and it changed some links automatically.

I fixed it and it works great, thanks!

(I deleted my posts, then saw your reply afterwards)

Re: Link to search-result?

OK smile

12

Re: Link to search-result?

hmm.. when I click on the "view all posts" after the edit above, I get a list of posts, not topics.. but it's a bit messed up. It's not limited to the correct user, and the dates are messed up.
Like this: http://www.princefams.com/forum/search. … ;user_id=2
That's the link on my own profile, Endre. But as you see the results are for other users.

I thought it worked fine last nite.. I must be losing my mind.

Re: Link to search-result?

The query doesn't do that for me, although it doesn't fetch all my posts either.
Go play with the query, or I can try when I get home

Re: Link to search-result?

Endre: Are you sure that's a fresh copy of search.php?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Link to search-result?

OK, just remove the GROUP BY statement to make it actually display all the posts.

16

Re: Link to search-result?

Rickard wrote:

Endre: Are you sure that's a fresh copy of search.php?

Yes smile
I even downloaded a fresh copy to make sure.

Smartys wrote:

OK, just remove the GROUP BY statement to make it actually display all the posts.

I don't understand what you mean by this. There is no Group By in the code you edited.

Re: Link to search-result?

No, there isn't. I'm talking about the SQL query for the search we're doing. It's in the code, up from where you were editing before. If you need me to check, I will.

18

Re: Link to search-result?

There are 5 instances of "group by" in the code, one of which is under "search for id-code". But exactly which part should I remove?

19 (edited by Smartys 2005-05-11 01:27)

Re: Link to search-result?

Ugh tongue

I know there's more then one, but I wanted you to look at the context and see where it was. It's rather obvious (this is the edited code)

            // If it's a search for posts by a specific user ID
            else if ($action == 'show_user')
            {
                $result = $db->query('SELECT t.id FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_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) AND p.poster_id='.$user_id.'') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
                $num_hits = $db->num_rows($result);

                if (!$num_hits)
                    message($lang_search['No user posts']);
            }

20 (edited by Endre 2005-05-11 01:30)

Re: Link to search-result?

lol, maybe obvious for you!
I'm not very skilled with this. I can edit some things, but not long queries..

I'll try this and report back

... tried it, and it seems like the exact same results as last time.

Why cant it just ask for the same search as regular search, when searching for user and posts. That gets the exact result we want.

21

Re: Link to search-result?

Is this dead? The suggested modifications didn't work on my forum, has anyone else tried?

Any suggestions?