Hey all,
Well, after downloading Drupal a couple of weeks ago, I'm CLOSE to putting up my site (thanks to these GREAT forums). I have a question that I can't figure out.
The site is for my old high school class and I'm wondering about username vs real name. It's really much easier to sign in as, say, kathyj, but it would be nice if the name appearing on her blogs would indicate Kathy Smith Johnson (first-maiden-last) so everyone knows who she is. I've managed to add an extra field (Real Name) through administer -> settings -> profiles, but how can I get this to show on the "posted by"?
The obvious way is to make users sign in WITH the real name, but it sure would make it easier if there was a module or hack to accomplish this. I'm using 4.7.6.
Thanks.
Comments
Authorship module?
Would the Authorship Module be suitable for what you want to achieve?
From the module's readme.txt:
I'm sure there's a way to do it using your custom profile field, but this is could be an easily implemented alternative.
You can over ride the theme function username
Printing of the user name is controlled by the theme function theme_username which can be overridden. Add the function below to your themes template.php file. If you do not have a template.php file you will need to create one, make sure it starts with <?php. Replace 'YOUR_PROFILE_FIELD' with the actual field name you used. Note that the users real name will pretty much print anywhere there user name used to print.
Real Name
Thanks for the suggestions.
I decided to go the "theme template" route. It works like a charm!!
Have been looking for the
Have been looking for the same function. Thanks for sharing!!!
Cheers,
Rob
This method does not work
This method does not work for me -- is this the only file I need to edit? Running 5.1.
Can you expand on does not work?
While your only need to edit template.php to add the function you do need to edit the function so it uses your profile field and you need to have defined the profile field.
Thanks for your reply
Thanks for your reply nevets! Here is the content of my template.php file. I've made the neccessary changes -- the field is called profile_fullname.
In each place where it should display the full name, it just shows the username. I've tried the userlist, as well as forums, and they behave the same.
Can you see anything I'm not doing correctly?
Nothing obvious
So I would change (at the beginning of the function)
to add some code to understand what is happening
So if you add the three call to drupal_set_message(), which if any show up when view a node for instance? If the all show up after the call to profile_load_profile you could add
which dump all the fields in object. Do you see the one you expect?
Sorry, I'm new at drupal --
Sorry, I'm new at drupal -- which section of code do I post at the beginning of template.php? If it's easier, just append your code to my original and then I'll have exactly what it should look like.
The new code replaces the first five lines of
The new code replaces the first five lines of the function phptemplate_username().
Error
Now I'm getting this error:
Parse error: syntax error, unexpected T_IF in /home/.kumquat/tzpikes/tzpikes.com/pikeaccess/themes/barron/template.php on line 77
Probably the extra characters
Lines 1 and 3 have an extra character after the semicolan (;), looks a lowercase L (l).
doh!
I wish there was a "delete" option for these posts. After racking my brains, messing around with the code you gave me - I was stumped. I finally checked my user profile (as I'm the only user currently) and looked in the personal info. My "full name" field was blank. So obviously it was defaulting to the username. Once I put my name in there (I swear it was in there already), everything works great.
Sorry -- one of those "doh" moments. Thanks for the help!!
Sorry...dumb
I was just browsing through the node and I tried to add the coding you suggested to use full names instead of usernames. I know you say you have to define the profile field first though. I don't exactly understand what you mean by that..Could you explain how I would do that? Thanks...sorry I'm new to computer programming in general
Navigation block?
Ok, got it working. Thanks! Last question: Is there a way to change the display of the username to the full name on the navigation block? The username still appears in both the navigation block and the profile itself (profile isn't a big deal though, since the real name displays there as well)
A More complete change
I have applied this and it works good for certain places on the site, but not in others. I am using the Blog module, and when viewing blog entry on the front page, the name appears at the top, but not at the bottom... for example, it says:
Submitted by [real name] on [date and time]
just underneath the title, but below the blog post it says:
[username]'s blog
as a link to the user's blogs.
Also, the hover over on the bottom one says Read [username]'s latest blog entries. but that is less important to switch. Any help on how to modify the template above to work for this as well?
Changes to blog.module
Hi Solhan
I don't really recommend this, but you could make changes to the blog module (Beware of problems when you upgrade later!) Can anyone suggest a better way?
This is what I did on 5.1
Open the blog.module in a text editor, and look for occurances of $node->name
replace with:
theme('username', $node, FALSE)I think there are 3 occurances of $node->name in 2 different functions. One (function blog_view) at line 219) deals with the breadcumbs, the other (function blog_link at line 233) with the link beneath the posts and the mousover message.
Finally, you can change the 'username's blog' title by altering the blog_page_user function (line 128) and replacing $account->name (line 134) with
theme('username', $account, FALSE)See how you go, but I'm sure there must be a better way to overide core module functions than this.
Speaking of Overriding Core Modules...
Check out this article on the proper way to do it...
http://www.bryght.com/blog/boris-mann/cleanly-overriding-core-modules-in...
I've implemented this
I've implemented this code... it works fine in many places, except for "Add username to my buddylist", and also inside private messaging.
But what I noticed is that my site slowed down quite a lot. Is it because of this code, or could it be some other module that I've implemented???
In short, my question to those who have implemented this code is: does this code slow down your site???
I have not seen a performance hit
I have not seen a performance hit but if one defines a "large" profile (i.e. lots of profile fields) it is possible that it might slow things down enough to notice. The code will increase page load times since it loads user profiles, the question is will it be enough to notice. You could use the devel module to see sql and page load times and compare performance with and without the theme function.
As for buddylist, private messaging, etc, this approach only works for code that uses the theme function, any code that uses $user->name will show the standard Drupal name,
worked for me
+1. I just added in nevets' patch and it seems to work perfectly. Thanks!
Drupal 6 compatible?
Will this code work ok for Drupal 6?
Thanks!
All opinions are personal and do not represent anyone but myself.
Mass contact real name
I'm using the mass contact module and wondered if I could fill populate the real name in the "name" textbox instead of the username. Here is the relevant code, I think. I've tinkered a bit, substituting profile_fullname in a few places, but it hasn't worked. How can I populate the textbox "name" with the user's full name? I'm using nevets code throughout the rest of the site. I've tried posting a support request on the module's page, but nothing so far - so I thought I'd try my luck here.
One approach is to modify the code
While you could make a module that implements the form_alter hook it would be simplier to modify this line
to
Anonymous
Thanks for the reply, nevets. I tried your suggestion, but it filled in "Anonymous" instead of the name.
Sorry, I answer to quickly
Here is the correct new version of the line
The $user->name should be $user
Excellent! That worked,
Excellent! That worked, thanks nevets! Any ideas about the navigation block comment I posted above?
It comes from the user module
If you look at the block hook in user.module you will find the theme function is not used and so the code will not make a difference here. While one could modify the code to call the 'username' theme function, being part of core it is generally not recommended since it makes updating you site harder.
Thanks
Ok, thanks for clearing it up. You've been a huge help. Thanks again!!
Minor glitch: /admin/user/user no longer displays username
This fix is really cool.
There's one minor glitch though: if you look at the list of users (at /admin/user/user) the column that says "username" no longer shows the username, but rather the Full Name (if it exists). Also, the sorting of the username column is done based on the underlying username, not the Full Name that the user sees.
-mark
Another problem: Full name of newly added users is missing
If you install the above fix and then add a new user, their Full Name does not display because it does not get into the profile_values table.
A quick workaround is Edit their user entry, go to the the Personal Information panel for the user, and hit the Submit button.
A better fix that seems to work is to get the patch from http://drupal.org/node/119114#comment-219903
-mark
setting the user name to not set or anon
Hi,
Just wondering if it's possible to set the user name to anon or something similar if the profile field has not been filled in. I don't want any occurrences of the username on the site at all.
Any help would be great!
Cheers,
Sarah
Yes
Find the comment
// Profile field not set, default to standard behaviourFor only people logged in after the comment add
If you want to include people not logged in it would be
Real name
I think this module does what you want.
http://drupal.org/project/alt_login
i just did a dodgy hack
thanks for your help i just did a dodgy hack and it works ok
Who is Online with full names
Is it perhaps possible that just in the 'Who is Online' to have the full names? I have 2 fields which are profile_name and profile_lname.
That would be absolutely stunning for my site as most members know each other.
Look forward to any reply.
Lilian
This may work
The code you show uses theme_user_list to provide the look of the list. In core this seems to be only used by "Who's Online" and "Who's New". If changing both this list is ok, you could add the following to your themes template.php file
Now looking at comment http://drupal.org/node/122303#comment-204277 take the code there and also add it to your template.php. Change the function name from phptemplate_username to phptemplate_fullname and I think you will have it. You will also need to adapt the code to use your profile fields to get the name information.
Real Name
Thank you Nevets for your response!
Nevets, previously the code below works fine and it shows the first name of the person in 'who is online' and 'who is new'. My profile fields for name and last name are profile_fname and profile_lname.
Maybe I'm missing something here, but sorry, do not have profile_fullname... Is there perhaps a way to include both the fields please?
Thank you so much for any help, most appreciated.
Lilian
Sorry, I'm sure a silly question .. but how do I get notified by email when there is a response on the forum?
I think I am confused
I originally thought you only want the names to show in the block, and that is what my first answer was about. If you have the above already working you should see the full names in the block.
(Me, I just check back every so often)
real name when using node profile and not profile.module
Hi there,
i would like to display the real name of users throughout my site also. But i am not using the profile module, but am creating profiles using nodes and content types.
i have fields set up for first name and last name as 'content_type_first_name' and 'content_type_last_name' which are related to my profile node, which is a child of the parent usernode.
Anyone know how it is possible to override the username with the first name and last name in this case?
sylvie
Something like this should load a node based profile
For loading a node based profile you need to know the have the content type of the node used for the node profile
eek
hiya nevets,
thanks for the code. I would like to replace username throughout my site with the first name and last name. i'm sorry, but i'm one of those annoying novices(!) - would i put the above code in the template.php file? how would i print the specific fields of first name and last name?
thanks!
Goes in the template, replaces part of my original post
Here is the start of the original post
Replace that with this fixed version
blank screen
I am using latest drupal - 5.2
I copied code (the part you just posted and the rest from the top of this post) into template.php, and replaced YOUR_PROFILE_FIELD with field_first_name, and got a blank screen as a response. My first name content is located in my database as "content_field_first_name" (on drupal admin pages it is named field_first_name. This field has been created as part of the content type - "uprofile", which is attached to my usernode with nodeprofile.
I have followed the tutorial at http://shellmultimedia.com/node/274 to make my profile pages.
can u see where i've gone wrong with the use of the code you've given?
thanks
Typo on my part
This line
$sql = "SELECT nid FROM {node} WHERE uid = %d AND type = '%s'");should read$sql = "SELECT nid FROM {node} WHERE uid = %d AND type = '%s'";still no joy...
hey - my user profile is called type - uprofile. hence my code now looks like the following, but still see blank screen, can you spot the error? thankyou!
Missing 'if'
Change
to
Also you should remove the closing
?>as that can cause problems if there are spaces after it.no luck, so tried just with profile module
I still had no luck, so i tried starting all over, with the profile module. and having first and last name as profile fields...but frustratingly even this doesn't work! first name and last name display on my user page. but the username is still displaying everywhere.
here's the code i'm putting in - can't see any fault in it?!
(i have only put the ?> in here so that it displays nicely here)
can anyone please see whats wrong?
terribly sorry - does work
terribly sorry - this does work - now going to try combining profile module with nodeprofile?? - urgh
first name and last name
I would like to have both first name and last name override the username - and have 2 fields -one for each.
here was my guess/attempt (you can see how bad my php is!!):
anyone willing to give a helping hand? thankyou
[ Edit: Added <code> and </code> tags around code: nevets ]
Real close
Here it is with some changes
I placed the 'if' tests inside '(' and ')' and the string concatenation operator is a dot ('.'), the '&&' is for logical ands. I also seperated the first and last name with a space.
Hi again nevets, i've
Hi again nevets,
i've realised that in fact i'm going to have to go back to just using nodeprofile because i need 2 different roles & 2 different registration pages - not sure how to seperate the profile information between the roles with profile module.
Anyhow, I tried your code in my template.php as follows:
and I got the following on my profile page:
warning: htmlspecialchars() expects parameter 1 to be string, array given in /usr/www/htdocs/mysite.com/includes/bootstrap.inc on line 631.
If uprofile is a CCK content type
then
$profile->field_first_name;needs to be$profile->field_first_name[0]['value'];(otherwise you are passing an array to a function that expects a string and hence the error)legend!
nevets you're a legend! thank you ever so much!
my real name is displaying on the tracker list under author- yay!
its not displaying on my buddylist and private message - but i will have a look into these.
Not everything uses the theme function
Some code just displays $user->name directly in which case the theme function has no effect.
ah, i see, so how would i
ah, i see,
so how would i override this in this instance?
sorry - didn't read all of the posts
hey,
sorry - i've just seen that this question has been asked before - i'll have a look at those posts. thanks again for your help!
taking content from fields of 2 types
Hi again nevets,
I have 2 different types of users. I would like to display just first name& last name as the author for a person (as it currently does), but also company name when the author is of the company role. each user has its own content type attached to them - user profile for one and company profile for the other.
so $type = "uprofile" is fine for one role.
how would i adapt the code to also include $type = "cprofile" aswell?
many thanks
figured it out : )
for anyone thats interested - i figured it out - replacing the beginning with:
function phptemplate_username($object, $link = TRUE) {
if ( $object->uid ) {
$user = user_load(array('uid' => $node->uid));
foreach ($user->roles as $rid => $role) {
if ($role == 'Company') {
$type = "cprofile";
} else{$type = "uprofile";
}
}
Small correction
$node->uidshould be$object->uidCorrection: Node profiles cck fields
The above code needs to modified to the following there is an extra closing bracket two lines above
See below for corrected code:
subscribing
subscribing
Reply to taking content from fields of 2 type
(The nesting was getting a little deep)
The following code shows how you might override theme_username and use data from CCK based node profiles selecting the profile to use based on the user role. This is an example and will need to be adapted to your particular setup.
In particular see code after 'Decide which profile to load based on role' comment. You will need to use role id's approriate to your setup and the types passed to phptemplate_loadprofile should reflect the content type you are using for the node profile.
[Edited to fix phptemplate_loadprofile() to add $uid as argument and also fixed calls to same function]
yeah - mine didn't work
hey,
yeah - bit of a dappy moment -my solution didn't work, it used the role type according to the user, not the role of the author!
so, just copying and pasting what you just posted, with only the following changes:
if ( isset($account->roles[3]) ) {
$profile = phptemplate_loadprofile('cprofile');
$name = $profile->field_company_name[0]['value'];
}
else if ( isset($account->roles[4]) ) {
$profile = phptemplate_loadprofile('uprofile');
$name = $profile->field_first_name[0]['value'];
}
As this is how my roles are assigned.
But i just get the usernames, with a couple of "guest users" aswell - quite strange
do i need to use any other code in combination or solely the code you just posted.
thanks!
Lets try this
Right before
add
Does any thing show up for roles?
yes...
yes - each users database content appears twice:
and roles shows up either as
[roles] => Array
(
[2] => authenticated user
[4] => Student
)
or as [roles] => Array
(
[2] => authenticated user
[3] => Company
)
Opps
I forgot to pass the uid to the new function, fixed phptemplate_loadprofile() to add $uid as argument and also fixed calls to same function. I changed the code above to reflect this.
rescued once again!
nevets - my saviour again!
workin a treat - nice one mate.
Hi, just wondering how I
Hi, just wondering how I would make it so that real names would only display on the manage user lists (ie given by the "function theme_user_admin_account"), but everywhere else is unaffected?
What is the path for the page in question?
Given the path for the page you could add a test around the logic that uses real name. Say the path where you want is real names to show is 'user/manage'. You could then add this code around the code that handles real names
another field showing up just in some places
Hi nevets,
really appreciate your previous help with getting first name and last name to show. Now I want another field - university - to show up. But I only want it to show up in some places. I.e. i don't want it to be included in the overrding username function -as it would appear everywhere then. So, i want to add another function - how would i adapt it and then what code would i add to modules in order to implement it?
many thanks
It depends
How/where to you want the university name to show. Should it show as part of the user name but only some of the time? What determines when it is show? Does it only show for nodes for example.
Hi nevets. thanks for
Hi nevets.
thanks for getting back to me.
well - i want it to show most of the time. However, i don't want it to show on things like "sylvia nankivell's buddylist" - for "sylvia nankivell university of southampton's buddylist" doesn't look good. but, for example, i want private messages sent to say from: "sylvia nankivell (university of southampton).
I already have "university" set up as a taxonomy term, and this is displaying on users profile, and "new users" list e.t.c. So, i probably best off figuring out a way of displaying the taxonomy term associated with a student - do you know the best way of doing this?
kind regards
Without a bit of hacking no
Given they are all using the theme function and the theme function does not "know" who called it I do not see a simple (single place) solution that would provide the flexability you want. One could add a parameter to the theme function (lets call it $show_unversity) and set the default using TRUE if you want the information shown most of the time or FALSE if shown here and there. Lets assume you pick TRUE (show most of the time), then everyplace the theme function is used and you do not want the information to display you would need to pass FALSE for your new parameter.
hey, seems like an
hey,
seems like an acceptable method. i would actually choose FALSE and then show it just here and there.
so i would just pass the TRUE parameter in the private message module.
now the only problem i can see would be the fact that the field i want to call is a taxonomy term:
each university has a tid in one table (term_data) of the database. And then a user is associated with this term in another table (term_node). Therefore it would not be as simple as calling a CCK field associated with a user. Is it possible though?
Yes, use taxonomy_get_term()
IIf you are using node profile and CCK the value of the field is probably the tid.
Once you have a tid you can do
to get the terms name.
brilliant to know that it
brilliant to know that it can be done... now just to implement it ! i would have a go at inserting the new parmeter - of $show__university. but i haven't the foggiest where to put that, or the taxonomy term parameter in. (i wouldn't know where to start!)
currently my overriding username function (with your previous legendary help) goes as follows:
How I would approach this
First we change the function declaration so it reads
Note that code that wants $show_university TRUE will need to pass all three parameters, existing code will get a value of FALSE.
Next part is to add the university name to the user name if $show_university is TRUE. This snippet is approximate as you will need to match the node field name to the actual on in your code.
First where to put the new code in
If this only applies to one of the roles pick place the code below at CHOICE 1 or 2 as approriate, if it applies to both roles place at CHOICE 3
This snippet will get the university name if requested and add it to the end of the university name
And the usuall warning, the above code is un-tested and may contain errors :).
field name?
Hi nevets,
// The field used here needs to agree to your actual field name
$tid = $profile->show_university[0]['value'];
sorry - where do i find the field name to place into the code?
i've looked on the database. university is a vocab with vid= 1 and name= university
Oh, in that case, then it's not a CCK field
Oh, in that case, then it's not a CCK field and to print it replace the code inside
if ( $show_university ) {withworks great - thanks a lot
works great - thanks a lot nevets!
at the moment it displays "hockey club (university of southampton)". how would i display it as "university of southampton hockey club"?
One line change
Change
Add real name with user name
I'm trying to add simply add the real name (CCK field) under the user name in some views (like a gallery with fields user picture, user name, and real name). The user picture and user name show up fine, but for some reason it won't show the real name.
Anyone else have this problem, or am I just missing something?
What are you trying?
How are you trying to add the read name to the selected views?
In the fields area
In view edit (http://mydomain.com/admin/build/views/all_users_photo/edit)
In the fields area I have:
Usernode: Name
Usernode: Picture
Text: My Name (field_myname)
I am using no arguments or filters.
I can see two of the fields, but for some reason "Text: My Name (field_myname)" does not show up!
Thanks for the help.
Hi nevets, I am trying to
Hi nevets,
I am trying to change line 362 in the contact.module:
$message[] = "$account->name,";
to be overriden with the new theme function (that you kindly created).
I've tried a few variations on the calling: "theme('username', $account, FALSE),";
but nothing seems to work. In the email it just prints the code.
trying to figure out whether its because of some other reference to $account in the contact.module...?
Did you try this?
Did you try it like this?
yep - thats what i changed
yep - thats what i changed it too, and this gets printed on the email: theme('username', Object, FALSE),
That would only make sense
That would only make sense if you have quotes around
theme('username', $account, FALSE), either that or you have a version of the theme function that returns that.yep - right as always :
yep - right as always : )
quotations were the problem!
ok...so it might to bigger a
ok...so it might to bigger a task, but i want privatemsg module to display club name or person name (i.e. be overridden with function aswell).
how would i change
$result = db_query('SELECT DISTINCT(name) AS name FROM {privatemsg} p, {users} u WHERE p.author = u.uid AND recipient = %d AND p.timestamp > (UNIX_TIMESTAMP(NOW()) - (3600 * 24 * 30)) ORDER BY name', $user->uid);
$contacts = array();
while ($name = db_fetch_object($result)) {
$username = check_plain($name->name);
$contacts[$username] = $username;
}
I tried replacing ($name->name) with (theme('username', $name, FALSE)) to no avail...
Sorry, not much help here
I do not use the privatemsg module so I am unfamilar with how it functions.
I can tell you that $name is not enough to the theme function as you need $name->uid as where as $name->name.
hey sorry i don't understand
hey
sorry i don't understand this sentence "you need $name->uid as where as $name->name." - could you word it differently. thankyou
Me thinks
Me thinks
'SELECT DISTINCT(name) AS name FROMneeds to be'SELECT DISTINCT(name) AS name, p.uid FROMfor the theme function to work.Real name with user name
Anybody have any help with this?
Thanks
with ldap...
Not sure if I should make a new topic or ask here...
I've got a similar problem, but I'm running Drupal 5.3 with LDAP Intagration + Data + Groups.
I set First Name, Last Name, common Name and Mail to readable by user, no other mapping. Now i'd like to show First Name and Last Name in the Block "Who's online" instead of the Common Name. The code above don't work for me... :(
My ldapdata.conf.php
thx for help!
Hey nevets, Thanks again for
Hey nevets,
Thanks again for your input.
I replaced 'SELECT DISTINCT(name) AS name FROM with
'SELECT DISTINCT(name) AS name, p.uid FROM
and the following was returned:
user warning: Unknown column 'p.uid' in 'field list' query: SELECT DISTINCT(name) AS name, p.uid FROM privatemsg p, users u WHERE p.author = u.uid AND recipient = 1 AND p.timestamp > (UNIX_TIMESTAMP(NOW()) - (3600 * 24 * 30)) ORDER BY name in /usr/www/htdocs/mysite.com/includes/database.mysql.inc on line 172.
hopefully you can understand its meaning?
Opps p.uid should be u.uid
Opps p.uid should be u.uid
The error is now: user
The error is now:
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'p, users u WHERE p.author = u.uid AND recipient = 1 AND p.timest query: SELECT DISTINCT(name) AS name, u.uid FROMprivatemsg p, users u WHERE p.author = u.uid AND recipient = 1 AND p.timestamp > (UNIX_TIMESTAMP(NOW()) - (3600 * 24 * 30)) ORDER BY name in /usr/www/htdocs/mysite.com/includes/database.mysql.inc on line 172.
Missing a space after FROM
This part
FROMprivatemsg pneeds a space after the FROM.always the little
always the little things!...
no error messages now, but i get "Guest user" displayed in the dropdown menu of buddies when using theme('username', $name->name, FALSE) as a replacement and "sylv3 (not verified)" -(sylv3 being the username) when i tried theme('username', $name, FALSE).
Also, what would i change ($msg->recipient = db_result(db_query('SELECT name FROM {users} WHERE uid = %d', $arg) to? to make the recipient part of the module display real name.
thanks for your help
Need to change call to theme function
Call to
should be
Not sure that will fix the issue but the parement for user (in this case $name) should be an object with at least a uid and name field.
For the second part if I understand correctly you want to replace
with something like
hmmm - the theme('username',
hmmm - the theme('username', $name. FALSE) doesn't work
and i'm trying to replace: else if ($op == 'msgto' && ($arg = arg(2)) && ($msg->recipient = db_result(db_query('SELECT name FROM {users} WHERE uid = %d', $arg)))) {
$message = $msg;
Did you ever get this to
Did you ever get this to work? I was looking for the same solution.
Get real/display names into Drupal Core!...
It would be great if we could get real/display names into Drupal Core!
So much simpler than all this faffing around.
And much better for security too. As most people don't know or understand the security issues around exposing usernames on a website.
Cheers Daniel
See: #102679: Add a Display Name field to core in addition to Username
Real name in userreference
I was successfully able to use Nevets template.php code to replace my user names with first_name and last_name. Looks great - Thanks!
I need to take it one step further and have my CCK fields that allow for a drop-down list of user names also show first_name, last name. Do i need to hack my CCK module to do this or can it be done through template.php. and if so, does anyone know how to do it?
Full name in CCK type
Hi Nevets,
So sorry, still don't get it. I'm using Node Profile and have the following fields: field_name and field_lastname and the CCK content type is profile.
Please, how do I substitute username for the first and last name? Have added the following to template.php, but no changes ...
Thank you so much for your kind help.
oops, spoke to quickly ...
oops, spoke to quickly ... it works! Yet, just have the first name which I would like to change to: field_name and field_lastname.
Also please
shows no names or username. :)
Look so forward to any reply and thank you.
Lilian
A couple of small changes.
A couple of small changes. to get first and last name change
to
For the second part (user_list) change
to
Nevets!
You are a genius! and I thank you so much for your time. More than beautiful!
Have a great weekend.
Lilian
user reference code
Anyone have the completed code for the CCK reference they could post? I tried to piece it together from the thread but it's not working for me.
template.php
remember to change field_name and $type = "profile" to your content type.
Help test core patch to put real/display names in Drupal core...
Now we have a core patch that needs testing. This will mean that future versions of Drupal will have real/display names built into the system. So, there will be no need in future versions to go hacking code and themes like everyone is having to do now.
If you can spare any time please help future generations by testing the core patch. Let us know what you think. Will it do everything you need it to do?
See: #102679-136: Add a Display Name field to core in addition to Username
Your children will love you for it! ;-)
Cheers Daniel
Coming to Szeged?...
Well, those amazing folks in Szeged have added voting to the BoFs so if you are interested in attending the great Add a Display Name field to core in addition to Username BoF ( ;-) then add your vote and we can get an idea of numbers and get the best fit room size.
Cheers Daniel
subscribing
subscribing
Luis
Display Name Code Sprint Saturday September 5th...
Dave Cohen and I just had a really good face to face discussion with Angie (webchick). In summary, we are going to use the Saturday code sprint to make sure that Drupal 7 will facilitate us building contributed modules to implement display names.
This may mean altering some parts of core in a very small way. If you are passionate about cleaning up "theme_username" throughout core and making it easier for contributed modules to implement display names in a clean and consistent way, then join us at DrupalCon Paris or over the wires.
Saturday September 5th 2009 10:00 to 17:00 CEST
Location: DrupalCon Paris and online elsewhere
If you use IRC then #kendra is ready and waiting for you during those times.
I'll make sure developers are kept well feed and watered. So, if you are at DrupalCon and passionate about making it easy to implement display names then get in touch.
This is pretty much our last chance for making Drupal 7 display name friendly! Let's make it happen!
Cheers Daniel
mobile: +44 7853 627 355
username: dahacouk on skype, jabber, irc...
Kendra Initiative - http://www.kendra.org.uk
How did it go the meeting at
How did it go the meeting at the DrupalCon? Any success for D7? I'm actually trying to do what has been discussed (diplaying the real name for the user instead of the login ID) but I can't find a clear way.
I'm working on D7 right now but still I can't find an easy way to edit this real name.
(It looks like it's been postponed to D8 http://drupal.org/node/102679#comment-3853006 )
What happened for D7...
What we did manage to do in D7 was make the output of the display name be consistent and so make it easy for a contrib module (like realname) re-write what should be displayed. For more details see:
http://drupal.org/node/192056
Cheers Daniel
this works well
http://drupal.org/project/realname
Not really to me on D7:
Not really to me on D7: http://drupal.org/node/1018332