the block is shown on a site different from user or user/login.
Error message is:
•Notice: Undefined index: user_pass in drupal_retrieve_form() (line 736 of D:\xampp\htdocs\d7\includes\form.inc).
•Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'user_pass' not found or invalid function name in drupal_retrieve_form() (line 771 of D:\xampp\htdocs\d7\includes\form.inc).
To reproduce put the following code in a new block:
global $user;
if ($user->uid) {
//User is logged-in
return "The Register/Login/ResetPassword block is only visible for anonymous users.";
} else {
print drupal_render(drupal_get_form('user_register_form'));
print drupal_render(drupal_get_form('user_login'));
print drupal_render(drupal_get_form('user_pass'));
}
Comments
Comment #1
Nikdilis commented... or user/password (of course ;-) )
Comment #2
droplet commentedthe function located at user.pages, you require to add this
leave mature developer to decide if we need to improve or not .
Comment #3
berdirI think this is by design.
As droplet pointed out, if you use a form defined in a file other than .module, you need to include it yourself.
Comment #4
Nikdilis commented@droplet: Thank you.
Berdir, is it user friendly to leave it like that? A normal user of Drupal like myself might wonder why the error shows up.
She/He expects to be able to render any form with the drupal_render(drupal_get_form) function.
At least it needs documentation in my point of view.
Comment #5
berdirWell, that's nothing new, many forms, for example node_form, were already moved to .pages.inc files in D6.
As I said above, when you use a form, you need to check where it is and include the file if necessary. Not sure where that should be documented.
Comment #6
amfriedman commentedThis is unexpected, inconsistent behavior -- a "gotcha" -- given that you can output the login and registration forms just fine without including any additional file. I don't think this issue should be closed.
Comment #7
reign85 commentedSubscribe, get thes same problem since updated the core to 7.23
Comment #8
JimoftheSlowclick commentedI agree with you on this. Just did exactly as you described.
Comment #9
JimoftheSlowclick commentedI just did exactly this, so I argue you're correct.
Comment #10
taggartj commentedthis may help some one :
Comment #11
Abhishek Verma commentedThanks @droplet
Comment #12
Kumar Kundan commentedThanks @droplet