1842 Posts in 1600 Topics by 558 members
Page: 1 2
|Go to End||Next >|
17 March 2011 at 12:13am
Been a while since I have posted, but I am having an issue with the Blog module. Basically, when I try and add a Blog Entry in the CMS, the Author field is not pre-populated and has to be manually updated each post.
Is it possible to get this to be pre-populated? Looking at the code it looks like it is supposed to be.
If that fails, is there is a way of removing it, and instead relying on the Author assigned in sitetree_versions?
Cheers in advance,
17 March 2011 at 2:57am Last edited: 17 March 2011 3:01am
That’s easy. In your mysite\_config.php, add:
BlogEntry::$defaults = array('
Author' => 'Your Default Author',
'ProvideComments' => true,
'ShowInMenus' => false
Hope it helps,
17 March 2011 at 3:07am
Thanks for the reply. I didn't know you could alter defaults like that.
Trouble is though that there will be more than one person posting blog stories through the CMS and I would like to detect who they are and fill in the field dynamically.
The funny thing is the front end form does this, but this does not let you attach images or links in the WYSIWYG editor, so it is not really ideal.
Cheers for the help so far!
17 March 2011 at 3:34am
I didn't know you could alter defaults like that.
Me neither, I have just discovered it!
It’s really strange… I’ve done some debugging and it seems that you cannot add a default value to that "Author" TextField through getCMSFields(). Just try adding a test TextField with a random default value or the $firstName of the current user, and you’ll see it works.
Maybe you have found a bug…
17 March 2011 at 3:36am
By the way, maybe Member::currentUser()->FirstName works in the context of the _config.php file…
17 March 2011 at 3:42am
Nope, config.php is called to soon and so is unable to get info from the database .
I have also tried replacing the Author field in getCMSFields (as you have) and have had similar results. It is quite a head scratcher!!
17 March 2011 at 3:56am
I have even tried removing and re-adding the field using an extension of DataObjectDecorator, it still appears empty.
This is very odd!
Anyone have any ideas? Is this a bug?
27 June 2011 at 5:08am
Mo, did you ever get this figured out? I tried decorating the BlogEntry class to has_one Member, but mostly made a royal mess of everything.
Love to hear if you found a solution.
Page: 1 2
|Go to Top||Next >|