authentication hooks - PLEASE HELP
I downloaded the Webserver Authentication module because it's very similar to the module that I need to write for my own site. It's a simple module, but I can't get it to work and I've hit a brick wall. Nothing works - Drupal doesn't recognize when I'm logged into my other authentication system, let alone create Drupal registrations on the fly. It doesn't even appear that the hook_auth module is being called, but I can't trace through the execution because Drupal doesn't use output buffers so inserting echo statements causes errors. I have tested my login and authentication functions in a separate test program, so I know that they work. I don't know why my module doesn't work. It's probably something simple, but there is virtually no documentation on authentication modules, and I can't figure it out for myself because I can't trace through execution with echo statements. I need information on these basic questions: - Which hook functions are called when (and not just from within the Drupal code, but from what user action)? I thought that hook_auth() might be called when the user logged in (that was a wild guess), but I can't get Drupal to call this function no matter what I do. - Exactly how the returns of each function are used - in what other parts of Drupal. Without knowing this, I don't know what's required. In particular for hook_auth, but also for hook_info. When/how are the hook_info functions used? By what part of Drupal? What might call these, and why? - What values are set in the database to control authentication, and what does each value mean? In particular, what is the meaning of the different values for "status" in the user table? - How can I echo values while the script is executing to I can debug my modules??????????????? Please, someone help. I've posted message after message, and no one helps. Thanks in advance.
Hi Sheryl, I believe that output buffering is a PHP option - you can enable it in your php.ini file, or .htaccess, or in your settings.php file. An alternative hack is to write debugging output to the watchdog table (works only for debugging sections of code where common.inc is available): watchdog('debug', "var = $var"); It's ugly but hey, what people will do in times of desperation... I've not looked at Webserver authentication. Have you tried contacting the maintainer? You might also try hanging out in #drupal at irc.freenode.net. Have a look at drupaldocs.org for the developer documentation, including overviews of the hook system. The Drupal handbooks may also be of help, especially the Developer handbook (http://drupal.org/handbooks) Cheers, Djun On 18-Dec-2005, at 12:26 PM, Sheryl (Permutations Software) wrote:
I downloaded the Webserver Authentication module because it's very similar to the module that I need to write for my own site. It's a simple module, but I can't get it to work and I've hit a brick wall. Nothing works - Drupal doesn't recognize when I'm logged into my other authentication system, let alone create Drupal registrations on the fly. It doesn't even appear that the hook_auth module is being called, but I can't trace through the execution because Drupal doesn't use output buffers so inserting echo statements causes errors.
I have tested my login and authentication functions in a separate test program, so I know that they work. I don't know why my module doesn't work. It's probably something simple, but there is virtually no documentation on authentication modules, and I can't figure it out for myself because I can't trace through execution with echo statements. I need information on these basic questions:
- Which hook functions are called when (and not just from within the Drupal code, but from what user action)? I thought that hook_auth() might be called when the user logged in (that was a wild guess), but I can't get Drupal to call this function no matter what I do.
- Exactly how the returns of each function are used - in what other parts of Drupal. Without knowing this, I don't know what's required. In particular for hook_auth, but also for hook_info. When/ how are the hook_info functions used? By what part of Drupal? What might call these, and why?
- What values are set in the database to control authentication, and what does each value mean? In particular, what is the meaning of the different values for "status" in the user table?
- How can I echo values while the script is executing to I can debug my modules???????????????
Please, someone help. I've posted message after message, and no one helps. Thanks in advance.
The only way I know to turn on output buffering it to create the buffer at the top of the page and write it at the bottom with these calls: ob_start(); ... ob_end_flush(); But with Drupal - who knows where the top of the page is, or the bottom. Hmmm... Actually, I wrote a custom template in PHP (no engine). Maybe I can put it in my template file.
An alternative hack is to write debugging output to the watchdog table (works only for debugging sections of code where common.inc is available)
Thanks for the watchdog tip... I don't know where common.inc is used or when it would "be available". I'm a strong PHP programmer, but not very familiar with Drupal's architecture. I did write to the author of the Webserver Auth mod and he wrote back - hopefully he can help. -----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org] On Behalf Of puregin Sent: Sunday, December 18, 2005 3:45 PM To: development@drupal.org Subject: Re: [development] authentication hooks - PLEASE HELP Hi Sheryl, I believe that output buffering is a PHP option - you can enable it in your php.ini file, or .htaccess, or in your settings.php file. An alternative hack is to write debugging output to the watchdog table (works only for debugging sections of code where common.inc is available): watchdog('debug', "var = $var"); It's ugly but hey, what people will do in times of desperation... I've not looked at Webserver authentication. Have you tried contacting the maintainer? You might also try hanging out in #drupal at irc.freenode.net. Have a look at drupaldocs.org for the developer documentation, including overviews of the hook system. The Drupal handbooks may also be of help, especially the Developer handbook (http://drupal.org/handbooks) Cheers, Djun On 18-Dec-2005, at 12:26 PM, Sheryl (Permutations Software) wrote:
I downloaded the Webserver Authentication module because it's very similar to the module that I need to write for my own site. It's a simple module, but I can't get it to work and I've hit a brick wall. Nothing works - Drupal doesn't recognize when I'm logged into my other authentication system, let alone create Drupal registrations on the fly. It doesn't even appear that the hook_auth module is being called, but I can't trace through the execution because Drupal doesn't use output buffers so inserting echo statements causes errors.
I have tested my login and authentication functions in a separate test program, so I know that they work. I don't know why my module doesn't work. It's probably something simple, but there is virtually no documentation on authentication modules, and I can't figure it out for myself because I can't trace through execution with echo statements. I need information on these basic questions:
- Which hook functions are called when (and not just from within the Drupal code, but from what user action)? I thought that hook_auth() might be called when the user logged in (that was a wild guess), but I can't get Drupal to call this function no matter what I do.
- Exactly how the returns of each function are used - in what other parts of Drupal. Without knowing this, I don't know what's required. In particular for hook_auth, but also for hook_info. When/ how are the hook_info functions used? By what part of Drupal? What might call these, and why?
- What values are set in the database to control authentication, and what does each value mean? In particular, what is the meaning of the different values for "status" in the user table?
- How can I echo values while the script is executing to I can debug my modules???????????????
Please, someone help. I've posted message after message, and no one helps. Thanks in advance.
Putting output buffer statements into my theme seems to have solved the tracing problem, at least. At the top and bottom of the hook_page() function in my PHP theme, I added these statements: $output = eval('ob_start();'); ... $output .= eval('ob_end_flush();'); I still have many other problems, however. Drupal calls databases and functions at unpredictable times. I can't tell what's going on and there is no documentation. -----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org] On Behalf Of Sheryl (Permutations Software) Sent: Sunday, December 18, 2005 4:10 PM To: development@drupal.org Subject: RE: [development] authentication hooks - PLEASE HELP The only way I know to turn on output buffering it to create the buffer at the top of the page and write it at the bottom with these calls: ob_start(); ... ob_end_flush(); But with Drupal - who knows where the top of the page is, or the bottom. Hmmm... Actually, I wrote a custom template in PHP (no engine). Maybe I can put it in my template file.
An alternative hack is to write debugging output to the watchdog table (works only for debugging sections of code where common.inc is available)
Thanks for the watchdog tip... I don't know where common.inc is used or when it would "be available". I'm a strong PHP programmer, but not very familiar with Drupal's architecture. I did write to the author of the Webserver Auth mod and he wrote back - hopefully he can help. -----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org] On Behalf Of puregin Sent: Sunday, December 18, 2005 3:45 PM To: development@drupal.org Subject: Re: [development] authentication hooks - PLEASE HELP Hi Sheryl, I believe that output buffering is a PHP option - you can enable it in your php.ini file, or .htaccess, or in your settings.php file. An alternative hack is to write debugging output to the watchdog table (works only for debugging sections of code where common.inc is available): watchdog('debug', "var = $var"); It's ugly but hey, what people will do in times of desperation... I've not looked at Webserver authentication. Have you tried contacting the maintainer? You might also try hanging out in #drupal at irc.freenode.net. Have a look at drupaldocs.org for the developer documentation, including overviews of the hook system. The Drupal handbooks may also be of help, especially the Developer handbook (http://drupal.org/handbooks) Cheers, Djun On 18-Dec-2005, at 12:26 PM, Sheryl (Permutations Software) wrote:
I downloaded the Webserver Authentication module because it's very similar to the module that I need to write for my own site. It's a simple module, but I can't get it to work and I've hit a brick wall. Nothing works - Drupal doesn't recognize when I'm logged into my other authentication system, let alone create Drupal registrations on the fly. It doesn't even appear that the hook_auth module is being called, but I can't trace through the execution because Drupal doesn't use output buffers so inserting echo statements causes errors.
I have tested my login and authentication functions in a separate test program, so I know that they work. I don't know why my module doesn't work. It's probably something simple, but there is virtually no documentation on authentication modules, and I can't figure it out for myself because I can't trace through execution with echo statements. I need information on these basic questions:
- Which hook functions are called when (and not just from within the Drupal code, but from what user action)? I thought that hook_auth() might be called when the user logged in (that was a wild guess), but I can't get Drupal to call this function no matter what I do.
- Exactly how the returns of each function are used - in what other parts of Drupal. Without knowing this, I don't know what's required. In particular for hook_auth, but also for hook_info. When/ how are the hook_info functions used? By what part of Drupal? What might call these, and why?
- What values are set in the database to control authentication, and what does each value mean? In particular, what is the meaning of the different values for "status" in the user table?
- How can I echo values while the script is executing to I can debug my modules???????????????
Please, someone help. I've posted message after message, and no one helps. Thanks in advance.
Sheryl (Permutations Software) wrote:
Putting output buffer statements into my theme seems to have solved the tracing problem, at least. At the top and bottom of the hook_page() function in my PHP theme, I added these statements:
$output = eval('ob_start();'); ... $output .= eval('ob_end_flush();');
I still have many other problems, however. Drupal calls databases and functions at unpredictable times. I can't tell what's going on and there is no documentation.
There is actually quite a bit of documentation; there's so much, in fact, it can be hard to tell where to start. The handbook and drupaldocs.org both have a great deal of documentation on the Drupal architecture.
I've read everything. Nothing speaks to these questions: - Which hook functions are called when (and not just from within the Drupal code, but from what user action)? I thought that hook_auth() might be called when the user logged in (that was a wild guess), but I can't get Drupal to call this function no matter what I do. - Exactly how the returns of each function are used - in what other parts of Drupal. Without knowing this, I don't know what's required. In particular for hook_auth, but also for hook_info. When/how are the hook_info functions used? By what part of Drupal? What might call these, and why? - What values are set in the database to control authentication, and what does each value mean? In particular, what is the meaning of the different values for "status" in the user table? - How can I echo values while the script is executing to I can debug my modules??????????????? If I'm wrong and there the information I seek is somewhere to be found, please post a link. A general comment that there is "lots of documentation" does not help me. Thank you. -----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org] On Behalf Of Earl Miles Sent: Sunday, December 18, 2005 4:33 PM To: development@drupal.org Subject: Re: [development] authentication hooks - PLEASE HELP Sheryl (Permutations Software) wrote:
Putting output buffer statements into my theme seems to have solved the tracing problem, at least. At the top and bottom of the hook_page() function in my PHP theme, I added these statements:
$output = eval('ob_start();'); ... $output .= eval('ob_end_flush();');
I still have many other problems, however. Drupal calls databases and functions at unpredictable times. I can't tell what's going on and there is no documentation.
There is actually quite a bit of documentation; there's so much, in fact, it can be hard to tell where to start. The handbook and drupaldocs.org both have a great deal of documentation on the Drupal architecture.
Hi Sheryl, Please show us some code. A great way to do this is with http://pastebin.com/ Just go there, fill in the form, and post the URL here for people to look at. Sheryl (Permutations Software) wrote:
- Which hook functions are called when (and not just from within the Drupal code, but from what user action)? I thought that hook_auth() might be called when the user logged in (that was a wild guess), but I can't get Drupal to call this function no matter what I do.
1) Is the function called hook_auth or yourmodule_auth() ? 2) Is your login attempt failing because Drupal is authenticating the user the normal way? Drupal doesn't call the auth hook if the user gets authenticated successfully by Drupal.
- What values are set in the database to control authentication, and what does each value mean? In particular, what is the meaning of the different values for "status" in the user table?
This is a very good point. We've been slowly weaning ourselves from things like if ($user['status'] > 3) and moving to replacing 3 with a meaningful constant to be human readable. Please open an issue on the user module, mark it as 'task', and describe that this should be done for the user module. Better yet, when you figure out what the various meanings of 1, 2, 3 and whatever are, define the variables, replace the numbers, and roll a patch. It could become your first contribution to Drupal core.
- How can I echo values while the script is executing to I can debug my modules???????????????
The normal way. You have to find a place where the code actually gets called, so if your auth hook isn't getting called, you've got to fix that first. I always do this: print_r($vals); exit(); If you have the devel module installed, you can use dprint_r instead (it formats it nicely). Others have other debugging styles. Don't forget that it is Sunday... very slow time for the devel list. -Robert
Thanks - will do. I have to drive out of state tonight - I'll do it when I arrive at my destination. -----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org] On Behalf Of Robert Douglass Sent: Sunday, December 18, 2005 4:59 PM To: development@drupal.org Subject: Re: [development] authentication hooks - PLEASE HELP Hi Sheryl, Please show us some code. A great way to do this is with http://pastebin.com/ Just go there, fill in the form, and post the URL here for people to look at. Sheryl (Permutations Software) wrote:
- Which hook functions are called when (and not just from within the Drupal code, but from what user action)? I thought that hook_auth() might be called when the user logged in (that was a wild guess), but I can't get Drupal to call this function no matter what I do.
1) Is the function called hook_auth or yourmodule_auth() ? 2) Is your login attempt failing because Drupal is authenticating the user the normal way? Drupal doesn't call the auth hook if the user gets authenticated successfully by Drupal.
- What values are set in the database to control authentication, and what does each value mean? In particular, what is the meaning of the different values for "status" in the user table?
This is a very good point. We've been slowly weaning ourselves from things like if ($user['status'] > 3) and moving to replacing 3 with a meaningful constant to be human readable. Please open an issue on the user module, mark it as 'task', and describe that this should be done for the user module. Better yet, when you figure out what the various meanings of 1, 2, 3 and whatever are, define the variables, replace the numbers, and roll a patch. It could become your first contribution to Drupal core.
- How can I echo values while the script is executing to I can debug my modules???????????????
The normal way. You have to find a place where the code actually gets called, so if your auth hook isn't getting called, you've got to fix that first. I always do this: print_r($vals); exit(); If you have the devel module installed, you can use dprint_r instead (it formats it nicely). Others have other debugging styles. Don't forget that it is Sunday... very slow time for the devel list. -Robert
Sheryl (Permutations Software) wrote:
I've read everything. Nothing speaks to these questions:
- Which hook functions are called when (and not just from within the Drupal code, but from what user action)? I thought that hook_auth() might be called when the user logged in (that was a wild guess), but I can't get Drupal to call this function no matter what I do.
Which and when are something of a moving target, but the given hooks are fairly reasonable at documenting when they are called. For example hook_auth: http://drupaldocs.org/api/head/function/hook_auth
- Exactly how the returns of each function are used - in what other parts of Drupal. Without knowing this, I don't know what's required. In particular for hook_auth, but also for hook_info. When/how are the hook_info functions used? By what part of Drupal? What might call these, and why?
Read the code?
- What values are set in the database to control authentication, and what does each value mean? In particular, what is the meaning of the different values for "status" in the user table?
You might look here http://drupaldocs.org/api/head/function/hook_auth and you might look for existing authentication modules and check their code.
- How can I echo values while the script is executing to I can debug my modules???????????????
There's the devel module in CVS (right now it's for 4.7 but if you look in the CVS history you can find one that's ok for 4.6). YOu can just 'print'. YOu can use 'drupal_set_message()'.
If I'm wrong and there the information I seek is somewhere to be found, please post a link. A general comment that there is "lots of documentation" does not help me.
Fair enough, but remember that this is an opensource project, and every single person who works on this project is volunteering their time and energy for absolutely no pay. Making demands of volunteers is less likely to lead to rewarding results than it will with a company who is interested in making a sale.
- Which hook functions are called when (and not just from within the Drupal code, but from what user action)? I thought that hook_auth() might be called when the user logged in (that was a wild guess), but I can't get Drupal to call this function no matter what I do.
Yes, there is no clear documentation on where and how such hooks are invoked. Including this information in the hook documentation would be a very useful addition. To try to figure out when a particular hook is called, I tend to search through the core code. The hooks are (generally) called through either module_invoke() (for a particular module) or module_invoke_all() (for all modules) hooks. I might try a search for module_invoke_all('auth' Which, in this case turns up nothing. Then simply for module_invoke($module, 'auth' for which you'll get a hit in user.module. If this too failed, try just the hook in single quotes 'auth' Then, once you find the context, study the code and try to see under what condition the hook is called. In this case (as someone noted) you'll find that the hook is called in user_authenticate, only if user_load() failed locally.
Yes, there is no clear documentation on where and how such hooks are invoked. Including this information in the hook documentation would be a very useful addition.
Well, if it can be done. It is quite impossible to tell without knowing what exact modules you have installed (having what exact source code with them). Any contrib module can call and define hooks. True, having a documentation on what core hooks are called where would be useful, given it is updated as Drupal moves along. Goba
Thank you for the suggestions. I'm supposed to be on the road and haven't left yet. I will try these things when I reach my destination. -----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org] On Behalf Of Nedjo Rogers Sent: Sunday, December 18, 2005 5:35 PM To: development@drupal.org Subject: Re: [development] authentication hooks - PLEASE HELP
- Which hook functions are called when (and not just from within the Drupal code, but from what user action)? I thought that hook_auth() might be called when the user logged in (that was a wild guess), but I can't get Drupal to call this function no matter what I do.
Yes, there is no clear documentation on where and how such hooks are invoked. Including this information in the hook documentation would be a very useful addition. To try to figure out when a particular hook is called, I tend to search through the core code. The hooks are (generally) called through either module_invoke() (for a particular module) or module_invoke_all() (for all modules) hooks. I might try a search for module_invoke_all('auth' Which, in this case turns up nothing. Then simply for module_invoke($module, 'auth' for which you'll get a hit in user.module. If this too failed, try just the hook in single quotes 'auth' Then, once you find the context, study the code and try to see under what condition the hook is called. In this case (as someone noted) you'll find that the hook is called in user_authenticate, only if user_load() failed locally.
If I can get this sorted out, who knows, I might even contribute to drupal - upload my themes, tutorials, whatever. -----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org] On Behalf Of Sheryl (Permutations Software) Sent: Sunday, December 18, 2005 6:18 PM To: development@drupal.org Subject: RE: [development] authentication hooks - PLEASE HELP Thank you for the suggestions. I'm supposed to be on the road and haven't left yet. I will try these things when I reach my destination. -----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org] On Behalf Of Nedjo Rogers Sent: Sunday, December 18, 2005 5:35 PM To: development@drupal.org Subject: Re: [development] authentication hooks - PLEASE HELP
- Which hook functions are called when (and not just from within the Drupal code, but from what user action)? I thought that hook_auth() might be called when the user logged in (that was a wild guess), but I can't get Drupal to call this function no matter what I do.
Yes, there is no clear documentation on where and how such hooks are invoked. Including this information in the hook documentation would be a very useful addition. To try to figure out when a particular hook is called, I tend to search through the core code. The hooks are (generally) called through either module_invoke() (for a particular module) or module_invoke_all() (for all modules) hooks. I might try a search for module_invoke_all('auth' Which, in this case turns up nothing. Then simply for module_invoke($module, 'auth' for which you'll get a hit in user.module. If this too failed, try just the hook in single quotes 'auth' Then, once you find the context, study the code and try to see under what condition the hook is called. In this case (as someone noted) you'll find that the hook is called in user_authenticate, only if user_load() failed locally.
You might also find the PHP function debug_backtrace() useful. It prints a stack dump, which lets you see the function calls to that point. Tip: Wrap the output in <pre> tags to make it easier to read. http://www.php.net/debug_backtrace On Sunday 18 December 2005 05:44 pm, Sheryl (Permutations Software) wrote:
If I can get this sorted out, who knows, I might even contribute to drupal - upload my themes, tutorials, whatever.
-- Larry Garfield AIM: LOLG42 larry@garfieldtech.com ICQ: 6817012 "If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it." -- Thomas Jefferson
On 12/18/05, Larry Garfield <larry@garfieldtech.com> wrote:
You might also find the PHP function debug_backtrace() useful. It prints a stack dump, which lets you see the function calls to that point. Tip: Wrap the output in <pre> tags to make it easier to read.
I'd actually recomment debug_print_backtrace() . The tip about wrapping it in pre tags still applies though. andrew
On 12/19/05, andrew morton <drewish@katherinehouse.com> wrote:
On 12/18/05, Larry Garfield <larry@garfieldtech.com> wrote:
You might also find the PHP function debug_backtrace() useful. It prints a stack dump, which lets you see the function calls to that point. Tip: Wrap the output in <pre> tags to make it easier to read.
Note that this is in PHP 4.3.0 and greater.
I'd actually recomment debug_print_backtrace() . The tip about wrapping it in pre tags still applies though.
Not that this is in PHP5 only. Your host may have other versions installed.
On Monday 19 December 2005 08:38 am, Khalid B wrote:
On 12/19/05, andrew morton <drewish@katherinehouse.com> wrote:
On 12/18/05, Larry Garfield <larry@garfieldtech.com> wrote:
You might also find the PHP function debug_backtrace() useful. It prints a stack dump, which lets you see the function calls to that point. Tip: Wrap the output in <pre> tags to make it easier to read.
Note that this is in PHP 4.3.0 and greater.
So is Drupal, which is why I didn't bother mentioning the version. :-) -- Larry Garfield AIM: LOLG42 larry@garfieldtech.com ICQ: 6817012 "If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it." -- Thomas Jefferson
Thanks for both tips. I'm barely online again in my new location, but I will try it as soon as I can. -----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org] On Behalf Of andrew morton Sent: Monday, December 19, 2005 4:18 AM To: development@drupal.org Subject: Re: [development] authentication hooks - PLEASE HELP On 12/18/05, Larry Garfield <larry@garfieldtech.com> wrote:
You might also find the PHP function debug_backtrace() useful. It prints a stack dump, which lets you see the function calls to that point. Tip: Wrap the output in <pre> tags to make it easier to read.
I'd actually recomment debug_print_backtrace() . The tip about wrapping it in pre tags still applies though. andrew
Ugh. I'm still getting the error message: warning: Cannot modify header information - headers already sent Honestly... This is so frustrating. I think it would take less time to write my own CMS. How come there is not support? -----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org] On Behalf Of Sheryl (Permutations Software) Sent: Sunday, December 18, 2005 4:28 PM To: development@drupal.org Subject: RE: [development] authentication hooks - PLEASE HELP Putting output buffer statements into my theme seems to have solved the tracing problem, at least. At the top and bottom of the hook_page() function in my PHP theme, I added these statements: $output = eval('ob_start();'); ... $output .= eval('ob_end_flush();'); I still have many other problems, however. Drupal calls databases and functions at unpredictable times. I can't tell what's going on and there is no documentation. -----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org] On Behalf Of Sheryl (Permutations Software) Sent: Sunday, December 18, 2005 4:10 PM To: development@drupal.org Subject: RE: [development] authentication hooks - PLEASE HELP The only way I know to turn on output buffering it to create the buffer at the top of the page and write it at the bottom with these calls: ob_start(); ... ob_end_flush(); But with Drupal - who knows where the top of the page is, or the bottom. Hmmm... Actually, I wrote a custom template in PHP (no engine). Maybe I can put it in my template file.
An alternative hack is to write debugging output to the watchdog table (works only for debugging sections of code where common.inc is available)
Thanks for the watchdog tip... I don't know where common.inc is used or when it would "be available". I'm a strong PHP programmer, but not very familiar with Drupal's architecture. I did write to the author of the Webserver Auth mod and he wrote back - hopefully he can help. -----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org] On Behalf Of puregin Sent: Sunday, December 18, 2005 3:45 PM To: development@drupal.org Subject: Re: [development] authentication hooks - PLEASE HELP Hi Sheryl, I believe that output buffering is a PHP option - you can enable it in your php.ini file, or .htaccess, or in your settings.php file. An alternative hack is to write debugging output to the watchdog table (works only for debugging sections of code where common.inc is available): watchdog('debug', "var = $var"); It's ugly but hey, what people will do in times of desperation... I've not looked at Webserver authentication. Have you tried contacting the maintainer? You might also try hanging out in #drupal at irc.freenode.net. Have a look at drupaldocs.org for the developer documentation, including overviews of the hook system. The Drupal handbooks may also be of help, especially the Developer handbook (http://drupal.org/handbooks) Cheers, Djun On 18-Dec-2005, at 12:26 PM, Sheryl (Permutations Software) wrote:
I downloaded the Webserver Authentication module because it's very similar to the module that I need to write for my own site. It's a simple module, but I can't get it to work and I've hit a brick wall. Nothing works - Drupal doesn't recognize when I'm logged into my other authentication system, let alone create Drupal registrations on the fly. It doesn't even appear that the hook_auth module is being called, but I can't trace through the execution because Drupal doesn't use output buffers so inserting echo statements causes errors.
I have tested my login and authentication functions in a separate test program, so I know that they work. I don't know why my module doesn't work. It's probably something simple, but there is virtually no documentation on authentication modules, and I can't figure it out for myself because I can't trace through execution with echo statements. I need information on these basic questions:
- Which hook functions are called when (and not just from within the Drupal code, but from what user action)? I thought that hook_auth() might be called when the user logged in (that was a wild guess), but I can't get Drupal to call this function no matter what I do.
- Exactly how the returns of each function are used - in what other parts of Drupal. Without knowing this, I don't know what's required. In particular for hook_auth, but also for hook_info. When/ how are the hook_info functions used? By what part of Drupal? What might call these, and why?
- What values are set in the database to control authentication, and what does each value mean? In particular, what is the meaning of the different values for "status" in the user table?
- How can I echo values while the script is executing to I can debug my modules???????????????
Please, someone help. I've posted message after message, and no one helps. Thanks in advance.
Sheryl (Permutations Software) wrote:
Ugh. I'm still getting the error message:
warning: Cannot modify header information - headers already sent
Honestly... This is so frustrating. I think it would take less time to write my own CMS. How come there is not support?
Quick and easy support is something people pay for, and even then it's often neither quick nor easy. If that warning comes with no message ahead of it, it most often means that some included file, such as a module or something, has whitespace after the ?> at the end of the file. Check your contributed modules and custom code to make sure there is no whitespace there.
Quick and easy support is something people pay for, and even then it's often neither quick nor easy.
I'm a strong PHP programmer and I don't generally need that much help, but Drupal code is unusually hard to follow and the support is unusually thin - even for an open source project. I'm certainly not the first person to say this - I've seen a lot of threads about this in the Drupal forums. I like Drupal's capabilities, but I can't just stay dead in the water like this. Pretty soon I'll have no choice but to find another CMS program to use.
If that warning comes with no message ahead of it, it most often means that some included file, such as a module or something, has whitespace after the ?> at the end of the file. Check your contributed modules and custom code to make sure there is no whitespace there.
Thanks, I'll look. -----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org] On Behalf Of Earl Miles Sent: Sunday, December 18, 2005 4:52 PM To: development@drupal.org Subject: Re: [development] authentication hooks - PLEASE HELP Sheryl (Permutations Software) wrote:
Ugh. I'm still getting the error message:
warning: Cannot modify header information - headers already sent
Honestly... This is so frustrating. I think it would take less time to write my own CMS. How come there is not support?
Quick and easy support is something people pay for, and even then it's often neither quick nor easy. If that warning comes with no message ahead of it, it most often means that some included file, such as a module or something, has whitespace after the ?> at the end of the file. Check your contributed modules and custom code to make sure there is no whitespace there.
Sheryl (Permutations Software) wrote:
Quick and easy support is something people pay for, and even then it's
often neither quick nor easy.
I'm a strong PHP programmer and I don't generally need that much help, but Drupal code is unusually hard to follow and the support is unusually thin - even for an open source project. I'm certainly not the first person to say this - I've seen a lot of threads about this in the Drupal forums.
I like Drupal's capabilities, but I can't just stay dead in the water like this. Pretty soon I'll have no choice but to find another CMS program to use.
Strong PHP programmers will not stay dead in the water with an error message saying "warning: Cannot modify header information - headers already sent". It is easy to say that Drupal is so complicated, but regardless of the application size, these are the easiest errors to track, as they have the line number printed, where you can directly find the unwanted output printed. Goba
Strong PHP programmers will not stay dead in the water with an error message saying "warning: Cannot modify header information - headers already sent". It is easy to say that Drupal is so complicated, but regardless of the application size, these are the easiest errors to track, as they have the line number printed, where you can directly find the unwanted output printed.
The lines causing the problems are echo statements that I put in there to trace execution. Apparently you can't read. If someone can offer helpful information, I will be VERY GRATEFUL. But please don't waste time and bandwidth just to tell me I'm in idiot. Thank you.
the surest way to insure that you don't get "good support" is to appear on the list and start dissing the project. I don't know what this particular problem is, but from a quick look it looks like you have screwed something up in your install - possibly a unix/windows line ending problem. People here are more than generous with their time and advice and the idea that "support is unusually thin" is laughable. Please don't go spreading FUD about this project. Also - you are in the wrong forum - you should be in "support" not on the dev list. People are trying to get a new release out.
Quick and easy support is something people pay for, and even then it's
often neither quick nor easy.
I'm a strong PHP programmer and I don't generally need that much help, but Drupal code is unusually hard to follow and the support is unusually thin - even for an open source project. I'm certainly not the first person to say this - I've seen a lot of threads about this in the Drupal forums.
I like Drupal's capabilities, but I can't just stay dead in the water like this. Pretty soon I'll have no choice but to find another CMS program to use.
If that warning comes with no message ahead of it, it most often means
that some included file, such as a module or something, has whitespace after the ?> at the end of the file. Check your contributed modules and custom code to make sure there is no whitespace there.
Thanks, I'll look.
-----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org] On Behalf Of Earl Miles Sent: Sunday, December 18, 2005 4:52 PM To: development@drupal.org Subject: Re: [development] authentication hooks - PLEASE HELP
Sheryl (Permutations Software) wrote:
Ugh. I'm still getting the error message:
warning: Cannot modify header information - headers already sent
Honestly... This is so frustrating. I think it would take less time to
write
my own CMS. How come there is not support?
Quick and easy support is something people pay for, and even then it's often
neither quick nor easy.
If that warning comes with no message ahead of it, it most often means that some included file, such as a module or something, has whitespace after the ?> at the end of the file. Check your contributed modules and custom code to make sure
there is no whitespace there.
I like Drupal's capabilities, but I can't just stay dead in the water like this. Pretty soon I'll have no choice but to find another CMS program to use.
Sheryl Comments like these will not get you the support you want, and will most likely elicit responses such as "go ahead!" A lot of people have figured it out themselves, or with minimal noise. As others said, this is a Sunday, and hence not everyone is online as often. Search the handbook, check drupaldocs.org, and look in other modules. It is not that hard once you wrap your head around it.
I know - I'm sorry. I'm very frustrated. I've posted MANY messages with no response. I should probably just unsubscribe from this list, delete Drupal, and find a more accessible CMS. Getting into a pissing match about my question-asking style is a waste of everyone's time. -----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org] On Behalf Of Khalid B Sent: Sunday, December 18, 2005 5:28 PM To: development@drupal.org Subject: Re: [development] authentication hooks - PLEASE HELP
I like Drupal's capabilities, but I can't just stay dead in the water like this. Pretty soon I'll have no choice but to find another CMS program to use.
Sheryl Comments like these will not get you the support you want, and will most likely elicit responses such as "go ahead!" A lot of people have figured it out themselves, or with minimal noise. As others said, this is a Sunday, and hence not everyone is online as often. Search the handbook, check drupaldocs.org, and look in other modules. It is not that hard once you wrap your head around it.
Op maandag 19 december 2005 00:16, schreef Sheryl (Permutations Software):
I should probably just unsubscribe from this list, delete Drupal, and find a more accessible CMS. Getting into a pissing match about my question-asking style is a waste of everyone's time.
Its about choices, You get a lot of them. You can choose. You can even choose to not rant, but offer help. If you say "I have posted a lot of messages without getting an answer" you are to blame too: Because answers are given by people; And you are a person too! If you truly want this to be done right, you should at least answer one other issue, when one of yours was anwered. At least. If you don't like the choices that are made for you, you should start making your own. Choosing another CMS might be that. But I can tell you one thing: It should not be an OSS CMS. For you will run into this exact same issue. OSS is build on top of people who contribute. And is pulled down by people who only demand. Ber
If that warning comes with no message ahead of it, it most often means that some included file, such as a module or something, has whitespace after the ?> at the end of the file. Check your contributed modules and custom code to make sure there is no whitespace there.
I've hit this problem when dumping debugging code to the output stream. I think the problem is caused by a call to the drupal_goto() function, which mangles the headers and causes the previous print()/echo() etc to fail. The solution I found and prefer is using drupal_set_message(). This function stores the info I need until the next page load. Another good alternative during debugging is using naïve prints/echos with the devel module's option to interrupt redirects (ie. Stop drupal_goto from acting immediately). This is a helpful option when printing out stack traces or arrays. I find it irritating to have to click through a lot of pages that I'm not debugging, however. Finally, on a more personal note: I know it can be frustrating not to immediately get the support you need. I think you will find however, that people on this list, and in the support forums, are willing to help, and help a lot. As a relative newby I've had my share of unanswered questions, but I find that I can usually get the answer I need by revisiting and rephrasing the issue. Cheers, -Mark
Sheryl (Permutations Software) wrote:
I still have many other problems, however. Drupal calls databases and functions at unpredictable times. I can't tell what's going on and there is no documentation.
And earlier Sheryl wrote: "Thanks for the watchdog tip... I don't know where common.inc is used or when it would "be available". I'm a strong PHP programmer, but not very familiar with Drupal's architecture." There is lots of documentation available, but I think the problem is that there is no easy to find documentation on the general control flow and architecture of Drupal. There is this starting point for developer-level documentation: http://drupal.org/contributors-guide But if you don't know that common.inc is included on every single page, and used all the time, then you clearly don't know how control flows through Drupal. Likewise, calls to databases and functions. The following link should help with getting a general overview: http://drupal.org/node/10858 This page is admittedly not in the most obvious place to find it. You can build your own understanding, however, by starting in /index.php, where all pages start, and just walking through all the calls made to generate just one page. Drupal makes very extensive use of what it calls "hooks." ..chrisxj
Sheryl, I was in the same situation as you not long ago. So I traced the flow of execution through and documented it as I went. A Drupal greybeard helped me clean it up some, and here's the result: http://drupal.org/node/10858 This was for cvs shortly before the 4.5 release. Perhaps you can do the same for the current release. Now that I have a grey beard of my own, I'd be happy to comment on your writeup.
Thank you!!!! This looks very helpful. -----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org] On Behalf Of John VanDyk Sent: Sunday, December 18, 2005 6:22 PM To: development@drupal.org Subject: Re: [development] authentication hooks - PLEASE HELP Sheryl, I was in the same situation as you not long ago. So I traced the flow of execution through and documented it as I went. A Drupal greybeard helped me clean it up some, and here's the result: http://drupal.org/node/10858 This was for cvs shortly before the 4.5 release. Perhaps you can do the same for the current release. Now that I have a grey beard of my own, I'd be happy to comment on your writeup.
But if you don't know that common.inc is included on every single page, and
used all the time, then you clearly don't know how control flows through Drupal. Likewise, calls to databases and functions. That's very true. I spent about 5 hours reading docs, got very frustrated, and tried just jumping in. I was able to write a straight PHP theme with a variation and have a pretty good handle on that much. I also have a basic understanding of how the hooks work. But I don't know the overall flow.
The following link should help with getting a general overview: http://drupal.org/node/10858
Thank you - I'll take a look!
You can build your own understanding, however, by starting in /index.php, where all pages start, and just walking through all the calls made to generate just one page. Drupal makes very extensive use of what it calls "hooks."
That's a good idea - I'll try that. I started to look at the code but it was so convoluted I couldn't follow it. I'll try again. Must leave - have to drive 300 miles tonight....
participants (14)
-
andrew morton -
Bèr Kessels -
Chris Johnson -
Dan Robinson -
Earl Miles -
Gabor Hojtsy -
John VanDyk -
Khalid B -
Larry Garfield -
Mark Fredrickson -
Nedjo Rogers -
puregin -
Robert Douglass -
Sheryl (Permutations Software)