By jim0203 on
I want to add a drop down list ("list selection" in Drupal parlance) to user profiles on my site. This is easily done, but I have to hard-code the options which are to be available in the drop down list. What I want, instead, is for these options to be provided by a view. Is there some PHP code I can insert into the "Selection options" box that will do this?
Comments
are you using the core
are you using the core profile module or content_profile?
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
I'm using the core profile
I'm using the core profile module in D6. I had a look at content_profile but it didn't seem to let me create the extra profile bits at the same time as I created the regular user profile, which I found frustrating - my site's users will be created by an administrator so I want to keep her workload down.
Because of this I switched back to the regular profile module. Do you reckon there's a way I can get it to add the list of users to a drop-down menu? Or is there another way I can achieve what I want to do?
There probably is with some
There probably is with some sort of hook_form_alter, but honestly I have no clue. With content_profile you could use a nodeference field.
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
Thanks for that - can anyone
Thanks for that - can anyone offer any advice on how to implement hook_form_alter? I've never used it - my theming experience runs as far as editing .tpl.php files and .css files.
I know that I could use content_profile but I don't really want to; it seems that I have to be logged in as a user to create a node-like profile for that user, when on my site user profiles will be created by admins only. And I want to keep their work down to a minimum, so ideally I don't want them to have to create a profile in addition to creating the standard user page.
it seems that I have to be
I don't believe so.
afaik, the whole point of content profile, instead of just using a content type, is to integrate the two.
you should use whatever works for you, but if those are you only concerns, i don't think it would be a problem.
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
Hey. Firstly, thanks for
Hey.
Firstly, thanks for your help on this and on the other thread where I'm asking a similar question.
I've done a dry run on a clean D6 test site just to check things out. Here's what I did:
Setup clean D6 installation
Installed content_profile (and admin_menu, just to make navigation easier)
Created a node of type="Profile" (i.e., content type created by content_profile.module). This appeared on my userpage (username="admin").
Created a user, username="user1". Doesn't give me any other options on the "create user" form than I would have without content_profile.
Created content of type="Profile". Changed author to "user1", and it worked fine.
This is great, but it's just the UI that's a little too clunky. I want to keep the workflow as simple as possible. Ideally this would mean that the extra fields made available by content_profile would appear on the standard "create user account" form. I'm going to check out http://drupal.org/node/236467 later on and will report back.
What I don't want my site's users to have to do is to mess about changing authoring information when they create user profiles. I'd be satisfied if there was same way of setting up the site so that whenever a fresh user was created, the site jumped to a "create user profile" page with the new user already entered as the profile's author. That would be pretty smooth.
OK, I've check out the
OK, I've check out the "takeover" patch and it seems that all it does is change how user profiles are displayed: they still have to be submitted separately to user accounts.
It also still seems to me that content_profile.module doesn't really want to let me create user profiles for other users. I can force it by changing the Authoring Options, but it seems to be designed to let users create their own profiles - and this won't solve my problem.
That's a shame-- what you're
That's a shame-- what you're looking for seems to be perfectly reasonable, and in fact, was my understanding of how content_profile would work. It seems you're right though-- either the planned functionality has changed, or there's still a ways to go. Unfortunately, I'm not sure what the right answer is for you at this point. You could set up a rule that automatically redirects to the user profile creation page upon creation of a new user. It still looks like a two step process, but at least it's automated.
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
I've posted a support
I've posted a support request on the rules.module forum: http://drupal.org/node/330146. I've mentioned it on the friendlist.module board as well: http://drupal.org/node/329238.
Another related post
I might end up writing a module for this, as I think it would be useful functionality. I'm putting some feelers out here: http://drupal.org/node/330226
I've now created a custom
I've now created a custom module which adds a drop-down box to the user account creation form. This drop-down box is populated with users of a certain type, rather than from the output of a view, but this can easily be changed if you're happy to hack the code.
Anyone who wants the code should contact me for the latest version.