PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

How to change "display_name" to Username?

s2Member Plugin. A Membership plugin for WordPress®.

How to change "display_name" to Username?

Postby ProCody_Rookie_coding » April 19th, 2011, 2:48 pm

Hey there,

I am looking for any way to edit the code on the file that makes the display name
point to the "first name" given by the user when they register on my s2member site.

I need to change the display name to the username, and I would also like to display some
information from a custom field, where the users info is displayed in the comment area
as well the new username instead of the first name.


My Goal:

When a user logs into my site, have their username displayed on there comments
not their fist name, along with information from a drop-down
"custom field" ( in this case the college the user goes to).

Much thanks! :D

-Cody
User avatar
ProCody_Rookie_coding
Registered User
Registered User
 
Posts: 4
Joined: April 19, 2011

Re: How to change "display_name" to Username?

Postby Cristián Lávaque » April 19th, 2011, 4:47 pm

Hi Cody. :)

You will need to edit your theme templates where you want to change/add these things.

s2Member provides a way to use their profile data and is documented here WP Admin -> s2Member -> API / Scripting -> s2Member PHP/API Constants.

I hope that helps.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: How to change "display_name" to Username?

Postby ProCody_Rookie_coding » April 19th, 2011, 8:42 pm

Hey Cristián,

Thanks for the response!!

I understand what I need to do, and I have the code for the username the person
gives at registration:

S2MEMBER_CURRENT_USER_LOGIN
This will always be a (string) containing the current User's Username. Empty if not logged in.

<?php echo S2MEMBER_CURRENT_USER_LOGIN; ?>


--I'm pretty new to the wordpress world and I was hoping you could point me in the direction
of the theme templates i would need to edit? maybe where this code is to be placed exactly...
Sorry for the rookie quesiton. :oops:

-Cody
User avatar
ProCody_Rookie_coding
Registered User
Registered User
 
Posts: 4
Joined: April 19, 2011

Re: How to change "display_name" to Username?

Postby Cristián Lávaque » April 19th, 2011, 10:18 pm

No problem. :)

Well, the template you need to edit will depend on where you want to make that change in your website. I suggest that you take a look at the files that are inside your theme's directory and you should be able to find the right place.

If that's something you don't feel you can do yet, I'd try getting a freelance developer help you customize it. viewforum.php?f=37
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: No registered users and 1 guest

cron