[drupal-devel] [bug] Remove message_access function and introduce better worded situation aware messages

killes drupal-devel at drupal.org
Sun Aug 21 22:56:24 UTC 2005


Issue status update for 
http://drupal.org/node/17592
Post a follow up: 
http://drupal.org/project/comments/add/17592

 Project:      Drupal
 Version:      cvs
 Component:    other
 Category:     bug reports
 Priority:     normal
 Assigned to:  killes at www.drop.org
 Reported by:  Hivemindz Magazine
 Updated by:   killes at www.drop.org
-Status:       active
+Status:       patch (code needs review)
 Attachment:   http://drupal.org/files/issues/message-access-1.patch (2.98 KB)

Updated the patch.




killes at www.drop.org



Previous comments:
------------------------------------------------------------------------

Sat, 19 Feb 2005 17:50:27 +0000 : Hivemindz Magazine

Attachment: http://drupal.org/files/issues/common_11.patch (503 bytes)

There should be an effort to externalize all english text into default
variables. It makes a great step towards true internatiolization. Does
not cost anything in terms of performance or matainance. What it does
do is make the code that uses hard coded strings open and more
resuable.  It adds the flexibility in phrasology that is necessary in
internationalizing Drupal. It creates more usability in that better
text instructions can be delivered to the user based on the situation
of the process. I have made this slight change in my install which
allows me to give a descriptive message based on the url tried. This
can be done in both english and swedish without me having to use
gettext and the like.



<?php
--- common_1.inc    2005-02-19 17:33:21.451910400 +0100
+++ common_2.inc    2005-02-19 17:34:40.876116800 +0100
@@ -427,8 +427,8 @@ function object2array($object) {
  * Always consider whether to use drupal_access_denied() instead to
return a
  * proper (and customizable) 403 error.
  */
-function message_access() {
-  return t('You are not authorized to access this page.');
+function message_access($message = 'You are not authorized to access
this page.') {
+  return t($message);
 }
 
*Warning*:  Unterminated comment starting line 13 in
*/home/www/drupal.org/modules/codefilter/codefilter.module* on line
*47*







------------------------------------------------------------------------

Sat, 19 Feb 2005 19:47:12 +0000 : killes at www.drop.org

Attachment: http://drupal.org/files/issues/message-access.patch (2.99 KB)

The original description is a bit unclear, but the underlying concern
seems to be that the error messages are not specific to the situation
they occur in. I share this concern. The attached patch removes the
function message_access() (which hails from 2001) and replaces the six
calls to it by hopefully better chosen strings. Since I do not use
blogapi.module I welcome suggestions for better phrases. Since this is
actually a usability bug fix i hope this can get into 4.6.




------------------------------------------------------------------------

Sat, 19 Feb 2005 23:35:15 +0000 : chx

Attachment: http://drupal.org/files/issues/message-access_0.patch (3.2 KB)

While we are at it, we could open up drupal_access_denied so that the
title can be changed per call. It costs almost nothing, breaks nothing,
so why not?




------------------------------------------------------------------------

Sun, 20 Feb 2005 02:47:37 +0000 : Steven

Can someone point out to me how this is related to i18n, at all?




------------------------------------------------------------------------

Wed, 23 Mar 2005 22:01:17 +0000 : Dries

As discussued, this is not going to work as is.




------------------------------------------------------------------------

Wed, 23 Mar 2005 22:06:48 +0000 : killes at www.drop.org

My patch still applies just fine and I am not aware of any discussion.




------------------------------------------------------------------------

Fri, 08 Apr 2005 16:03:25 +0000 : killes at www.drop.org

Dries said, he will look at it again after 4.6 got released.




------------------------------------------------------------------------

Thu, 05 May 2005 13:18:22 +0000 : stefan nagtegaal

While the patch does not apply anymore, I like the idea very much.. Not
every '404' or '403' error page is the same, and a nice message saying
what is really wrong improves userfriendlyness..


I am all for such a patch.. :-)


Stefan







More information about the drupal-devel mailing list