Hi,
Realname module allows users to show a display name instead of their loginname.
But it works only if other module use theme(''username,...) func instead of author name, as suggested here -->
http://drupal.org/node/268510#comment-1218624 .
Is it possible to change that ?

Thank u in advance

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

digemall’s picture

Version: 6.x-1.1-beta » 6.x-1.x-dev
Magnus’s picture

Assigned: Unassigned » Magnus
Status: Active » Needs review
FileSize
807 bytes

I also want this function and found a solution. Here is a simple patch that works for me.

Zen’s picture

Status: Needs review » Closed (won't fix)

The latest dev should have an overrideable theme_quote which you can use to get this done.

Cheers,
-K

digemall’s picture

Thx to zen for the info (and seals for the code) ;)

JuliaKM’s picture

Status: Closed (won't fix) » Needs review
FileSize
858 bytes

I ran into the same problem. The following patch does the same thing as #2 but paste the name without a hyperlink to the user's page. This is consistent with how quote module works for usernames.

While I could use theme_quote to do this, if this small change is made, then everyone that uses the realname module can automatically have the username turned into the real user name. This would be quite convenient compared to having to write a theme function. RealName is a rather popular module, so there are lots of people who would benefit from this change.

Also, it's my understanding that it's best practice to display usernames using a theme function. For an example, look at this issue.

Magnus’s picture

This patch works really good, thanks!

Magnus’s picture

Status: Needs review » Reviewed & tested by the community
jpshayes’s picture

Applied patch in #5 to 6.x-1.1-beta2 version of quote. Working Great.

Thank you

digemall’s picture

Status: Reviewed & tested by the community » Needs work

Could someone make a patch (I'm not able to do so) looking at the code posted here (by realname creator) --> http://drupal.org/node/268510#comment-2453638 ?

It is very similar to the #5 patch, but with some changes...

I think it should be committed in the quote code if the author agrees ...

digemall’s picture

FileSize
2.57 KB

I did through a module.

It is called RealName Extension (because I'm going to include other realname-related features in future) but essentially it overrides quote theme, changing author by theming it with theme('username',...).

Usage:
- Enable RealName Extension module.
- Go to site/admin/user/realname-ext and check "Override author username in quote"

Hope to be helpful.

EDIT:
show #15 comment for a fixed version (this one has a bug)

Einkahumor’s picture

Hi. #5 seems to work quite nicely for comment quotes but not for node quotes. If I click the Quote link on a story post on my sandbox site I get [quote=MyUserName]Quoted node material.[/quote] but if I click the quote link on a comment I get [quote=MyRealName]Quoted comment material.[/quote].

This is a big problem for me because I'm trying to use the Quote module (with patch at http://drupal.org/node/496910#comment-2564416) with the 6.x-2.x Node Comments module and essentially all quoted material is taken from nodes and nome from traditional Drupal comments.

I wish I knew how to fix this myself but I'm not all that great with code. Anyone?

Einkahumor’s picture

For clarification: On my sandbox site I tested the quote module with patch in #5 on regular comments without the Node Comments module installed with the same result so the problem is definitely not with the Node Comments module or with the patch (http://drupal.org/node/496910#comment-2564416) I mentioned earlier.

digemall’s picture

Probably because the #5 patch doesn't consider the "elseif" part as done here --> http://drupal.org/node/268510#comment-2453638

Anyway, if you want to override the quote username (in node and comment) without patching anything,
you could also consider to try my simple module (comment #10 )...

Einkahumor’s picture

The module in #10 did not work for me.

On admin/user/realname-ext/general I get: warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'realname_admin_settings' was given in /includes/form.inc on line 372.

On admin/user/realname-ext I get no errors or warnings but if I check "OVERRIDE AUTHOR USERNAME IN QUOTE" and click "Save configuration" I get:
Fatal error: Call to undefined function dpm() in /sites/all/modules/realname_ext/realname_ext.admin.inc on line 80

What I would really love is a Patch from that comment you referred to (http://drupal.org/node/268510#comment-2453638) because I'm not all that good with code and I'm not sure how to proceed with the information in that comment.

digemall’s picture

FileSize
2.38 KB

Sorry, my mistake...
Now I've fixed and tested it on a clear installation of drupal 6.15 (I've attached the fixed archive here).

About the patch, I asked in #9 comment if someone could roll a patch cause I'm not able to... but no answer...

Anyway, working with my very simple module, I found a partially-OT suggestion for the author of quote module.

IMHO when we quote a comment or a node, the quote module should write [quote=author_id] instead of [quote=author_login_name], or at least give an option to do it,
because I think it would be more flexible.

Imagine, for example, that a user with login_name "smith" has been quoted.
The quoted tag (saved on the db) will be [quote=smith]...[/quote], and when saved it will show the text "smith wrote: ...".
Mr. smith is an admin and decides to change his login to "blacksmith".
Now the old quoted text still show (wrongly) "smith wrote: ..." instead of the correct "blacksmith wrote: ..."

Saving the author_id in the quote tag would prevent this problem, and passing it to the overridable theme function, would open/facilitate some theming opportunities.
For example:
- we can override quote_theme with realname without making a query to search user_id from user_name (like I do in my simple module)
- if we want to show only RealNames (and don't patch quote module to obtain it), we can hide usernames to the quoting users, only theming
- we can theme quotes with a link to the user more easily
- etc...

Sorry for the partial-OT, but I think it would be interesting allow this option (and would facilitate RealName too)

(and sorry for my poor english :P )

Einkahumor’s picture

Thanks for the module, it works. A couple of observations though:

1) When I saved the settings with override for quote module on the realname extension page I got a message that said "Theme registry rebuilded" but should have said "The theme registry has been rebuilt".

2) I noticed that when you quote someone, you get [quote=username]quote material[/quote] but when the comment is saved and viewed it says RealName wrote "quote material". I think it should work in a way that it would print [quote=Real Name]quote material[/quote] and the viewed comments should be Real Name wrote "quoted material". The purpose of RealName (as I see it) is to not show usernames to the public (and logged in users) but to use the real names of users on posts, comments, profiles and paths. That way if a user changes his/her username it would be for his/her preference but the public wouldn't really ever notice. A user should not change his/her Real Name unless one gets married or otherwise actually has his/her real-world-name changed.

I see that your module doesn't really change the way quotes are handled upon comment submission but rather the way quotes are displayed upon comment/node view so (2) is not really a part of your module but I thought I'd add my two cents. Maybe the method you mentioned, using [quote=uid] would be technically best and most flexible but for the end user it would be least confusing and most consistent to use [quote=Real Name].

digemall’s picture

About your observations:

1) Obviously I made a mistake with english translation (I'm from italy, probably the worst english speaking people in the world... nah just kidding... actually I am... :P )
Please change the line #69 in file realname_ext.admin.inc
from:
drupal_set_message(t('Theme registry rebuilded.'));
to:
drupal_set_message(t('The theme registry has been rebuilt'));

2) Yes, my module modifies only the way quotes are displayed (overriding theme), because unfortunately that's the only way to change quote without patching it.
So necessarily you cannot hide username from [quote=username], and that is one of the reasons I proposed to put userid (or at least give an option to do it)

What you said about users confusion with [quote=uid] is reasonable, but I have 2 points:
a) When a user click quote button, why should he be more confused by seeing [quote=uid] than by seeing [quote=username/realname] ?
IMHO basically there are 2 kinds of people:
- those who click buttons and don't care what happened --> they won't be confused by a [quote=uid] tag
- and those who click button and try understand how it works, because they want to avoid clicking button next time --> they're skilled enough to understand how it works, and thus they won't be confused by that (on the contrary, probably they will be positively stimulated by that :P)

b) If a user want write a quote by hand, writing [quote=RealName] he will get "RealName wrote: ..." in any case;
actually, if quote tag argument is not found among usernames in DB, it is simply written in the quote without modify it...

Anyway, since it's impossible that all agree, probably I will have to write my own quote module to get my desired features... :P

Einkahumor’s picture

1) That's not really a problem of course so I don't think I'll bother changing it. Just thought I'd point it out ;-)

2)
a) I didn't mean to say that [quote=uid] was worse than [quote=username], I meant that [quote=Real Name] would be more consistent and less confusing for users than the other two. I say that because I (and a lot of people, I think) use RealName so that I don't have to display usernames and uids on pages, posts, comments, profiles, paths or whatever.

b) I know that writing manual quotes is easy and really not a problem.

Im not saying this is a huge problem. What I mean is that given a choice, I would choose not to display usernames or uid anywhere on my sites except for necessary administrative purposes. That is the reason I use RealName ;-)

Anyway, if you decide to go ahead and write your own quote-ish module, I'd love to help out. I'm not that much help with the code but I have some ideas and opinions I could share if you think it would help.

Thanks again for the RealName Extension module, it solves 96.4% of the problem for me ;-)

digemall’s picture

FileSize
4.43 KB

OK, I've found a way to change the author before it is inserted in the quote tag.

It's a little tricky:
basically, the quote module alters comment-form inserting [quote=author]quoted_text[/quote] in the textarea.
My module, alters this form after the quote module and change author.

Now in administration menu (admininster -> user management -> realname extension)
after enabling "Change author username in quote", new settings will appear.

You can select 3 types of [quote=parameter] tag altering, that are:
1) set parameter= user name (it leaves the quote behaviour unchanged)
2) set parameter= user id (my desired feature)
3) set parameter= themed plain user name (i.e. realname, your desired feature)

And you can select whether to theme the parameter when displaying the comment or not:
- if you leave parameter=username, you must choose this option to get the realname
- if you set parameter=userid you need to check this option (unless you want your quote looks like "34 wrote: ..." )
- if you set parameter=realname checking this option is totally useless

Please, if you have installed my previous realname_ext module, disable it, then unistall it (do not delete, unistall it previously !).
Then copy (or overwrite) the new one and enable it.

I've tested it on a clean installation, but if you have some trouble, please report to me. :)

Einkahumor’s picture

Hi! I finally got around to checking your update out, sorry for not doing so sooner. It works wonderfully with standard comments but not with nodecomments and appropriately patched quote module. When using this method it always inserts [quote=Username] to the textarea, no matter what settings are set.

digemall’s picture

Nodecomment... I've never thought to manage that module (because I almost ignored it before your post, not because I dislike it)...

I've looked at the patch, and it's really interesting what it seems able to do (selection quoting, multiquoting...)

It could be very interesting add those options in my module.

I will give a try, and return a feedback asap :)

Einkahumor’s picture

I think you should start a project for your realname-ext module so we can discuss it there. I'd also love to hear more about other ideas you have about that module. I could probably help (and lots of other people of course) with feature development for that module.

Thanks again for all your work!

A bit about that nodecomment quote patch: It doesn't do selection quoting yet, but that's an awesome feature that I hope they'll support soon. It's still a good patch.

And even more off-topic: I think nodecomments are a great idea. I personally don't really like the idea of trying to create a Drupal-based forum that's almost exactly like PHPBB (drubb) because I think that with Drupal and CCK and NodeComment you can create far better forums that are much more user-friendly (especially in wysiwyg and attachment handling) than PHPBB. I think supporting BBCode is a little like supporting Internet Explorer; we may have to support it because a lot of people use it but we don't have to like it and we don't have to encourage people to use it.

digemall’s picture

Sorry, at the moment I'm really busy for job, and I cannot work on that...

I agree with you... probably I should create a new project for my module, but I also think that it would be better if reasonable changes in modules (like using themed usernames) were done in the module itself.

Quote module could very very simply support realname, and in a generic (I mean not "RealName-oriented") manner.

For nodecomment it's the same: either nodecomment or quote modules could support each other without big efforts.

In my opinion, that would avoid an useless modules proliferation....

P.S.
I have excluded patches from my considerations, because they're really unhandy in term of usability and mantainability (in particular when modules are often updated with relevant changes...)

Einkahumor’s picture

No worries, the [quote=Username]-displayed-as-Realname-Wrote method provided by your module will do for now, until a better solution is found. And by the way I totally understand and agree. I don't really get why Zen seem not to want to use theme('username',...) (as seen in #3) in the Quote Module, it seems like a win-win solution, although I'm no code ninja and I don't know if there are performance problems or something like that with the theme('username,...) approach.

locomo’s picture

subscribe

Magnus’s picture

Status: Needs work » Needs review
FileSize
1.08 KB

A new attemt to get the usernames themed. The patch comes from code from manager of RealName module -> http://drupal.org/node/268510#comment-2453638

Magnus’s picture

Status: Needs review » Reviewed & tested by the community

The patch in #26 is really simple and is basicly the same as http://drupal.org/node/364871#comment-2474986 and http://drupal.org/node/268510#comment-2453638 have used. Thats why i mark this as RTBC.

Zen’s picture

Status: Reviewed & tested by the community » Needs work

Hello Magnus,

I'm not terribly taken with the idea of injecting the rendered output of theme_username into the textarea as per the RTBC'd patch. It defeats the very purpose of the function.

If something like this needs to be done, it will either involve user_load calls in the filter process stage, or alternatively, require a variant of [quote] which links to the comment's CID. The latter has the added advantage of allowing us to link to the quote's origin, besides enabling us to load the comment to retrieve the UID we are looking for.

-K

Matt V.’s picture

The patch in #26 fixed the issue for me. Thanks!

Zen’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

If #911952: Link to quoted post goes in, this can be resolved cleanly.

-K

Elin Yordanov’s picture

Assigned: Magnus » Elin Yordanov
Issue summary: View changes
Status: Needs work » Needs review
FileSize
1.09 KB

I've created a patch for 7.x-1.x version. Please review.

Thanks.

proweb.ua’s picture

Thanks, #31 works

  • Zen committed a511185 on 7.x-1.x
    Issue #364871 by pc-wurm, Zen: Make Quote compatible with modules such...
Zen’s picture

Status: Needs review » Fixed

Committed slightly modified patch. Thanks guys.

-K

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.