Using the Custom Profile Data Tag
by Ryan Irelan
If you’ve ever built an ExpressionEngine site with significant membership capabilities, you may have run into the less-than-ideal situation that is the Member Profile Templates.
For the uninitiated, Member Profile Templates in EE are not the same as normal templates that you create and organize into template groups. Member Templates do not parse standard EE tags and they can be difficult to style to match the rest of your website.
In most cases I bypass the Member Templates completely and use the User Module from Solspace. The module allows you to implement all of the membership functionality in your regular EE templates. The User Module isn’t free and I’m sure at $90 some people probably think twice about picking it up.
(To me it’s worth every dollar plus some just because of the hours it saves me during implementation.)
However, for very simple member implementations where you only need to view member profile data, EE does give you a very handy tag without the need to purchase an extra module. The tag is called the Custom Profile Data tag and it allows you to display member profile data in your normal EE templates.
Here’s an example showing the total entries for the logged-in user.
{exp:member:custom_profile_data}
{total_entries}
{/exp:member:custom_profile_data}
In a recent project this tag came in handy when I needed to display information on the page based on a custom member field.
Let’s say you are building a social networking website for professional boxers. This is where boxers go to interact with their community. You probably know that in boxing boxers are broken up into weight classes. So, in their member profile, each user has to specify to which weight class they belong. We want to use that weight class to determine what type of content is displayed on the page; featherweight boxers would see different content than heavyweight boxers.
To do this we create a custom field called weight_class and list out all of the possible classes and then use the value of the custom field to determine which content is displayed on the page.
{exp:member:custom_profile_data}
{if weight_class == 'Lightweight'}
[display lightweight content here]
{if:elseif weight_class == 'Heavyweight'}
[display heavyweight content here]
{/if}
{/exp:member:custom_profile_data}
The custom_profile_data tag will by default display the profile fields for the currently logged-in user. You can also specify which member’s data you want to show using the member_id parameter. If you are using the custom_profile_data tag in a template, you should disable Template Caching for that template. Not doing so may have some unintended consequences.
Read the documentation for the entire list of variables that are available inside the custom_profile_data tag.
Post to Twitter
Post to Delicious

noushad moidunny — 19:31 on 02.11.2009
There is no doubt that EE is a very good CMS, especially for designers. Sadly even after you pay for CMS, you need to shell out more money for modules that extend EE (eg. User Module from Solospace). This is the only reason people like me staying away from it, and embracing open source options. (drupal). And best of all, you don’t need to wait for months to know what’s going to happen to your favorite CMS and worry about whether it’s pricing would be affordable to you.
Ryan, I would like to know your thoughts on this.
Ryan Irelan — 10:32 on 02.13.2009
Noushad, I think if those are your concerns that EE probably isn’t right for you.
There are definite trade-offs when you use commercial software, but I think the advantages are greater: dedicated support staff, dedicated development staff to add new features, fix bugs—and most importantly—keep the software secure. Buying the software keeps those people employed and working full-time on the software. That’s what I want if me and my clients are going to invest in the software. I want to know they have a business model and will be around in 5 years and will continue issuing any needed security updates.
As far as having to buy add-ons to supplement ExpressionEngine’s native functionality, I think it’s actually a good thing. I don’t want a CMS that does _everything_. Sure, EE should probably have better member template management that doesn’t require a $90 module. But it doesn’t and the development community surrounding EE was inventive enough to recognize that missing piece and write the code to fix it. This happens a lot and it’s more of a testament to EE’s flexibility and extensibility than it is to any missing features.
Dan — 10:44 on 02.13.2009
If you are a professional, Expression Engine’s price tag is a pittance and my clients have never balked at it. If you are working for a non-profit or on a personal project, the price is even cheaper, or free.
If you are a FOSS ideologue, then I understand why you’d prefer a free/free CMS. But that doesn’t take away from those of us who prefer EE from a practical standpoint. I do prefer the commercial model in this case, because Ellis Labs is shockingly responsive to tech support requests. They pay excellent technicians to take care of me, their customer. If I post on a Drupal board, no one is obligated to support me, ever. This makes a difference to me.
I will probably learn Drupal at some point, because I’ve heard great things about it. But I think it’s important for web devs to acknowledge that commercial and FOSS don’t take away from each other and there is room in the market for both.
Eric — 10:47 on 02.13.2009
I used to balk at the price of EE, but I got over it. If the site is for a client, $250-$500 extra really shouldn’t matter; if it does, you need to find new clients. If it’s a personal site, you can use Core, which is free. If it’s for your own business, the expense is a write-off.
As Ryan says, I’ll happily pay for dedicated (friendly) support, continued development, and security. Plus, the dev community around EE is amazing and 90%+ of EE add-ons are free. The ones you pay for really extend the core functionality of the software or make it that much easier to work with. The time you save with EE and the add-ons more than makes up for the price, imho.
Chad Crowell — 10:54 on 02.13.2009
Both excellent arguments. As an EE CMS developer I may be biased here, but not even Drupal can have every piece of functionality you want for every site. The question becomes: how hard is it to find well-built add-on functionality when you need it.
I share an office with a crew of Joomla devs. They fight with dozens of add-ons that all do the same thing trying to find one that works reliably and has the features they need. I hear it every week. They spend, probably, an entire day of work trying to find the right add-on. That is about $1000 of my billable time. I pay my $90 and move on with programming because I know what to expect from the User add-on from Solspace. I don’t have that kind of time to give up wondering if I found the right solution.
EE’s flexibility allows people like Solspace to create functionality that helps us all. If they decide to charge for their add-ons, that is certainly their prerogative. I know Mitchell at Solspace and he and his code is top shelf- you get everything you pay for.
We may have different client sets, but the bulk of my estimates for clients fall in the $8000 - $20000 range. I build the cost of EE and any modules I anticipate needing into the estimate, which usually results in a software cost of $500 or less. If a client has a problem with that, for all we get in service, support and community with EE, they are not my client.
Taking that a little further… I always say that the hosting environment for a client isn’t something they should worry - or even care - about. Hosting should fulfill the needs of the software that the site is being built with and it should be up to the developer to make the decision as to what host will serve the client’s website needs the best (with exceptions of course).
I see recommending EE the same way. “What do you want your website to do for you?”. Once I know the true answers to that question, I can determine if EE is right for them. Sometimes it is not. Usually, due to its flexibility, and the ability to rely on solid add-ons, and building my own add-ons when required, EE can handle anything I throw at it. And that is worth worlds more than $249 in my book. If you are staying away due to that, perhaps you should look at your choices from another angle.
I am not saying I am right and you are wrong, there are thousands of ways to build a site. Just sharing why EE is usually a no brainer for my business decisions.
John Faulds — 20:57 on 02.13.2009
I reckon the money I spend on EE is less than the money I’d have to spend on hair replacement after constantly battling CSS inheritance issues in Drupal’s theming system.
Rob — 05:16 on 02.14.2009
Despite the current limitations with displaying member related information, Solspaces User module is a quick and easy to implement solution. Job done.
Spending a relatively small sum on a quality addon is far cheaper than faffing around with several addons trying to find one that works.
noushad moidunny — 18:11 on 02.14.2009
Hi everyone, thanks for all your comments.
First of all, let me make it clear that I didn’t want to offend any of EE fans here or promote drupal in an EE blog. I was just curious, why people go for a commercial software when they have something good for free? I got your justifications
noushad
florida web design — 08:14 on 04.09.2009
@EEINSIDER, do you know when they’re releasing the new version of EE that’s built completely on CodeIgniter?
Chuck — 17:16 on 10.14.2009
@noushad, for me - my time IS $$. I’ve developed almost 7 large drupal sites now, dozens & dozens of WP & other sites, etc, and am relatively new to EE (finishing 2nd site).
The KEY is how long it takes to finish a project (doing it the right way, of course). For me, at 70/hr, all it takes is 5 extra hours wasted to start asking myself why I didn’t use EE.
If I have a site that can be built with either DRUPAL or EE - it’ll probably take 1.5 times longer with drupal, in my experience.