Hi there, I'm trying to find a way that I can create content (any content, really, but in this specific case, a classified ad using ED_classified).
Basically, I want to (as an admin) create an Ad for someone, getting their information over the phone. I want to create the ad, and somewhere put down their email address. If that email is associated with an account already, it names the author as the User. If the User doesn't exist, then the system will create that Ad, and create the User. The system then emails them to notify them that their account has been created, and to go online to edit the ad, etc.
Is there any way this can be done?
It seems like it should be so easy, and yet I can't do it :(
Comments
Comment #1
ainigma32 commentedAFAIK you can't do that automatically but manually shouldn't be a problem.
The process would be:
Would that work for you?
- Arie
Comment #2
jack_ruby commentedThat is pretty much exactly what I have to do now.
And it *can* work. It's a bit kludgy though.
What I'd prefer is
The rationale behind making this as quick as possible for the operator is that person will also be doing this live over the radio.
They need to be able to get done and "next caller" as soon as possible, because dead air is bad.
I was really hoping to have this feature implemented by the time the site went live. However, that is the end of the week, so I don't think it'll get done by then.
That's Ok, they can use the workflow you described at first, but the sooner I can get this process automated, the better.
Thanks very much!
JR
Comment #3
jack_ruby commentedOk, I've done some digging, and the code I'm looking at is in the node.module
from line 792-797
Can this code be modified to allow for the creation of users from this interface?
Comment #4
ainigma32 commentedHey anything is possible but I would suggest adding a contributed to the core and not hacking the core.
A contributed module could use hook_form_alter to add an email field to the form where you create the add.
Then after submission the module checks if the user already exists and then assigns the add to that user (and maybe sends and email)
If the user doesn't exist yet, the module calls the email registration module and creates the user, assigns the node and sends a notification.
Better?
- Arie
BTW You really should post things like this on the developers mailing list. The guys over there do this kind of thing for a living (well a lot of them...)
Comment #5
jack_ruby commentedThat sounds like a good idea!
How do I get on this 'mailing list' of which you speak
Comment #6
ainigma32 commentedEt voilà http://drupal.org/mailing-lists
Good luck and please post a little something about your solution here once you figure it out.
- Arie
Comment #7
Prometheus6 commentedIf I were better at Javascript, I'd have UI suggestions for you, but you want an autocompleting text box that looks up users by whatever. You would add
to the FormAPI textfield element definition, something like
in your module_menu() function, and (for example)
The function will return an array, key = The string as is displayed in the text field when selected, value = HTML defining the appearance of the item in the drop down list. The key is what will be returned by the form, so you'll have to embed something in it that you can use to identify the user for processing purposes.
On the processing side, to create a user check out the example from the drupal_execute() documentation (http://api.drupal.org/api/function/drupal_execute/7):
You might want to add
before the drupal_execute() call.
Comment #8
crizThere is an add user action available for the rules module: http://drupal.org/project/rules
Just add a condition that queries if the e-mail is already taken. Then fire the appropriate actions: add user and add as author or just add as author. There is also a token for the generated password, so you can email all relevant account information.
Would be an option I think.
cheers,
criz
Comment #9
ainigma32 commented@jack_ruby: Did you manage to automate this or are you still using the manual approach?
- Arie
Comment #10
jack_ruby commentedActually, I did :)
I hired a php guy to do it for me, though.
He modified the code of the ed_classified ads to do it.
What I think the next step would be is seeing if someone wants to make a module that could do this for all Nodes.
I had someone contact me wanting to help, so I may see if he's interested. I gotta get my site working first.
it's www.bandbswapshop.com
Check it out and let me know what you think. It's not *quite* done yet, but it's nearly there :)
JR
Comment #11
ainigma32 commentedTook a quick look and it looks nice already. A few points though:
<p>doing in the title?Once you get close to opening up for business (if you aren't already) you should post your site in http://drupal.org/forum/25
Good luck!
- Arie
Comment #12
jack_ruby commentedThanks for the advice.
The p tag is there because I wanted the site's motto to be on two lines. I can't figure out how to not show that tag and have it be on two lines in the header
Either the email or the phone number would have to be required. I've struggled with that...
The decision I came to was that we wanted to require email for anonymous users, to reduce spam.
If you are authenticated the email is autopopulated.
If you don't have an email, you probably just need to call it to the radio show :)
The reason for the phone number is so lurkers can call sellers. I should probably make that more clear through instructions
the recent ads on the right is there on all pages. I might drop it from the front... but then I've got blank space on my front page!
I just like really minimalist designs :D
I'll post it up after this weekend. I'll be sitting in on the radio show and entering in people's info, so that should give me a better idea if/what needs to be changed.
thanks 'gain
JR