First, thanks for developing this well written and well thought out module.
I've been using the latest beta releases for a while now, and while it's been working fine, I'm not too happy with the implementation on user pages. I wanted to have only one content type designated for profiles, and have the content of those nodes more tightly integrated user pages, exactly as it is displayed on node/#.
Well, I started hacking away trying to achieve just that, and found it fairly easy. Some hours of happy hacking later, I ended up with a complete little module (content_profile_page for lack of a better name) with a couple more features than planned. It's straight out of the oven, so there be bugs.
The settings of the module are...
Show on user page:
Content from the selected content type will be shown on user pages. Select Default to show the default user page.
Default edit:
Select which subtab the Edit tab should default to on user pages.
Redirect profile nodes to user page:
If checked, a user's profile node will redirect to the user's page. This is useful if you don't want profiles to appear in two places (node/# and user/#).
It works with more than one content type set as content profiles, but it allows you to highlight one of the content types on user pages, plus redirects from the nodes so that it's all in one place. The Default edit option felt obvious, as the profile is something you'd want to edit more often than your account information.
If you think some of these are useful features, feel free to take bits and pieces out of the module and/or rewrite them for Content Profile. It wouldn't feel right to publish this as another contrib module, as it doesn't provide that much in addition to Content Profile, so I thought I'd just post it here and hear what you have to say.
Comment | File | Size | Author |
---|---|---|---|
#4 | content_profile_patch_1.patch | 1.8 KB | andreiashu |
#4 | content_profile_page_1.tar_.gz | 2.18 KB | andreiashu |
content_profile_page.tar_.gz | 2.5 KB | ximo |
Comments
Comment #1
solutiondrop CreditAttribution: solutiondrop commentedThanks ximo, the redirect profile nodes to user page is really useful. I'll so far I haven't noticed anything wrong with that part of the module.
Comment #2
JohnFilipstadJust tested all the possible options and the module is working as promised. Thanks ximo! I've been wanting this! Remind me to buy you a beer in DrupalCamp Stockholm for these additional features :-)
I do hope that this be added as a sub-module of the great Content Profile module. If not, I hope ximo considers on maintaining it as a supplementary module.
...and thanks to the maintainer/s of the Content Profile module for a job well done :-)
I think d.o's recent changes on project statuses do not reflect the status of this issue now. Changing the status to 'needs review'
Comment #3
andreiashu CreditAttribution: andreiashu commentedHi,
For this module to work with the latest versions of CP I changed
$type = 'user/%user_category/edit/'. $type;
with this
$type = 'user/%user/profile/' . $type;
About the "Default edit" option: I'm not very sure it is the right approach here because you(or oven the admin) cannot edit your base user settings if you enable it. I would be nicer if you could have your base edit settings merged with the profile edit settings. Not sure if it is possible though.
I would also suggest adding
to the .info page.
The function
content_profile_page_override_access
i would have written as this:I'll attach the archive with the new changes in the next comment.
Comment #4
andreiashu CreditAttribution: andreiashu commentedComment #5
andreiashu CreditAttribution: andreiashu commentedComment #6
andreiashu CreditAttribution: andreiashu commentedcontent_profile_page_override_access would be even better written as:
:)
Comment #7
fagoSo what's the actual patch to look at? Can you please summarize the changes of it?
Comment #8
ShutterFreak CreditAttribution: ShutterFreak commentedSubscribing as I also need this.
One suggestion I would add is adding a way to lock the title of the profile node and copy/sync it with the user name (or any other combinbation of (tokenized) user fields).
Cheers,
Olivier
Comment #9
altparty CreditAttribution: altparty commentedThanks for this mod. I use 2 content types to build a user profile and it makes no use to view the nodes themselves. When I use this solution (http://drupal.org/node/244004) some features within the author pane (like UR of Privatemsg link) don't work anymore. Also the links of the nodes won't show up.
With your module these problems don't exist.
Comment #10
Liliplanet CreditAttribution: Liliplanet commentedNice module! Thank you! Solves all the problems of redirecting the content profile nodes to the user page.
Comment #11
rangerfrex CreditAttribution: rangerfrex commentedThanks, I am into this thing too
Comment #12
ShutterFreak CreditAttribution: ShutterFreak commentedRegarding #8, this works with the "Automatic Nodetitles" and "Token" modules. Just set the title to the token "[author-name]" and you're done.
Comment #13
ximo CreditAttribution: ximo commentedSeeing how popular this little module turned out to be, I'm considering taking it out of the issue queue and showing it some love.
Fago: Is this something you could see being included in content_profile itself? Or do you prefer that I provide this as an additional module in contrib? And maybe further down the road include it into content_profile as a sub module, if it turns out to be popular enough. I think this functionality is useful in most cases, as end users aren't aware of the distinction between a user account and a profile node and are used to seeing these in one place. I believe functionality like this is well worthy of being provided by content_profile itself. In any case, I'd like to work on getting this functionality easily available.
Comment #14
Liliplanet CreditAttribution: Liliplanet commentedWonderful!
I don't know if this is the correct place, but would it be possible to move the user image into the content profile? (that is instead of the user account (edit) page ..
.. or maybe as a separate tab
Members are just not going to look for it there :)
Most appreciate your module, and again, thank you.
Lilian
Comment #15
andreiashu CreditAttribution: andreiashu commented+1 for #13
Comment #16
OFF CreditAttribution: OFF commentedCOOL! Very Very cool!
ximo, big thanks
Comment #17
OFF CreditAttribution: OFF commentedbut i dont understand why statistics counter dont count profile node views
Comment #18
jthomasbailey CreditAttribution: jthomasbailey commentedSubscribing
Comment #19
mr.alinaki CreditAttribution: mr.alinaki commentedYahoo!!! Very cool! Big thanks! Now I can implement all I want :)
Comment #20
fago@#13: I think it would be best added as a small separate module - as separate sub-module of cp. So if you could polish it a little bit more, I'd be happy to include it!
* Please add a README.txt and some basic usage docs.
@code: I did a first quick review:
* // Fetch all content types, keep only those marked as content profile.
There is API function for that, I think it's called content_profile_get_types().
* "-default-" is a valid content type name isn't it? -> That might lead to troubles. Perhaps just use "0" as value for default.
* @content_profile_page_override_access(): Have a look at the access callback. If node_access() returns false, just the global user page access is returned, isn't it? So people might view the node? (Access violation)
Comment #21
pribeh CreditAttribution: pribeh commentedI'm not sure if this is the expected result or a bug of this submodule but after having installed the module (from #4) in its own directory (modules/content_profile_pages) user/* always redirects to the profile node. I thought the purpose of this module was to redirect links to the profile node to the user profile. Perhaps this is a conflict with panels as I'm using panels 3 in conjunction with CP, APK, & AP to display the profile. Thanks for your efforts andreiashu.
Comment #22
perarnet CreditAttribution: perarnet commentedWould it be possible to integrate unblock/publish block/unpublish functionality to this submodule? As it is now, it is annoying that we need to both publish and unblock the user in two stages.
Comment #23
hefox CreditAttribution: hefox commentedWas wondering if content profile already had the redirect feature, but looks like it didn't being that you made this profile.
Looked at the code briefly; I've actually done something similar before and plan to do something similar again, but you've done it completly differntly from how did so couldn't be lazy and copy and paste.
Just a suggestion instead of drupal_goto in the view, make a dependcing with path_redirect module and add a link between node/ and user/ in op 'insert', 'update'. Haven't looked into pros and cons, but may be a better way. (ie don't have to go through the partial lode of the node before redirection).
Here's how I did it with path_redirect, assuming content type named profile.
Comment #24
Maedi CreditAttribution: Maedi commented*subscribing*
Comment #25
prdsp CreditAttribution: prdsp commentedThis module no longer works with the latest RC1 or Dev versions of panels and ctools. It blocks panels from overriding the user page. Can anyone create this module just to perform the profile node redirection without the Show on user page or the default edit options. I believe the show on user page is what is causing panels not to be able to override the user page...however, all I need is the redirection. Can anyone help me with this?
Comment #26
hefox CreditAttribution: hefox commentedThe code you want is in $op 'view' of it's hook_nodeapi.
Alternatively if you're using path_redirect already, you could try out what I mentioned in #23
something along the lines of
Comment #27
prdsp CreditAttribution: prdsp commentedHefox - I've installed and enabled path redirect but where am I supposed to put the code that you referenced in #23
Comment #28
hefox CreditAttribution: hefox commentedCreate a module (or use a custom module for your site; I generally have one per site personally).
Replace with that module name and with content type name of the profile. (If multiple profiles replace
$node->type == ''
with in_array($node->type,array('ct1','ct2','ct3')) with ct1,ct2,ct3, being the content types (ie the machine readable name).
Blah, forgot to mention will need to resave the nodes (little details like that I forget, sorry) XD; I'd likely use views bulk operations to do something silly like update the update date.
Essentially it says if this is right content type and there's not already a redirect between path and redirect, add it in on insert/update.
Comment #29
jthomasbailey CreditAttribution: jthomasbailey commentedThat custom profile redirect module works great... but does anyone know how to display the content profile's comments?
Comment #30
theusualsuspect CreditAttribution: theusualsuspect commentedThis module works perfectly... It is deeply appreciated, thank you so much! It took me months so far to get a hold of user profiles in Drupal. It is such a hassle. Especially when you have 2 or more different user profiles. Anyways this module solved a big problem. So now I have my desired Profile page.
For anyone who is interested:
With Views you can create a totally customized profile page with all the CCK fields of your content profile. Just add to your view the path user/%1 with the User:UID argument. That way your profile page is overridden with the view.
@hobgobbler. You can create a separate view with an Argument User:UID retrieved from your url and then output the comments of that user. Then embed your view in page-user.tpl.php . This way I managed to output the regular user profile (as explained before) and add optional information like comments by that user, flags and posts by that user.
@Liliplanet: You can replace the core user picture with a content profile field by creating a user-picture.tpl.php file and replacing it with the following code (adapt to your needs):
This way I have access to $user-picture in my templates but it is automatically replaced with the content profile avatar. My profile page is overriden by a view, so I will only see the content profile picture fields. However, you will wind up with two picture fields on your user edit page. One in the profile edit and the other in account settings. To tackle this I simply added this to template.php
The only downside is that when I print out the $user-picture in my template I will have one imagecache preset to work with. This works for my needs.
Hope this helps other developers who were looking to accomplish something similar.
Thanks again for this little, but very helpful module.
Comment #31
mattiasj CreditAttribution: mattiasj commentedThis helps out alot, I have recently been debating alot about how to redirect users when browsing to the user node vs the user. But what will happen when browsing a user node that currently doesnt have a registered user connected to it?
Comment #32
rickh CreditAttribution: rickh commentedsuspect
I was wondering if you could clarify the code above, as i've been looking for this for a while. It's probably clear already, and therfore sorry for the inconvenience but i'm new to drupal so the coding still gets me. I have been looking for this solution for ages so any help would be appreciated specifically concerning the fields amrked in red.
thanks for any help. r
Comment #33
rickh CreditAttribution: rickh commentedsorry guys,
any help on this issue?
thanks, rick
Comment #34
rickh CreditAttribution: rickh commentedFor anyone else who couldn't find a way to link the user to their profile, by creating a user-profile.tpl.php file in your subtheme and placing the following code there, works like a charm.
Hope this helps someone
Comment #35
YesCT CreditAttribution: YesCT commentedseems like for a while there it looked like this might be added as a sub module to content profile
and that it would add the ability to redirect the profile nodes back to the user page.
is this still possible? (possible to do, and is it still on the todo list to add the functionality officially into content profile... i really dont want to do a patch or an custom module like this when it would be better maintained publicly)
Comment #36
chules CreditAttribution: chules commentedHow do you install this? You place content_profile_page under modules but what about the patch. I am new to drupal and just need some clarification
Thank you - chules
Comment #37
YesCT CreditAttribution: YesCT commentedI guess this didn't make it in with regards to fago's comment in #20?
I dont understand if I need to do what is listed in #23 #26 #28
I (just) want to have each content profile node redirect to /user/...
What happens right now, that I dont like, is /content/username is accessible standalone.
Comment #38
YesCT CreditAttribution: YesCT commentedIf this were an official submodule of content profile, I would feel much more comfortable using it, and I would feel like bugs in it would get more attention and get fixed.
Comment #39
roball CreditAttribution: roball commented@ #14: Solution can be found at http://drupal.org/node/442004#comment-2607064
Comment #40
earthangelconsulting CreditAttribution: earthangelconsulting commentedre: #17... see this post: http://drupal.org/node/1077968