I hope someone can help me with this, as I am still very new to Drupal and don't know how to proceed. I have used the Display Suite, Node Comments, and Read More Link modules to construct the teaser and full-node builds of my story node. I am pleased with the results, except for the Author and Post Date information. Below you can see what the teaser looks like and bellow that you can see what I want.
Story Title
Admin
08/05/2010 - 21:40
Story Body Story Body Story Body Story Body Story Body Story Body Story Body
Story Body Story Body Story Body Story Body Story Body Story Body ... read more »
* 1 comment
Story Title
Submitted by Admin on Thursday, August 5, 2010:
Story Body Story Body Story Body Story Body Story Body Story Body Story Body
Story Body Story Body Story Body Story Body Story Body Story Body ... read more »
* 1 comment
To that end, I installed the Submitted By module, but the text and tokens that I entered into the "story" content type do not replace the Author and Post Date, as I had hoped. (And, in fact, I have never seen this line "Submitted by, etc." in any of my test postings, although my global theme settings should have enabled that line to appear in the "story" content type..)
Here is what the HTML looks like:
<div class="box-content clear-block">
<div class="buildmode-teaser">
<div class="node node-type-story clear-block">
<div class="nd-region-middle-wrapper nd-no-sidebars" ><div class="nd-region-middle"><div class="field field-title"><h1><a href="/node/6">Story Title</a></h1></div><div class="field field-author">Admin</div><div class="field field-post-date">08/05/2010 - 21:40</div><div class="field field-body"><p>Story body, etc.<span class="read-more"><a href="/node/6" title="Read the whole post" rel="nofollow"><strong>... read more »</strong></a></span></p>
</div><div class="field field-links"><ul class="links inline"><li class="comment_comments first last"><a href="/node/6#comments" title="Jump to the first comment of this posting.">1 comment</a></li></ul></div></div></div> </div> <!-- /node -->
</div> <!-- /buildmode -->
</div>
QUESTION: How do I change this? I do not see any way to change this in Display Suite and I (don't yet) have any PHP skills. I appreciate all help - thanks!
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | 875802-ds-submitted_by_override.patch | 1.47 KB | pfrenssen |
| #9 | 875802-9-ds-submitted_by_line.patch | 3.2 KB | pfrenssen |
Comments
Comment #1
finnishtango commentedIt appears that Display Suite was preventing the "Submitted by" line from being displayed. I was able to accomplish what I wanted by not using Display Suite.
Comment #4
pfrenssenI needed this today and I could not find how to display a proper submitted by-line using DS. There are the 'Author' and 'Post Date' fields but these don't really cut it. In core the submitted by-line is generated in template_preprocess_node(), so this is not available as a field in DS.
I ended up creating a custom field, with a bit of help from the Date module:
Wouldn't it be a good idea to provide this too in DS? We are already providing custom fields for other node metadata such as the node title, 'read more'-link etc. It would be a nice addition, especially if some degree of customization would be provided.
Comment #5
swentel commentedmakes sense yeah, but I don't want to depend on the date module for this one :)
Comment #6
pfrenssenNo of course not ;) This was just something I bashed out quickly to meet a client request. I'll make a more fitting implementation.
Comment #7
alexweber commented@pfrenssen any progress on this?
I recently had the exact same problem and ended up creating a custom code field in DS which solved it for me but it just feels hacky.
Comment #8
pfrenssenOuch I should not make false promises :) I have actually not done any further work on this, but thanks for putting it on my radar again.
Comment #9
pfrenssenHere's a patch. It adds a "Submitted By" field which supports standard date formats + a "time ago" format which is the default. I added a test as well.
Note: the 'Node Display' test throws a warning on PHP 5.4 atm, but this is due to a bug in core: #1525176: Using array_diff_assoc() for multilevel arrays in DrupalDefaultEntityController->cacheGet().
Comment #10
swentel commentedtagging
Comment #11
swentel commentedThanks fixed!
Comment #13
murrayw commentedI have reopened this ticket because I believe the accepted patch introduces a problem.
Creating the submitted_by field in DS clobbers the settings made using the submitted_my module.
http://drupal.org/project/submitted_by
Take a look at submitted_by_field_extra_fields().
For me the bug manifests itself as:
- the incorrect formatter displaying in the display view modes. ie. DS field has taken over
- a missing submitted by field when rendered.
When I comment out the patch, I get my old submitted_by field back.
I'm not sure what the best way forward is with this, given that the new DS field will be in use. I would suggest that the submitted_by module should have priority :) Maybe this new field could be renamed. Or even better, removed. The submitted_by module is already performing this task in a more flexible way as it allows the use of tokens.
Comment #14
pfrenssenThat's unfortunate. Indeed if people have the Submitted By module enabled it is obvious that they would like this to manage their submitted by-lines.
There is a difference in implementation. DS is using its own pseudo-field system, while Submitted By adds a regular Field API field using
hook_field_extra_fields(). We could check whether the 'submitted_by' field exists, but I think it is maybe cleaner to just skip our code when the Submitted By-module is enabled.Comment #15
pfrenssenHere's a patch. Can you check if this solves your problem?
Comment #16
murrayw commentedThanks! That patch works for me. Nice solution.
Comment #17
swentel commentedAlright, committed and pushed, thanks!
Comment #18
swentel commentedMoving to 8.x though
Comment #19
swentel commentedPorted (as in, changed the machine name to ds_submitted_by)
Comment #20
Colin @ PCMarket commentedThough this patch fixes the submitted by byline text problem with DS on the node itself it seems that the problem still exists when using DS in the node comments as my byline text in comments seems to be ignored.
Comment #21
samwillc commentedI'm getting same type of problem. I cannot override the submitted by line in my template.php when I add this field via DS. If I add the same field to the node and don't use DS, my changes are respected.