User Profiles Version 1
This is the original tutorial from last May. It has since been replaced by a newer version. See the User Profiles page for details.
Goal: The aim of this tutorial is to walk you through every step you need to create a user profile like this one.
Notes:
- This tutorial assumes Drupal version 5.x
- This does not use the core profile module or the bio module
- The steps assume you want a profile exactly like mine. Most likely you'll want to do different things for your profile. I will try to provide alternates where possible but I'm not going to explore every possible permutation. I'll mark these alternates with [DIY...]
- This tutorial only discusses the one user = one profile page method. You can get much more advanced using multiple nodes and pageroute, but that's beyond the scope of this tutorial.
- You will be told to add things to your template.php file. If your theme doesn't have one, create a blank file in your theme with this name. The snippits are shown surrounded by < ? php and ? > (without the spaces) so the codefilter picks them up. You only need one < ? php at the top of your file and do not need to put them around every snippit.
Modules needed:
- Automatic Nodetitles - Not strictly needed, but it's handy so users don't have to put a title on their profiles and to keep the title consistant. If you don't use this, you'll need to adjust node-uprofile-edit.tpl.php so users can enter a title.
- Buddylist - Allows users to designate other users as their "buddy". We will show a list of buddies on the profile page.
- CCK - We need this to create the content type for nodeprofile to use. Also enable the field type modules that come with it as well as content copy.
- Contemplate - Makes it easier to theme the profile. If you are adept at theming, you can skip this and use .tpl files instead.
- Date - CCK date field used for birthdate. Also needs the adodb date library if you have people born before 1970. Just unzip it into the date directory.
- Guestbook - Allows others to comment on a profile in a bit more organized way than simply enabling comments.
- Link - CCK link field.
- Node Profile (5.x-1.1 or later) - This is what allows us to make profiles out of nodes.
- Node Profile Bonus - This has the code for taking over the user view page as well as fixes for the registration page. The plan is to include this with NodeProfile but is available attached to this tutorial for now. Until it's part of the package, you'll need to manually copy nodeprofile_bonus.module and nodeprofile_bonus.info into your nodeprofile module directory.
- Node Family - Required by Node Profile
- Panels - We will actually only be using the CSS from this because I suck at CSS layout. If you can handle the CSS on your own, you don't actually need this module for this tutorial.
- Private Message - We will check if the user allows private messages and add a link to do it if so. If you don't want private messaging on your site, you can skip this. Be sure to take out the reference in the contemplate code.
- Subform Element - Required by Node Profile
- Token - Used by auotmatic nodetitles
- Usernode - This is used for the buddylist view.
- Views - We will use this for the user's recent posts, the buddy list, and also searching users. Don't forget to enable the views UI module as well.
Step 1 - Getting prepared
- Download and install all the above modules.
- Set the user access control (?q=admin/user/access) for: buddylist, guestbook, privatemsg, user module (access user profiles) like like this.
- Configure buddylist (?q=admin/settings/buddylist) and privatmsg (?q=admin/settings/privatemsg) to taste. See guestbook section below before bothering with config.
- Set usernodes to not be promoted to front page (?q=admin/content/types/usernode)
- Download the file User-Profile-Tutorial.zip attached to this tutorial. This contains as much of my profile as I was able to export to save you time copying and pasting.
Step 2 - Creating and configuring the profile content type
Create the content type (see note at end of "Add the fields" section):
- Go to Administer -> Content Management -> Content Types -> [Add Content Type] (?q=admin/content/types/add)
- Expand "Automatic title generation". Check the box and put in [author-name]. [DIY: You can choose another token or add text if you prefer a different title for profiles.]
- Name: User Profile
- Type: uprofile
- Description: Whatever you want
- Title field label: Leave as title as the user won't see it (unless you've elected to not use auto nodetitles)
- Body field label: Empty this out as we don't need the body
- Default options: Uncheck promoted to front page
- Maximum population: 1
- Check "Use this content type as a nodeprofile for users"
- Comments / attachments / pms: Disable all of these
- Save content type
Add the fields:
- Go to Administer -> Content Management -> Content Types -> [Import] (?q=admin/content/types/import)
- Content type: User Profile
- Paste in the contents of "User-Profile_uprofile-cck-fields.txt" found in the attached zip. Click submit. [DIY - Edit the User Profile content type and manually add all the fields that you want users to enter in their profile.]
- Your content type should now look like screenshots/User-Profile-Content-Type.jpg
Note: The reason I had you create the content type first and then import into it is that there seems to be a bug with groups not getting created when you create the content type at the same time. You can get around this by doing the import twice if you don't want to manually create the type.
Fix the fields display:
- Edit the User Profile content type you just created and click the tab for "Display Fields" (?q=admin/content/types/uprofile/display)
- Change all the aboves for the fields to inlines. This doesn't come across with the importing, unfortunately.
- Submit
Set the nodeprofile options:
- Edit the User Profile content type you just created and click the tab for "Node profile" (?q=admin/content/types/uprofile/nodeprofile)
- Keep unchecked "Integrate this node profile with user categories."
- Check "Show this node profile during user registration." [DIY: Leave unchecked if you don't want it on the reg screen]
- User page display style: Display it as full node view
- Uncheck "Include an edit link to the display"
- Weight: 10 (this makes it come under username/email on the registration page but is unneeded otherwise)
- Submit
Access control:
- Go to Administer > User management > Access control (?q=admin/user/access)
- Set the permissions on "create uprofile content" and "edit own uprofile content".
Step 3 - Avoiding naming collisions
DON'T DO THIS STEP!!! If you've already done it, undo it. It breaks usernode!
To avoid having your usernode and nodeprofiles having the same titles, edit the usernode content type (?q=admin/content/types/usernode) and change the autotitle token to something else. I used "Usernode of [author-name]". The user will never see this, but it's nice to make it clear to admins which is which.
Step 4 - Take over the user account view tab
By default, the nodeprofile module will put your user profile as a section on the user account view tab (located at /user/#). This is fine for simple profiles but doesn't look right for a full featured profile. [See screenshots/User-Account-Default-View.jpg]
This step makes the user profile take over the entire view tab. The downside is that you will lose anything that other modules add to this page. If you add a module that normally has a link on the user view page, make sure you provide alternate access to it. If you are fine with the way it displays by default, you can skip this step.
- Make sure the node_profile_bonus module is enabled. This has code for removing everything that's not a profile from the page and also adds an "Edit Profile" tab to the user account page for easy access.
- If you want to change your Edit tab to Edit Account to make things clearer, you can add the uncommented code into your template.php. If you don't already have this function, add in the commented code as well (uncomment it). Don't forget that you only need one < ? php (without spaces) at the top of the file and not around each snippit.
<?php
//function _phptemplate_variables($hook, $vars) {
// if ($hook == 'page') {
if (arg(0) == 'user') {
$vars['tabs'] = str_replace('Edit</a>', 'Edit Account</a>', $vars['tabs']);
}
// return $vars;
// }
//}
?> - Add this code to your template.php:
<?php
// Override the display of the nodeprofile to just show the node itself and not the surrounding markup or the tabs.
// Theming of the nodeprofile will be handled separately. Note that this affects it wherever it is displayed and
// not only on the user page.
function phptemplate_nodeprofile_display_box($element, $content) {
$head = isset($element['#title']) ? '<h2 class="nodeprofile-title">'. check_plain($element['#title']) .'</h2>' : '';
return $content;
}
// Override the entire user account view page to not show the categories or to seperate items into divs.
// Note that this is set up to still show everything that is thrown on this page. Getting rid of non-nodeprofile
// sections is done in the node_profile_bonus module by unsetting them but could also be done here by conditionally
// printing them to begin with.
function phptemplate_user_profile($account, $fields) {
foreach ($fields as $category => $items) {
foreach ($items as $item) {
$output .= $item['value'] ;
}
}
// Returning nothing from this function causes the entire page to whitescreen, so let's put something in by default
// A better idea might be to load up some sort of standard thing that has the views and just not the profile fields
if (empty($output)) {
$output = "This user has not filled out a user profile.";
}
return $output;
}
?>
Your user account page (?q=user/1) should now look like this: screenshots/User-Account-After-Page-Take-Over.jpg
Step 5 - Taxonomy
My profile uses taxonomy for some of the fields. I did this so you can click on a term and see all the other users with that term. With some coding, the taxonomy is used as though it was a normal CCK field.
Go to Administer > Content management > Categories (?q=admin/content/taxonomy). Create the following vocabularies: Communities, Hobbies, Reading, Music, TV and Movies. Communities is a multi select with the terms entered in via add term. The others are freetagging. Note: If you add these in a different order or choose different vocabularies, you will need to alter the contemplate code and the input form to match.
[DIY - Most people reading this are not going to want preset communities. Feel free to skip that vocab and add it as a normal CCK text field if you want and I'll make notes where you need to delete references to it later.]
Attach each of these vocabularies to your User Profile content type.
Step 6 - Add the views
- Go to Administer > Site building > Views > [Import] (?q=admin/build/views/import)
- Import the contents of User-Profile_User-tracker-view.txt. Submit and save the view. This view will display all the posts by a particular user.
- Import the contents of User-Profile_Buddylist-view.txt. Change the filter for node type to usernode. I don't know why this doesn't import correctly. Submit and save the view. This view will display the photo and name of all the user's buddies from the buddylist module.
- To theme the buddylist view so that we get rid of the list markup, add this to your template.php.
<?php
function phptemplate_views_view_list_buddylist_of_uid($view, $nodes, $type) {
$fields = _views_get_fields();
$taken = array();
// Set up the fields in nicely named chunks.
foreach ($view->field as $id => $field) {
$field_name = $field['field'];
if (isset($taken[$field_name])) {
$field_name = $field['queryname'];
}
$taken[$field_name] = true;
$field_names[$id] = $field_name;
}
// Set up some variables that won't change.
$base_vars = array(
'view' => $view,
'view_type' => $type,
);
foreach ($nodes as $i => $node) {
$vars = $base_vars;
$vars['node'] = $node;
$vars['count'] = $i;
$vars['stripe'] = $i % 2 ? 'even' : 'odd';
foreach ($view->field as $id => $field) {
$name = $field_names[$id];
$vars[$name] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view);
if (isset($field['label'])) {
$vars[$name . '_label'] = $field['label'];
}
}
$items[] = _phptemplate_callback('views-list-buddylist_of_uid', $vars);
}
if ($items) {
//MAC Instead of returning an item list, we just seperate with spaces
//return theme('item_list', $items);
return implode(" ",$items);
}
}
?> - Copy views-list-buddylist_of_uid.tpl.php to your theme directory. This formats the view to just show photo and name with no extra divs. The end result of this, the step above, and the CSS that will be added later is a mini thumbnail gallery of buddies.
A screenshot isn't possible at this point because these additions won't show up on the profile page until you add the contemplate templates.
Step 7 - Add the guestbook
The guestbook has been tweaked quite a bit to work as a commenting system on the profile page. This has made some of the options on the guestbook module non functional:
- Anonymous users are not allowed to add entries.
- Comments are turned off. (Instead, it's been modded so the user can post to his/her own guestbook.)
- The pager is hard coded in the .tpl and ignores the options.
- The add comment form is always on the page and not just linked to.
Directions:
- Copy guestbook.tpl.php to your theme dir. This controls the overall display of the guestbook section
- Copy guestbook-entry.tpl.php to your theme dir. This controls the display of a single guestbook entry
- Copy guestbook-form-entry-form.tpl.php to your theme dir. This controls whether the entry form or a note is displayed
- Add this code to your template.php:
<?php
// These overrides load custom .tpl files to handle the guestbook display as a whole, a single entry display, and the input form
function phptemplate_guestbook($uid, $entries, $comment_entry, $limit = 20) {
return _phptemplate_callback('guestbook', array('uid'=>$uid, 'entries'=>$entries, 'comment_entry' => $comment_entry, 'limit' => 20));
}
function phptemplate_guestbook_entry($uid, $entry, $comment_entry = NULL, $confirm_delete = false) {
return _phptemplate_callback('guestbook-entry', array('uid'=>$uid, 'entry'=>$entry, 'comment_entry' => NULL, 'confirm_delete' => false));
}
function phptemplate_guestbook_form_entry_form($form) {
return _phptemplate_callback('guestbook-form-entry-form', array('form'=>$form));
}
?> - While modifying module code is not recommended, there were a few changes I couldn't find a better way to do. I've put my modified version of guestbook.module into the zip file. You will need to overwrite the stock guestbook.module with this. All my changes are marked with //MAC and commented. If a new version of guestbook comes out, these changes will need to be merged in. That's why modifying modules is a bad idea. If anyone has a better way of doing it, I'd love to hear it. These are the changes:
- Added a separate query so the guestbook on the profile page shows the last 5 entries with newest on top and the regular guestbook page shows them with oldest on top.
- Removed the title from the text area on the add entry form as it was redundant.
- Allowed users to post on their own guestbook
- Changed the link on the poster's name/photo to go to their profile rather than their guestbook.
A screenshot isn't possible at this point because these additions won't show up on the profile page until you add the contemplate templates.
Step 8 - Theming the profile
I use the contemplate module to make theming the CCK nodes easier. If you are proficient in theming, you can use .tpl files instead.
- Go to Administer > Content management > Content templates and click on "Create Template" for User Profile. (?q=admin/content/templates/uprofile)
- Check "Affect teaser output" and paste the contents of User-Profile_Contemplate-teaser.txt into the "Teaser Template" box.
- Check "Affect body output" and paste the contents of User-Profile_Contemplate-full-node.txt into the "Body Template" box.
- If you are not using clean URLs, you will have to adjust the links for the taxonomy terms.
- Correct the path, if needed, in this line right at the top: drupal_add_css("sites/all/modules/panels/layouts/twocol_stacked.css");
- Submit to save the changes.
Your account view page should now look like screenshots/User-Account-Before-CSS.jpg
Get rid of submitted by / time on profile:
Note:You can skip this if you use the provided node-uprofile.tpl.php since it doesn't print the post info.
- Go to Administer > Site building > Themes > Configure > General Settings (?q=admin/build/themes/settings)
- Uncheck "Display post information on" for User Profile
- Save Configuration
Other theming:
- The CSS used for the user profile can be found in User-Profile-CSS.txt. Paste the contents of that file into your theme's .css file and edit to taste.
- Copy the "profile" directory into the "images" directory of your theme. This contains icons used by the contemplate code.
- Copy the node-uprofile.tpl.php to your theme directory for a stripped down node display that just shows the content.
Step 9 - Theme the input form
The default input form you get after adding all the fields and taxonomy to your usernode can be overwhelming, so I moved things around and simplified them. If you want to use my simplified edit form:
- Add node-uprofile-edit.tpl.php to your theme directory.
- Add this code to your template.php to call it:
<?php
function phptemplate_node_form($form) {
if ($form['#node']->type == 'uprofile') {
return _phptemplate_callback('node-uprofile-edit', array('form' => $form));
}
else {
return theme_node_form($form);
}
}
?> - Because the taxonomy terms are given by number instead of name, you may need to adjust this file if the terms don't show up as they should.
- If you opted to not make a term for community, leave out this part:
print "Which community do you live in? If you don't live in the area, you can leave this blank.";
print drupal_render($form['taxonomy']['1']);
Step 10 - Searchable view of profiles
- Go to Administer > Site building > Views > [Import] (?q=admin/build/views/import)
- Import the contents of User-Profile_User-listing-view.txt. Submit and save the view. This view will display a filterable list of all users with profiles.
- If your taxonomy is not set up as Communities, Hobbies, Reading, Music, TV and Movies numbered 1-5, the view will complain. You'll have to edit the view to change the numbers before importing.
Note: - If you want to display all users regardless of whether they have profiles, you will need to get the views_fusion module. There are instructions on drupal.org on how to use it but, honestly, I couldn't figure it out. Since I have the nodeprofile on the registration page, all users will have profiles, so I elected to take the easy way out and just do a view on nodeprofiles.
Step 11 - Known issues
- Admin created accounts don't work right
- After adding / editing nodeprofile, it sends you back to the nodeprofile node, not the user screen
- User listing view sends you to the nodeprofile node
Step 12 - Further plans
- There's a div set aside for the user's gallery. At this point, I haven't added image handling to my site, so I haven't done this section of the profile. It should just be a matter of inserting a view there, though, or perhaps a call to one of the image handling module's display.
- Selectable color scheme. I was thinking it would be nice to have a few different CSS options for users. Not quite on the level of MySpace but maybe allow them to choose from a pre-defined list. This could be done by adding another field to the nodeprofile and a little code to load CSS based on the value.
- Limit viewing to people on buddy list. I'd like to give users the option to hide their profile information from anyone who's not on their buddylist. This would work in conjunction with setting the buddylist option to make people get approval before adding someone as a buddy. I haven't looked into the best way to do this, but it shouldn't be too hard to determine if the logged in user is a buddy and use if tests around the printing of the fields to control the display.
| Attachment | Size |
|---|---|
| User-Profile-Tutorial.zip | 398.68 KB |
| User-Profile_Contemplate-full-node.txt | 8 KB |
Comments
157 comments postedI started this tutorial from scratch as a newb would and have stopped at step 2 because of the following:
Step 1 part 2:
In access control-->node module, there is no create uprofile or edit own uprofile ( yes I have all the needed modules enabled)
Needed for Step 2:
There is no download for your attachment for Node Profile Bonus
Step 1 part 3:
Configure buddylist and privatmsg to taste, umm what does taste mean?
Buddylist requires the invite module which works fine but maybe you should list it since its needed.
Hi there,
Great tutorial. I'm investigating similar options to this and using your tutorials as a template. I am unable to find node_profile_bonus however. This means that I have unwanted tabs on my user profile page right now.
I'm also having an issue where this profile is being created for new users, but is not applying to existing users.
Any suggestions for these items would be greatly appreciated.
Thanks,
Nathan.
The node_profile_bonus is in the zip file attached to the article.
Existing users will need to click on the edit profile tab and that will add the node if it doesn't already exist.
Michelle
uprofile is the name of the content type we're creating. It doesn't exist, yet, in that step.
The download is there. I just didn't have the permissions on this site configured correctly for anon users to view it. Fixed now.
Configure to taste means configure them how you want.
Buddylist does not require the invite module, and this tutorial does not use the buddylist_invite module, so it's not listed.
Michelle
Hi. Great tutorial. I found missing image in Step 8:
Your account view page should now look like >screenshots/User-Account-Before-CSS.jpg<
Hi Michelle
your tutorial is eaxctly what I'm looking for - but I've got stuck at this bit:
"Set the nodeprofile options:"
I can't find the nodeprofile tab on the uprofile content type I just created - have I done something wrong?
Debs
yay - Hi Michelle - I found my own problem - I went back to the start and checked on versions - you wrote "Node Profile (5.x-1.1 or later) - This is what allows us to make profiles out of nodes." - I had an older versions and as soon as I upgraded it worked.
thanks again - this is a great tutorial (especially when I do as you say ;-)
Debs
I took a few notes on paths for each step..
Step 1. #2: ?q=admin/user/access
#3: ?q=admin/settings/buddylist
?q=admin/settings/buddylistautoadd
?q=admin/settings/privatemsg
#4: ?q=admin/content/types/usernode
----------------------------------------------------
Step 2. #1: path(s) provided
#2: "[author-name]" leave out the quotes
Fix the "Field" display #2: "Label" column, ignore "Group" display
Avoiding naming collisions: ?q=admin/content/types/usernode
...so much for this tutorial. As I'm quite new to PHP and Drupal it helped me a lot to accomplish a main requirement of my users. By the way, your Profile has now swept over the Atlantic sea to Germany, as the site I'm building is a german social site. If you wanna see your profile in german, follow that link: http://oppen-haal.de/user/4
Good nite (over here it's 03.10 a.m.)!
Thanks,
I had an older zip from your dev version of this article.
Again, great tutorial.
nathan.
Hi Michelle,
Fantastic tutorial--a real service you've provided here. Quick question: would I add the expanded .zip folder as its own module to install uprofile? If not, how should I go about installing those files in my Drupal site?
Thanks,
Sam
The zip file isn't a module. It's a collection of files used by this tutorial. As you go through the tutorial, it will refer to the files and tell you what to put where.
Michelle
That was an error in copying from the dev site.
Michelle
I added in all the paths. Thanks.
Michelle
Unfortunately, it looks as though you need to be logged in to view it.
I'm curious what people are doing with their profiles, so feel free to add links. :)
Michelle
This is VERY VERY informative and has helped me tremendously. I noticed someone mentioned that they were getting a foreach() error. You mentioned that you weren't sure exactly what it was, but I just figured I'd post since I have the same error. Well, at least a similar one (actually 5).
If anyone has any idea on what might be causing the errors below, I'd be very appreciative.
Once again, GREAT write-up Michelle.
1. warning: Invalid argument supplied for foreach() in /home/styledes/public_html/sites/cincytucky.com/modules/views/views_query.inc on line 81.
2. warning: Invalid argument supplied for foreach() in /home/styledes/public_html/sites/cincytucky.com/modules/views/views_query.inc on line 16.
3. warning: Invalid argument supplied for foreach() in /home/styledes/public_html/sites/cincytucky.com/modules/views/views_query.inc on line 189.
4. warning: Invalid argument supplied for foreach() in /home/styledes/public_html/sites/cincytucky.com/modules/views/modules/views_node.inc on line 777.
5. warning: Invalid argument supplied for foreach() in /home/styledes/public_html/sites/cincytucky.com/modules/views/views_rss.module on line 55.
EDIT: I managed to get rid of number 5. by simply disabling the Views RSS Module. However this worries me, if I ever want to use it.
EDIT 2: After even more research, I have determined that it is not the User Listing or User Tracker Views. Unfortunately I am blocked at work from viewing the actual .inc's to figure out what the problem is. More to come hopefully.
EDIT 3: I've gone through the Contemplate scripts and found a few areas where my vocabularies weren't in the same order as they should have been within the array (not sure if this matters, so i cleaned it up anyway). I fixed that and now have even more errors. However, I think I forgot a step, so tonight I'm going to go through it and hopefully everything will turn out ok.
BTW, sorry for the multiple edits. Just wanted to leave the current progress. I'll clean the post up once I figure out what's going on.
EDIT 4: Okay, so I went back through everything to make sure I had it all right and unfortunately, I did. I was actually hoping I didn't so it would possibly fix the errors. Does anyone have any idea what this could be? I looked at the views_query.inc file but I'm not sure exactly what it is doing or which view it isn't liking. The digging continues!
I've got the views errors, too. Everything works just fine so I thought it was some glitch on my system but now I've seen other people reporting the same thing. If anyone could hunt this down, I'd appreciate it. I'm not sure how much computer time I'm going to have for the next week so it may be a while before I can look at it.
Michelle
one thing that would be very much needed is to make the users searchable. Is this possible with this way of doing things.
and secondly, I am completely unaware of how to code..so will u help out later..if we shift to this way of having user info..and then we need to integrate some info onto it ?
also which modules are we overriding by this method?
can you provide some real life user profile to check? i dont mind registering on ur site..if i can see how things actually look.
thanks
See step #10.
I've been providing support in answering questions in comments as best I can. I can't make any guarantees on my time, but I do my best.
The only module that gets messed with is guestbook. I try to avoid hacking existing code as much as possible but I couldn't find a way to do the guestbook changes with overrides so I did make a few edits there.
There's a screenshot of the finished profile at the top. If you want to see it live, you can play on the test site. I made the screenshot because I can't guarantee that test site will last as long as this tutorial is being used or that I won't totally mess it up testing something else, but it works for now.
Michelle
Hey Michelle, great write up!
I followed all the steps provided, and for whatever reason, my admin profile is showing up on the front page. I tried tinkering around with some settings and couldn't figure it out. Do you happen to know what I did wrong? Thanks!
Go to config content types and edit uprofile and scroll down to the bottom and make sure you don't have promote to front page checked. Do the same for usernode as well just to be sure.
Michelle
These options were already left unchecked...wonder what it could be?
Thanks.
Thanks for the great tutorial :)
I made sure that 'promote to frontpage' was deselected on both node types, as you instructed above. The node was stilling appearing on the frontpage. Then I went to administer->content management->content and selected the node. The 'publish to frontpage' option was checked. When I deselected it and pressed submit, I got the following error:
You mustn't change the title. Change the name of the user and the title is going to be updated.
After trying what you did, it worked for me! I'm not sure of the error you're getting but I'll try to recreate it if possible.
I had the same problem as you describe. I think I solved it.
If you go to administer->content management->content (?q=admin/content/node) and instead of clicking on "edit" for a specific content (a specific user), you select it and choose "Demote from front page" in the drop down above ("Update options") and press update. This worked for me.
I am a little confused: All users have a "User Profile" (?q=admin/content/node), except for user 1 (admin) who only has a "Usernode". And then I have another user that has both a "User Profile" and a "Usernode", whereas all other users only have "User Profile". Could be some problem with users created before I went through the excellent Michelle-tutorial...?
Thanks!
Weird... Are you using automatic nodetitles? That's based on the author of the node so if you change the author I guess maybe you could get that. It's not something I've run into. I guess check that the author is still set to the person the profile belongs to. Other than that, I'm drawing a blank.
Michelle
User profiles (the nodeprofile's content type) are not created automatically like usernodes are. They are created the first time you click on the "Edit profile" tab. If you go the route of putting it on the registration screen, they are created automatically but only as users register. They are not created retroactively for existing users as usernodes are.
Michelle
Well, I've hit step 5 and the errors are all ready occuring. I was trying to track down where it started to take place but forgot to enter any information. After completing step 5 I entered my info and the errors appeared.
Also, as a test, i entered text in every field and still got the errors. Another odd thing is, I added a term to the Communities vocabulary and selected it in my "Edit Profile" tab and then saved it. Well for whatever reason, it didn't save and my Community section still shows up empty on my profile page.
Hopefully this info will be of some help to someone. I'll try and do this again and enter information to try and pin point the exact step that the errors start to occur.
To fix the known issue of "After adding / editing nodeprofile, it sends you back to the nodeprofile node, not the user screen", you can use the Node Go To module.
After enabling the module, goto the administration section for the module (admin/settings/nodegoto) and, under the paths for INSERTING and UPDATING, set the path to "user" for the User Profile node.
That will redirect the user back to their profile page.
Hi Michelle,
Can this same thing be done for Drupal 4.7 or would it require some changes to the codes that you have given here. Plus of course, there is no node_profile_bonus module for 4.7 etc. Its a very nice and lucid tutorial though....its a pity 4.7 version drupallers can't use it :-(.
Hi!
It seems your tutorial is exactly what i'm looking for. But i stuck at step 2 with adding the fields.
My drupal don't have an import funktion at that place. Even when I try to went directly to the link, I don't get what I'm looking for.
[quote]
Add the fields:
1. Go to Administer -> Content Management -> Content Types -> [Import] (?q=admin/content/types/import)
[/quote]
Can you assit whits that? What is missing?
I suspect you missed this step:
CCK - We need this to create the content type for nodeprofile to use. Also enable the field type modules that come with it as well as content copy.
Michelle
To use it on 4.7 you'd have to make sure all the modules used are on 4.7 as well as backporting any features that were added to the 5.x version like with nodeprofile. I also don't know if the theming stuff, etc would work. So I'd say not very possible with out a heck of a lot of work and figuring things out on your part which would make this tutorial pretty useless.
Michelle
Thanks for this. I'll try to take a look at it and incorporate it into the tutorial.
Michelle
Thanks to EclipseGc, I think this is solved. Views wants string arguments. It works fine with numeric arguments but complains. So the views need to be:
print views_build_view('embed', $view, array(strval($profileuser->uid)), false, false);
I'll fix up the contemplate file and re-up the zip when I get a chance.
Michelle
My 'admin' has both a Node Profile and a Usernode. However, all my following 'users', created by 'themselves' (as in not by admin) have Node Profiles, but no Usernodes... This, of course, won't allow their buddies to display on their profile-pages, leaving them in quite a sad state. I created all the 'users' after completing the tutorial, and the Node Profile is a part of the registration... Any ideas?
On another note: Thank you so much for the tutorial, Michelle! I've been very unsure of how to do my profile pages, and this will do the trick perfectly!
-Joeboris
In your Comtemplate code you create URL's for your taxonomy terms using "
Sorry about that...
What I was saying is that your Contemplate code creates URL's manually using the "" tags. In order to support URL aliases and do things the Drupal way, you should replace them with the following:
l($item->name, "taxonomy/term/" . $item->tid)Also, when I click on one of those terms, it takes me to a "Currently no posts found" page. What are the links meant to show?
Bah... Sorry about that... Again...
What I was saying is that your Contemplate code creates URL's manually using the "a href" tags. In order to support URL aliases and do things the Drupal way, you should replace them with the following:
l($item->name, "taxonomy/term/" . $item->tid)
Also, when I click on one of those terms, it takes me to a "Currently no posts found" page. What are the links meant to show?
Looking forward to it...THANKS, to both you and EclipseGirl.
Although, I'm getting the errors before even using the contemplate formatting. Hopefully using it fixes it. Can't wait to find out.
Yeah, my bad on that. I forget to use l sometimes.
Where it takes you is the standard taxonomy listing page. It's the same place you'd get if you showed the tags normally in your node.tpl.php. Weird that you're getting nothing found, though... You should be getting the nodeprofiles of the people with those tags.
Michelle
Usernodes are created automatically and it also retroactively creates them for existing users when you install the module. If your admin account has a usernode then you've obviously installed the module... I looked under access control and there's nothing there for creating usernodes so that's not it. All I can think of is try uninstalling and reinstalling the usernode module. Something went screwy but I can't say what. :(
Michelle
I added the contemplate file as another attachment for now. I need to go through all the comments and fix things that have been suggested and generate a new set of files. But I'm half asleep, so not tonight. :) In the mean time, there's the file that will hopefully fix the views errors for you.
Michelle
Thanks Michelle,
perfect support. Thanks for your quick answer!
Well, at the moment, I'm the only user account with that taxonomy set. Should it display my account on that page along with everyone else's? I believe it should. I'll have to look into it more and find out why it's not showing any profiles.
:)
sorry to bother u more..
in ur post u also mention that the profile page is being overridden..and hence in case some other module is linking into it...we need to do this separately...
wld this be an issue later on..
one more thing...
cld u provide some extra fields to include things we need for our profiles..and where all changes made to it have to be made ...
the other thing i cant understand is where are the settings to make changes to way things are arranged on the page...divisions etc..and how to make changes to the colors of the bars or sizes etc..
thanks
If you don't want to override the profile page, skip that part. It's only an issue if you add a module that puts stuff on the profile page and don't offer any other way to get to it.
I have no way of knowing what extra fields you need for your profiles. This tutorial shows you how to get from point A to point B. If you want to go to point C instead, you'll need to do a little researching to understand what you need to change.
The last bit is all CSS. That's where you need to make your changes.
Michelle
If you are the only user with that term, it should just show you. Basically the idea is that if you click on "Dr Who" in someone's profile you get a listing of all the users who have "Dr Who" in their profile.
It's really just normal taxonomy tags just manipulated a bit to look like part of the tutorial instead of hanging out in the footer.
Michelle
As I mentioned in (your?) post on drupal.org, I just discovered this morning that I've been affected by this as well. I'm going to investigate it during my son's nap in a bit. If anyone else is having this problem, please speak up.
Michelle
I spent 3+ hours tracing through the form submission code today and finally found the problem. Autonodetitles on usernode causes it to silently fail validation. Turning that off fixes it. Which explains why some of my users have usernodes because that was a late addition to the tutorial when I realized I was having a naming conflict with nodeprofile.
I'll take that out of the tutorial again. Not sure what to do about the naming issue. It's not a huge deal as you are allowed to have duplicate titles... it just makes it more confusing remembering which is which.
Michelle