Looking for instructions on how to combine the ease of Bootstrap theming with the non-codey goodness of Display Suite? Try this: it’s a slideshow presentation, geared toward beginners: http://tinyurl.com/bootstrapdisplaysuite
In a previous post, I proposed the idea that asking questions on stackexchange and stackoverflow is a good idea for Faking It Till You Make It (FITYMI). The flip side of that is, of course, answering questions. Since I recently answered a Drupal 7 question on Stack Overflow, I thought I’d share it here.
FITYMI tip: Answer questions on stackoverflow and stackexchange
(I’m paraphrasing here) How do you map Feeds to Organic Groups? Say you have Organic Groups (OG) on your Drupal 7 site, and you want to give each of them their own blog(s). Feeds is great, but it doesn’t allow you to map a reference group (patch time!).
What you do, essentially, is assign all incoming feeds a default value, and then match that value to the one you put in your content type. Having the same field and field value shared among the feed, the content type, and the OG links them together, and makes it possible for you to relate them in Views, etc. I’ll admit this method is a little bit scrappy (as in, not exactly a hack, but not super elegant), but it definitely works!**
1. Install both Feeds and Feeds Tamper.
2. Create a content type to receive the feed entries.
*I’ll call this new content type “Blog post”
3. Add a text field to BOTH the new content type AND to your OG form.
*I’ll call this field “Feed nickname”
4. Fill in the field with the appropriate feed nickname on your OG form.
*I suggest making this a one-word nickname
5. Under Structure>Feeds Importers>Edit>Node processor settings, select “Blog post” as the chosen bundle to receive the feed. Click save.
6. Under Structure>Feeds Importers>Edit>Node processor mapping, add a new mapping with “Blank source” as the source and “Feed nickname” as the target. Click save.
7. Under Structure>Feeds Importers>Tamper, scroll to the section “Blank source-> Feed nickname” and click “add plugin.”
8. Choose the plugin called “Set default value” and set the default value to your chosen feed nickname. Click save and make sure the plugin is enabled. Click save at the bottom of the tamper form.
9. Add the feed importer as usual, under yoursite.org/import
Whew, that was long-winded. Buuut, I hope it helps someone! It took me hours (multiple of them! and many cups of coffee!). Hopefully it will only take you 1 (or less! yay!).
**Notes: I’m assuming you’re working with a Drupal 7 site. I’m assuming you do know how to use Feeds, but that the OG component is what’s confusing you. (For basic instructions on installing and using Feeds, try LevelUpTuts. They have a good series of videos on Feeds of all kinds.) I’m assuming that you don’t want to do any coding. I’m assuming that you’re importing an RSS feed (though it should play well with other types of feeds, too). Also, I haven’t tried it, but I’m assuming this process would work for assigning blogs to individual users, too. You’d just put the Feed nickname field on the user form. Let me know if you try it!
Note: This is for a Drupal 7 install.
This is a wholly random post, and will (probably) not be followed up by anything useful. Basically, I’m posting this both so I don’t forget how I did it, and so it might help someone else.
Context: I was making an event calendar in views, to be used as a block elsewhere on my site. I chose two fields to show on the event calendar – Title and Date. The Title field was all good. The Date field, however contains two parts – the event’s date, and the event’s time. The time I obviously needed. The date, however, was already implied, since, ya know, this is a calendar.
Question: How do I force my date field to show just the time?
Answer: Create a new date format!
It’s a pretty easy, totally point n’ click, and no coding needed!
1) Make a new date format.
- Open a new browser tab (trust me, it’s just easier this way), and go to http://www.yoursitename.com/admin/config/regional/date-time.
- Choose the tab that reads Formats.
Alternatively, you could go directly to http://www.yoursitename.com/admin/config/regional/date-time/formats/add). This will allow you to input a “date format string,” which is basically just a date formatted in PHP language.
- Add the format you want as per the PHP.net’s date format guide.
Note: the string does accept colons. I wanted, for instance, something like 11:26PM, so I wrote g:iA.
2) Make a new date type.
- Navigate back to the Date and time page (www.yoursitename.com/admin/config/regional/date-time) and click Add date type.
- Give it a name – preferably a self-explanatory name.
- Then, under the Date Format dropdown menu, choose the date format you just created above.
- Click the Add date type button beneath. This will take you back (yet again!) to the Date and time page.
- Click Save configuration.
3) Give that views thing another shot.
- Head back over to your view, refresh (save first if you need to!).
- Try modifying the date field again. This time, the dropdown menu, Formatter, will have your new format.
4) Click save.
5) Rejoice. And maybe get some sleep.