Drupal 6.13
I am doing a baby step to module world in order to hack into og detailed block. So far is does work but comes with an error message:
"warning: Cannot modify header information - headers already sent by (output started at http://mysite.com/sites/all/modules/mymodule/mymodule.module:1 ) in http://mysite.com/includes/common.inc on line 141."
What does this mean and how do I remedy this?
Here is the code I have (which is pretty much copy/paste from what I found at the Drupal site except the first 2 lines).
<?php // $Id$
/** * Implementation of hook_og_links_alter(). */ function mymodule_og_links_alter(&$links, $group_node) { // drupal_set_message(''. var_export($links,TRUE) .''); // Remove .. members link and change Invite link to Blablabla in group details block. $links['invite'] = 'Blablabla'; unset ($links['subscribers']); }
-- - Hiro
Hiroaki Honshuku, A-NO-NE Music, Greater Boston http://a-no-ne.com http://anonemusic.com
You have something being outputted to the browser before it should be. Check to make sure you don't have a blank line above your opening <?php. Also is you have a closing ?> (which you really shouldn't by Drupal standards), make sure there's no blank lines after it.
Also for additional development help, I suggest downloading and installing the Devel module. You can do nicely formatted variable dumps with it:
http://ratatosk.backpackit.com/pub/1836982-debugging-drupal
Jamie Holly http://www.intoxination.net http://www.hollyit.net
A-NO-NE Music wrote:
Drupal 6.13
I am doing a baby step to module world in order to hack into og detailed block. So far is does work but comes with an error message:
"warning: Cannot modify header information - headers already sent by (output started at http://mysite.com/sites/all/modules/mymodule/mymodule.module:1 ) in http://mysite.com/includes/common.inc on line 141."
What does this mean and how do I remedy this?
Here is the code I have (which is pretty much copy/paste from what I found at the Drupal site except the first 2 lines).
<?php // $Id$
/**
- Implementation of hook_og_links_alter().
*/ function mymodule_og_links_alter(&$links, $group_node) { // drupal_set_message(''. var_export($links,TRUE) .''); // Remove .. members link and change Invite link to Blablabla in group details block. $links['invite'] = 'Blablabla'; unset ($links['subscribers']); }
--
- Hiro
Hiroaki Honshuku, A-NO-NE Music, Greater Boston http://a-no-ne.com http://anonemusic.com
-- [ Drupal support list | http://lists.drupal.org/ ]
On 2009/09/15, at 8:40, Jamie Holly wrote:
Also for additional development help, I suggest downloading and installing the Devel module. You can do nicely formatted variable dumps with it:
I do have Devel installed but I haven't learn how to use dump yet. One of the problems OG Detail Block gives me is that you can't see it if you are admin - I suppose you have to belong to only one OG to see the block. I use Devel to login to one of the students account to see the OG Detail Block.
This actually raises another question. I want OG Detail Block to be preset all the time as soon as the student login. If I can make this happen, I even don't need to send student to the OG home page at login, which I have tried and failed with Login Destination.
So, what does it take to make OG Detail block preset all the time as soon as the use login?
-- - Hiro
Hiroaki Honshuku, A-NO-NE Music, Greater Boston http://a-no-ne.com http://anonemusic.com
A-NO-NE Music wrote:
<div class="moz-text-flowed" style="font-family: -moz-fixed">Drupal 6.13
I am doing a baby step to module world in order to hack into og detailed block. So far is does work but comes with an error message:
"warning: Cannot modify header information - headers already sent by (output started at http://mysite.com/sites/all/modules/mymodule/mymodule.module:1) in http://mysite.com/includes/common.inc on line 141."
What does this mean and how do I remedy this?
Here is the code I have (which is pretty much copy/paste from what I found at the Drupal site except the first 2 lines).
<?php // $Id$
/**
- Implementation of hook_og_links_alter().
*/ function mymodule_og_links_alter(&$links, $group_node) { // drupal_set_message(''. var_export($links,TRUE) .''); // Remove .. members link and change Invite link to Blablabla in group details block. $links['invite'] = 'Blablabla'; unset ($links['subscribers']); }
--
- Hiro
Hiroaki Honshuku, A-NO-NE Music, Greater Boston http://a-no-ne.com http://anonemusic.com
</div>
This error occurs when you have leading white space in your php file - Apache (or whatever) parses the php file as 'content' until it sees the opening <?php tag, when it switches into interpreting it as php code. Once it has started outputting "body", it can't go back and generate headers. The fix is to delete everything in your file before the <?php. I got bitten by this very early in my php life.
Regards, Peter
Thanks Peter and Jamie for your suggestions.
I didn't have any white space, and I didn't have ?> closing tag. I actually read the tutorial before :-)
I was scratching my head all day today, and finally I found the cause. Out of habit, I had UTF-8 declaration on the file header, EF BB BF. I didn't realize this until I opened the file wit Hex Editor. Apparently Drupal didn't like this. Now I know better.
Thank you!
-- - Hiro
Hiroaki Honshuku, A-NO-NE Music, Greater Boston http://a-no-ne.com http://anonemusic.com