I understand, after talking to several members here, that I have to use CCK and Views to really customize a user profile the way I want and I have been reading up on how to use both. While that sounds simple enough it is slow going for me. There are no clear cut guides for what I want to do; most Views tutorials focus on tasks like creating an archive of previous blogs. While this will certainly be useful for my site once it has numerous blogs, at the moment it isn't particularly helpful to me trying to adapt a "how to make an archive view" into usable instructions on what I need to do which is customize a page to look differently than it currently does.
There is a fundamental difference to the way the two work. The tutorials for creating archive type lists/lists and tables, etc are for creating page types that do not exist out of the box. I need to modify pages that exist out of the box. I figure the best way to figure this out is to dive in with a simple modification of an existing page and go from there. Since CCK and the Bio Module will be required to do the profile modifications, I thought I'd try to do something a little easier as a start.
What I tried unsuccessfully to do and what I could use help with is using Views to change the way the member list is viewed. Currently, it is somewhat unformatted. I have made the members list page viewable by anon viewers in case anyone wants to go check out the current layout and/or help. View the current layout at http://www.tapbjj.com/profile.
What I need help with is:
Now, to help me understand this better, what would be done differently if I wanted to add a small search function at the top of the members list that would allow you to sort members by their name? Is there a way to allow searchers to pull up profiles by the month/year they were created? My suspicion is that these features that should be implemented on another page all together rather than in the view I am trying to create to simply format the way the standard member list page is displayed. Am I correct in this assumption?
Typically, I see custom tpl.phps in the form that indicates the type of node using the override. In this case, using what I usually see as formats, the custom tpl.php would be node-profile.tpl.php however, if I chose that as the name, what would I do when I start applying things to the actual individual user's profile pages? would this tpl.php automatically apply this view to those pages as well?
Outside of the naming questions, the node-whatever.tpl.php should include divs to break up the content (at least this is my understanding). For this I would create div classes for each area such as "Personal Information" and "User Picture" as div classes and then specify their styles in style.css, is this accurate? Should stylings for a view such as what I am describing have predefined div sizes, such as 200px etc or would best practices dictate that I use a percentage such as 50%? Is Drupal smart enough to constrain the information that is supposed to go into those divs into whatever proportions I choose?
Lastly, do I need to input code into the template.php to alert my theme to use this new view when the page, in this case www.drupalinstallation/profile, is called? What is the code I put in? Do I need a separate entry in template.php for each and every view that I want to apply?
I fully understand if anyone who has actually taken the time to read this lengthy post (that clearly defines what a total Drupal noob I am) doesn't have time to answer everything, or even anything, but I would truly appreciate the help from anyone who does have the time. If there are good explanations already posted any links would be greatly appreciated (and would save you the time of typing out 'remedial Drupal' lessons to me :P ).
I got into some trouble earlier in this 'journey' when I found some old posts on how to make profile changes using pure template.php overrides, style.css, and node-xxx.tpl.php overrides, and after spending a lot of time, I was informed that those posts were more or less outdated methods and that I should be using views to gain this effect. For this reason it is now hard for me to tell if the post I am reading is even a practice currently used, outdated/depreciated, or should be considered a "best practice". This is why I posted this long dissertation here, hoping for a little explanation from users familiar with views etc, and the possibility that I will get pointed in the right direction and successfully avoid finding outdated methods and learning 'bad habits' before I realize they are wrong.
Thanks again for taking the time to read this and sorry it was soooooo long.
Comments
Here is what I have muttled
Here is what I have muttled through (though it isn't working...go figure). It half worked and can be seen at http://www.tapbjj.com/profile. Basically, it lists admin numerous times (30+) and does not include many of the users
Created a custom view for the memberlist:
Page:
name:memberlist_view
selected provide as page view
url: profile
view type: table view
Block:
none
Fields:
Profile: Real Name
Profile: Gender
Profile: City
Profile: State
Profile: About Me
User: Author Picture
Arguments:
none
Filters:
none
Exposed Filters:
none
Sort Criteria:
none
I then added the following to template.php
function _phptemplate_variables($hook, $vars = array()) {switch ($hook) {
case 'node':
$vars['template_files'] = array('node-'. $vars['nid']);
break;
}
return $vars;
}
and created a custom node-profile.tpl.php containing the following lines:
<?php//load the view by name
$view = views_get_view('memberlist_view');
//output the view
print views_build_view('embed', $view);
?>
I am close heh, I think... where did I go wrong?
Digging a little deeper, it
Digging a little deeper, it seems to be putting up a listing for each item submitted by a member. i.e. there are over 30 instances of admin because admin has submitted the majority of content on the site. The missing users are users who have not posted anything ever.
What I need to figure out now is how to get it to list members, one time per member on the memberlist (.../profile) page based on the person being a registered member, not off submitted posts and certainly not an entry for each submitted post...
The problem is that Views
The problem is that Views does not support users. Views supports nodes, so you are correct in realising that it's giving you a list of the users that created all the nodes.
View 2 (in alpha stages), does support views of users, but it's a little way off from completion!
What you need to do, as I suggested in the previous thread, is install the Bio module. Then, you'll have a node for every user, and you can create a view of Bios, which will be the users...
__________________________________________________________
Mark Theunissen
Code Baboon
Drupal based services
ah, ok so bio turns the
ah, ok so bio turns the /user/* into a node which can then be turned into a view that mimics the current /profile node's functionality.
Wow, and I thought I would try to start off with an easy one first and work my way up to the bios and cck. I am begining to think that there is no 'easy' one so I guess it's time to dive right in.
Installing Bio, then trying to create a view that sums them all up. Quick question, can Bio module be used in conjunction with Usernode module? Usernode is a requirement of Buddylist2 which I was thinking of replacing Buddylist with.
That's exactly what it does,
That's exactly what it does, amoungst other things.
Bio and usernode do very similar things, so my guess would be no you shouldn't use them together... but of course, you can use the Usernode module to build views of users! I just suggested Bio because I prefer it to Usernode and it has more features built in.
__________________________________________________________
Mark Theunissen
Code Baboon
Drupal based services
Thanks Mark, I had usernode
Thanks Mark, I had usernode uploaded already so I turned it on quick so I could edit my view while everything is fresh in my head, and it worked... doesn't look great but at least it's laid out correctly.
I am adding the Bio module when I wake up later because it looks very nice from the picture, seems a bit more configurable, and well frankly you recomended it and have been right about everything else so far :)
When I upload the bio mod I am going to go right into configuring profile pages. When I use CCK to add fields to profile pages can I create fields that users can choose on a per user basis to display? I would like to give them the option to hide their real name etc if they so desire? Also, if that is the case can i set the view to show those fields only if they are 'visable'?
Lastly, can the views I made such as what is up on www.tapbjj.com/profile be further customized or am I stuck with the stock output of views? If they can be customized is there a thread that goes into how? I found one that sonded like it might be similar to what I am looking for, but it said it was only for themeing list mode views. Is there a way to apply style.css to it?
Thanks again for your help, it is starting to make more sense now and I am now going to bed in a good mood for the first time since I started trying to customize this stuff!
Thanks :)
No prob :) You can configure
No prob :)
You can configure which CCK fields to display, I just do it manually in code because it's quick, but there's probably a module that does it... you'll have to look or ask around because I don't know offhand.
Style.css will apply to your views... so yes, but to really change views, you need to theme them in template.php... search for theming views, should be plenty of info, but it is quite a mission from what I remember... ;)
__________________________________________________________
Mark Theunissen
Code Baboon
Drupal based services