When the user signup option: "New user registration by invitation only" is active, a user who opens the "accept" link and then saves his newly created profile gets the message "A welcome message with further instructions has been sent to your e-mail address. Sorry, new user registration by invitation only." The account is created successfully, however, the "Sorry, new user registration by invitation only" part is potentially confusing.

Comments

glekli’s picture

I have not been able to reproduce this. Is there any chance you are using a module that redirects after registration, or custom paths? Do you see this double message right after you click on 'Create new account'? What is the path and page content when you see it?

heix’s picture

You are right. I was not able to reproduce this on a freshly installed system (plain vanilla drupal + invite (+ token)). However, on my sandbox it still persists.

The double message appears right after clicking on "Create new account". The path where the double message appears is the main page of my sandbox (http:///). I'm using the module "front_page" to display a custom front page for unauthenticated users. There is also a static home page with the alias /home.

On the fresh install, I wasn't able to trigger the double message after I installed and configured front_page and the static home page. Another candiate module is user_register_notify, but even after installing it on the fresh system I couldn't reproduce the error. I ended up installing on the fresh install step-by-step all modules that are on the sandbox, but still no luck in reproducing the double message. On the fresh install, the modules are not all fully configured, so maybe it's got to do with some configurations.

On the sandbox I disabled all non-core modules except invite and token. The double message still persists.

Do you have any suggestion what else to check/how to gather more useful information? I have full access to the server.

glekli’s picture

Wow, this is a mystery.
On the registration page that has the "Create new account" button, do you have a link to the registration page (a link to itself, basically) or any link that has the word 'register' in the target path? Maybe a login block that shows on the registration page or a menu link?

heix’s picture

The tab "Create new account" has a link to itself. Apart from that there is the login form with action="/user/register". There was the default login block, which contained the "Create new account" link, which I disabled. Still the message appears.

(As a side note: when choosing "New user registration by invitation only", the"Create new account" link in the standard login block should dissapear. Do you want me to open a separate issue for this?)

To get some further insight, I inserted a

drupal_set_message("empty(invite): " . empty($invite));

into line 268 of function invite_user_register_access() in invite.module, and changed the "Sorry, new user ..." a few lines below to

drupal_set_message(t('Sorry, new user registration by invitation only.') . " empty(invite): " . empty($invite) . " invite_validate($invite): " . invite_validate($invite) . " INVITE_VALID: " . INVITE_VALID);

This is what I get on the freshly installed system upon clicking "Create account" (as expected):

  • empty(invite):
  • Uma mensagem de boas-vindas com instruções foi enviada para o seu endereço de e-mail. (pt-br for "A welcome message with instructions was sent to your e-mail address.")

On the already existing sandbox I get this:

  • empty(invite):
  • Uma mensagem de boas-vindas com instruções foi enviada para o seu endereço de e-mail.
  • empty(invite): 1
  • Sorry, new user registration by invitation only. empty(invite): 1 invite_validate(): 2 INVITE_VALID: 1

So it seems that invite_user_register_access() is called again.

As a parentheses: I tried the same on a fresh copy of the production system, and there it happens, too. So unfortunately I can't blame it on a messed up sandbox installation ;(

glekli’s picture

Okay, how about this:
- On the page where you see the stray 'Sorry, new user...' message, can you try reloading the page? Does the message stay or go away?
- Can you do a drupal_set_message($_GET['q']) on that page and report back what you see?

The login block issue has already been fixed in dev. Thanks for reporting.

heix’s picture

When reloading (F5), the message goes away.

The drupal_set_message($_GET['q']) on the page where I see "Sorry, new ..." gives me "user/register".

glekli’s picture

So the page you are redirected to after submitting the registration form is 'user/register', that is the same registration page? That would explain the message, because this is where it should appear.
Anyway, I will come up with an alternative way to notify the user of the registration page not being accessible to them. Setting a message in the access callback is not a good idea to begin with.

heix’s picture

Well, actually where I finally land is the home page (http:/// -- nothing after the final slash). But in between there seem to be one/more callbacks. I'm not sure if this helps, but I inserted a "drupal_set_message("echo") as the first line of function invite_load_from_context()(), and comparing the fresh install to the sandbox, on the sandbox I get one echo more before the the "A welcome message has been sent..." is printed.
Unfortunately I don't know enough drupal to understand how this can happen while the content on the file system seems to be identical (synchronized with svn), and while there are no custom blocks.

glekli’s picture

Status: Active » Fixed

I removed the message for now. There should be no links to the register page if the user does not have access to it in the first place. We will see if there is any use-case where the user can land on the register page even though it is unaccessible to them.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.