Active
Project:
Content Profile
Version:
6.x-1.0-beta4
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
17 Dec 2009 at 14:12 UTC
Updated:
2 Apr 2010 at 22:21 UTC
Hi,
I've been using content profile for a while and now I'm getting into block development.
I've developed a few blocks that pull content from the user's content profile and dispaly it in diferent parts of the site.
I don't have any cacheing enabled but I was wondering what would be the best cache option.
I was thinking about per user cache, but what will happen if the user modifies something from its content profile?
Is there an explicit way to expire the cached blocks when the content profile is updated?
Thanks!
Comments
Comment #1
josepvalls commentedI probably should say that those blocks do some intense calculations and pull information from views so it would be not very good to have to calculate them for every page view.
Comment #2
Bilmar commentedCould you please share the code used in the custom blocks? Thank you
Comment #3
josepvalls commentedSure! I'll copy the simplest of the blocks. Not the best code, but you will get the idea. What will happen when the user fills in or changes his profile if this block is cached.
Comment #4
adpo commentedIs it possible to show Content profile block on specific pages?
- node type: ie. advertisement
and
- block will show content profile for the node author.
using PHP?
Thank you for reply.
Comment #5
josepvalls commentedI don't think your question relates at all to mine but yes, you can write a module in PHP that provides a block that checks the current node's content type and then would load and render the profile of the node's author.
Comment #6
adpo commentedHi, thank you for reply, could you show me an example how to load and render the profile of the node's author.
Comment #7
josepvalls commentedYou may get the node's author by $node=node_load(arg(1)); use content_profile_load with $node->uid (or node_load) to load the node and then render it into the block's body using node_view.
I changed the subject of the issue to reflect the problem I was trying to address in the beginning, please create your own issue for your questions
Comment #8
benone commentedWhat about enabling profile module and use Account information block (block comes with profile module) for displaying content profile fields ?
I copied profile-block.tpl.php to my theme folder and edit this adding:
You have all the content profile fields in a block which always appears next to the user nodes and its cached already by drupal core.
Am I right ?