p.s. sorry for the double post but i wasn't sure which forum to post this in and i'm in a bit of a bind.

I'm a relative Drupal newbie and I'm having a hard time wrapping my head around how things get done with Drupal, in particular CCK. We have a node set up where contributors can write article drafts that go into a queue for editing and approval. Once approved the article gets assigned a "published" content type and it is ready to be seen by users who have been set up with a "subscriber" role.

However the one caveat is that some content has the option of being "exclusive" to a specific subscriber group, and as such should only be visible to those subscribers during a specific timeframe. After this timeframe expires the content then becomes available to all subscribers.

I tried utilizing the DATE functions within CCK, however there doesn't appear to be any obvious way of requiring the from and to dates ONLY if the author has checked off that it's exclusive.

So the way I envision it is that there would be a checkbox: Is this exlusuve?

If checked then a select menu would appear and the user would have to select one of the predefined clients (user's with roles set to subscriber). Is there any way in CCK to create this dynamic menu or does it need to be hard coded? would this be a nodereference or is there an existing CCK module to generate a menu based on specific user accounts/roles/profiles, etc?

If both of these are selected and valid, I'd like then for there to be a required field for FROM and TO date.

So in other words, if the user clicks the checkbox that it's exclusive, then the menu to select a subscriber as well as the FROM and TO dates should be required. (This is currently not the case).

Likewise if a user specifies that the content is NOT exclusive, then the subscriber and dates should not be required.

Any idea how I might go about doing this? Is something this simple (IMHO) too complicated for CCK? Would I be better off writing a new module from scratch?

I've been developing with PHP/MySQL for 6-7 years so outside of Drupal I'd have no problem whipping this into shape in no time. However I'm having a hard time learning the Drupal way, especially when my deadline is yesterday.

Many, many thanks in advance!

brian

Comments

Jeff Burnz’s picture

I'm thinking you will have to code a lot of this yourself.

For starters, there is no out of the box way of generating dynamic menus in CCK afaik.

I suggest taking a look at the jquery lib and a module called Active select (http://drupal.org/project/activeselect), you may get some milage out of those.

I think you could use node or user reference to some extent, but not having used those much myself I cant honestly say how useful they will be.

Agreed, what you're asking for is fairly simple, but beyond the scope of CCK out of the box.

briantullydelete’s picture

jm -

thanks so much for your quick response and for your helpful recommendations. I'll definitely check those out. Many thanks for easing some of my Drupal anxieties! :)

the part I'm not clear on, and hopefully you can shed some light, is that if we're using CCK for content types, how would I go about coding the parts myself, i.e., would I be developing a new module outside of CCK (and therefore perhaps losing some of CCK's benefits) or is there a way to use CCK and add additional code such as the requiring of fields based on other field values and validation, etc. Otherwise I've looked at the node.module and see that there are the core fields listed throughout. Do people usually make a copy of this module and hack it up so that it suits their needs and rename it? Again, just trying to figure out how people get things done in Drupal when the core node type doesn't suit their needs (which I'm guessing must be a large percentage?).

It's amazing actually. I was so happy to hear that we would be using Drupal as our underlying framework for development, especially given its open source nature and the established user community. However it's only now that I'm realizing that I have so much to learn when it comes to how Drupal does things, even simple things.

thanks again!
brian

Jeff Burnz’s picture

To be frank this is not exactly my area of expertise, in any case however, whether you choose to build your own node type module, or via cck, you'll need to read up on the Form API.

My initial feeling would be to build a small helper module for your CCK type. Sorry i cant be more help, this is rather outside my knowledge zone you might say (I'm really a designer.. gasp!), and I'm darn sure theres some really smart people who could give you some great advice, hopefully one of them comes along soon and bails me out:)

sampeckham’s picture

Been looking for the same thing and Google pulled this old thread up.

So for future reference I think this module will do it: http://drupal.org/project/conditional_fields