Bug #1622

"View new posts" should return a friendlier error message when there are no new posts

Added by Dan Dascalescu about 3 years ago. Updated about 3 years ago.

Status:RejectedStart date:06/30/2011
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-
Reproducibility:Always Database Type:
Reported In MyBB Version:1.6.3 Database Version:
PHP Version: SQA assignments:
Browser:

Description

If there are no new posts, clicking "View new posts" will return:

Sorry, but no results were returned using the query information you provided. Please redefine your search terms and try again.

This has confused a number of users.

History

#1 Updated by Tom Moore about 3 years ago

  • Status changed from New to Rejected

The returned language string is the default error message when a user performs a search and returns no results. It's been like this for years and I'm not prepared to tweak the searching functions to change this.

#2 Updated by Dan Dascalescu about 3 years ago

Wow. I was working on a patch. I guess I'd better spent my time elsewhere.

#3 Updated by Matt Rogowski about 3 years ago

We can't make every single change that every single person asks for, that's just not feasible.

#4 Updated by Dan Dascalescu about 3 years ago

Matt Rogowski wrote:

We can't make every single change that every single person asks for, that's just not feasible.

I understand. I actually filed this issue as a placeholder, and perhaps I should've mentioned that I intended to work on it (like with issue #1619).

Would you be open to accepting a patch?

#5 Updated by Tom Moore about 3 years ago

When you call the view new posts action, it adds the query as though you were searching the forums then redirects you to the results page - the same function that every search request goes through. If there are no results, it displays the error message mentioned in your issue. It works like this to stop repeated code.

Unless you either alter the language string if it's the new posts action, or perform the SQL query before redirecting to the results page, there really isn't an 'easy' logical method of doing it. It's a lot of effort for a small change that doesn't impact that many people.

#6 Updated by Dan Dascalescu about 3 years ago

I did it by changing 4 lines of code in search.php (plus adding a new string to search.lang.php):

--- original/search.php 2011-04-18  03:34:24
+++ dandv-fork/search.php 2011-07-01  07:42:30
@@ -273,277 +273,280 @@
             else
             {
+                if($mybb->input['referer'] == "getnew")
+                    error($lang->error_nonewposts);
+                else
-                error($lang->error_nosearchresults);
+                    error($lang->error_nosearchresults);
             }
             $where_conditions = "t.tid IN (".$search['threads'].")";
@@ -1229,1233 +1232,1236 @@
     $plugins->run_hooks("search_do_search_process");
     $db->insert_query("searchlog", $searcharray);
-    redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults);
+    redirect("search.php?referer=getnew&action=results&sid=".$sid, $lang->redirect_searchresults);
 }
 elseif($mybb->input['action'] == "getdaily")

Let me know if it's sane.

#7 Updated by Stefan T. about 3 years ago

How should this work? There is no $mybb->input['referer'].

#8 Updated by Tom Moore about 3 years ago

So you're going for my first option.

And what about Today's Posts? Or maybe searching for threads with a certain prefix? Or in a certain forum? All legitimate searching possibilities that will throw the same error you're desperate to get rid of. This has to change for all these options, not just one of them. That's the effort that isn't worth it.

#9 Updated by Dan Dascalescu about 3 years ago

Stefan T. wrote:

How should this work? There is no $mybb->input['referer'].

The referer parameter is added by the last changed line above, redirect("search.php?referer=getnew&action= ...

Tom Moore wrote:

And what about Today's Posts? Or maybe searching for threads with a certain prefix? Or in a certain forum? All legitimate searching possibilities that will throw the same error you're desperate to get rid of. This has to change for all these options, not just one of them. That's the effort that isn't worth it.

Well, the effort only means changing 4 lines of code per error that you want to make more user-friendly (my target audience is non-technical folks).

What my change does is simply to follow basic error message usability guidelines. MSDN, for instance, advises for errors to be "User-centered. The message describes the problem in terms of target user actions or goals, not in terms of what the code is unhappy with." StackOverflow has an excellent discussion on writing good error messages.

Also available in: Atom PDF