Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I'm not quite sure if this is the correct place, but perhaps you can help.
In version 5.x, to show a little star * next to a specific role in my template.php was the following:
function phptemplate_username($object) {
$user = user_load(array('uid'=>$object->uid));
if (in_array('Platinum Member', $user->roles)) {
return theme_username($object) . '<img src="http://www.mysite.com/star.gif">';
}
return theme_username($object);
}
I've now added the same to the Drupal 6.x template.php, but does not seem to show the little * :)
No errors, and wondering if this should rather be added to the realname.module or is it perhaps in conflict?
Would most appreciate any help to make this work.
Look so forward to any reply,.
Lilian
Comment | File | Size | Author |
---|---|---|---|
#28 | realname-userlevelpic-date.png | 4.86 KB | browlands |
#25 | realnamerole.png | 27 KB | tclusellas |
#20 | screenshot.gif | 20.6 KB | Liliplanet |
#11 | level_list.jpg | 42.33 KB | NancyDru |
#13 | level_edit.JPG | 17.82 KB | NancyDru |
Comments
Comment #1
Liliplanet CreditAttribution: Liliplanet commentedbump * sorry *
Comment #2
NancyDruThe RealName module overrides the theme registry so I don't think "phptemplate_username" would be called. You will need to hack "realname_theme.inc" with your change.
But better yet, perhaps, is that you send me a copy of your star.gif and let's see about perhaps making this a standard feature.
Comment #3
Liliplanet CreditAttribution: Liliplanet commentedThat is tremendous, thank you Nancy ...
Well, the little * star * is small, but defines the privileged members to others :) in my case Platinum Members.
If not the star, perhaps to change username by role to a specific color?
Please find attached the little * star *.
Look so forward and thank you.
Lilian
Comment #4
NancyDruCheck the pics:
Content display
Admin
Comment #5
Liliplanet CreditAttribution: Liliplanet commentedWow Nancy! That looks fantastic! Will this be released with your fabulous RealName.module? Still hoping for a visit from you ..
Comment #6
NancyDruCommitted to 6.x only.
Comment #7
roball CreditAttribution: roball commentedThis is really a cool feature! Just wanted it to try out. As shown on the attached screenshot of the role edit page, I have a "User level image" text field. How must I point to the image there?
Thanks,
rob.
BTW, how did you manage to display the attached images in your post?
Comment #8
NancyDruYou specify a path (I am updating the description) relative to your current files path. The image will be shown when you theme the username, unless the specific theme call turns it off (it is on by default).
Comment #9
Liliplanet CreditAttribution: Liliplanet commentedHi Nancy! Thank you so much for this wonderful feature ..
Nancy, I've just downloaded latest (10 March) and adding 'star.gif' to 'user level image' field, but it does not seem to save.
I've uploaded the star.gif to sites/default/files ..
Look forward to hearing from you, and again thank you.
Lilian
Comment #10
roball CreditAttribution: roball commentedSame problem here. I just updated the RealName Module to 6.x-1.x-dev (2009-Mar-10), went to admin/user/roles/edit/3 and specified role_pics/3.png at the "User level image" field. After clicking "Save role", realname_user_level_3 => 'role_pics/3.png' appeared in the info box, but no image has been displayed in the "User level" column. Going to admin/user/roles/edit/3 again showed the "User level image" field to be empty.
Comment #11
NancyDruMy file directory is "files/d6" and that is where my images are.
As you can see mine are saving. Can you check the HTML output, please?
Note this is not an upload; the images must be there first.
Comment #12
NancyDruComment #13
NancyDrutrying again
Comment #14
roball CreditAttribution: roball commentedYes, I have manually created the "role_pics" directory under the directory stated on the field's description (sites/default/files) via SFTP and uploaded the "3.png" file there, so its path is sites/default/files/role_pics/3.png. I can also successful view this image directly by calling its URL in my browser. I am using the default (Garland) theme for this test, if this should make any difference.
Comment #15
NancyDruI don't recall having to clear the cache, but have you tried that? And can you view the HTML source to see what it is producing?
Comment #16
roball CreditAttribution: roball commentedAfter clearing the cache (via the "Development" block from the "devel" module), I tried again what I've described in reply #10, with the same result (no image). The HTML code of the row in question is:
Comment #17
Liliplanet CreditAttribution: Liliplanet commentedHi Nancy,
Sorry, I still seem to be having the same problem.
I select 'edit role', add 'sites/default/files/role_pics/star.gif' (role_pics created as a folder), but it firstly does not save the field or show the image ..
empty cache and html as follows:
<tr class="even"><td>Platinum Member</td><td></td><td><a href="/admin/user/roles/edit/4">edit role</a></td><td><a href="/admin/user/permissions/4">edit permissions</a></td> </tr>
Could it perhaps be something with my theme that is causing this?
Look forward to your reply, and thank you.
Lilian
Comment #18
NancyDruBased on what roball reported, I am not surprised that you are still seeing it. Clearly, the image tag is not being built.
Well, I was going to have you do lots debugging, but I see the problem. I had the save code commented. Don't ask me why.
Go to function _realname_role_submit and uncomment line 528 (variable_set).
Comment #19
NancyDruI committed that fix.
Comment #20
Liliplanet CreditAttribution: Liliplanet commentedHi Nancy,
Wow, that's beautiful! Makes such a difference .. Thank you so much!
Attached image :)
Comment #21
NancyDruFabulous, thanks for sharing.
Comment #22
roball CreditAttribution: roball commentedI can also confirm that this nice bonus feature of RealName now works well. It seems that the current dev branch is now mature enough to get rolled out as a new release - what do you think, Nancy?
Comment #23
NancyDruI'd like to have a bit of testing on #392636: Real Name integration with core Search Module / users.
Comment #24
NancyDruComment #25
tclusellas CreditAttribution: tclusellas commentedHi Nancy,
First of all, thank you for your fantastic module and support that you provide.
This module is exactly what I was looking for to add to my forums.
I'm trying to have an image displayed for roles, unfortunately I can't get it to work properly.
I followed your above instructions without success.
I can see a question mark next to the role (see photo) but not the image.
I checked permissions to 777 but still nothing.
Neither can I see the image in my browser (mysite.sites/default/files/admin.jpg) I get page not found.
I'm using d6.13 and RealName 6.x-1.x-dev.
Do I need to change the:
" function _realname_role_submit and uncomment line 528 (variable_set)."
I couldn't find where it is.
It must be something simple, but after two days trying, I decided to ask for help.
Look forward to your reply, thank you.
Tomas
Comment #26
tclusellas CreditAttribution: tclusellas commentedDismiss the above post,
After cleaning every possible cache.
I can report that is finally working well for me.
Thank you again.
Tomas
Comment #27
browlands CreditAttribution: browlands commentedWould be nice to have an additional feature to describe the real username, user level picture and date output without hacking the code.
From an immediate standpoint can anyone help me modify the realname_theme.inc file (presumably) to show ...
user level image | realname | date
rather than
realname | user level image | date string
at present. I'd be very pleased if someone could provide a patch or some code below.
For the additional feature I suggest some additional settings as follows: -
[order] [prefix] [level image] [suffix] [hide check]
[order] [prefix] [real name] [suffix] [hide check]
[order] [prefix] [submitted] [suffix] [hide check] [php date format]
where ...
order is a dropdown 1-3, to allow the variables to be displayed in various sequences
prefix is any user configurable string or null
suffix is any user configurable string or null
hide check removes that particular element from displaying
php date format allows for various date formating options.
This would give bountiful options on theming the output without having to resort to a hack.
Comment #28
browlands CreditAttribution: browlands commentedCheck current picture, user level | realname | date would be more visually appealing.