-1

I'm trying to come up with a workflow using Rules that would enable a visitor to register + create a node (e.g. article) in one go, before the account is approved by an admin.

Details:

  • Visitors can create account, but administrator approval is required
  • anonymous users cannot create content
  • currently using the After saving a new profile event
  • when visitors click on 'Create new account' they are redirected to node/add/article
  • the created article would be saved as 'unpublished'
  • when account is approved, the article would automatically be published

I'm having problems creating the article. The redirect doesn't work. I instead get the usual 'account pending instructions sent' message.

2 Answers 2

4

I would approach this by adding the Logintoboggan module, which integrates with Rules via a submodule.

Logintoboggan will allow you to assign users a special role before their account is verified. Normally, this verification is performed by the users themselves via e-mail, but you could stop that e-mail from being sent and instead have the admin do the verification.

With this approach, you can give users with the Unverified role (awarded upon registration with Logintoboggan) the permission to create content of type Article and then add rules to publish such articles upon verifying the account (Logintoboggan provides a User account is verified event).

4
  • I would usually approach this with custom code in a custom module but your approach is very interesting nonetheless. Worth an upboat! ;) Thanks for sharing. Apr 25, 2013 at 15:37
  • Sure, custom code is another way to go about it, and cleaner if you're comfortable with code. Logintoboggan is nice because it allows you to write all sorts of rules for users who have not been confirmed yet without touching any code directly. Apr 25, 2013 at 15:41
  • Thanks guys. I'm now wondering if, as a lightweight solution, I can use Rules to assign an Unverified role (which has create article permission) and then properly redirect the user to the node/add/article page... I'll give it a try.
    – Bisonbleu
    Apr 25, 2013 at 22:17
  • Unable to set Rules properly - don't have enough time to experiment right now. Logintoboggan quickly works out-of-the-box and in addition provides some very useful features. Definitely a winner. Thanks again.
    – Bisonbleu
    Apr 29, 2013 at 15:43
2

I think you could overide the redirect on the user register form.

Ie:

// This should target only user registration form ...
function YOUR_MODULE_form_user_register_form_alter(&$form, &$form_state, $form_id)
{
    $form['#redirect'] = "node/article/add";
}

Hope this helps. Happy coding!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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