I’m looking for a Drupal module (published on drupal.org), for 7 or 8.

  • When a guest creates a node, show a secret URL.
  • When visiting the secret URL, that node can be edited.
  • When editing the node, offer a way to create an account. Then that node should belong to the new user.

I think there is something tricky in your question. I.e. the "key" to be allowed to edit such node (with a secret URL), is to just guess that URL. That's like a security similar to "you name it (the secret), you got it (do whatever edits you want to apply to that node)" ... Better make the length of such secret URL looooooong enough (just long may not be sufficient). Anyway, that's what you want it seems ...

Part 1: Generate a random string

There is a (sandbox) module for it, which is the Rules generate string module. Here is a quote about it (from the linked page):

A simple rule to generate a random string, given optional parameters of length and character set.

Original motivation to use in Rules-based URL shortener per specification of mitchell. (If looking to create a URL shortener for external links, an alternative non-rules approach is the dedicated module Shurly.)

Either you just use that module, or you look at its source code to understand what it takes to include this logic in your own (custom) module.

With that, all that's needed is to create a custom rule (using the Rules generate string module), which you can do like so like so:

  • Rules Event: use whatever event that fits your requirements (eg: After saving a new node, optionally limited to selected Content Types only).
  • Rules Condition: "User has role", to check if it's an anonymous user.
  • Rules Action: Use the action provided by this module.

BTW: "sandbox" modules are also "published" on drupal.org, right?

Part 2: Rules is your friend

Using the Rules module, it is, IMO, possible to address the first 2 requirements in your question (the 3rd one is a different animal, which would probably require additional modules specialized in those things). BTW, Rules is a prerequisite module (dependency) for the module in Part 1 anyway.

If you wonder how to create the appropriate rules (1 won't be sufficient ...), then I suggest you post a followup question about that at drupal.SE (which is where IMO such followup question would belong).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.