Page 1 of 1

CGBlog Module with author being "Firstname Lastname"?

Posted: Wed Nov 25, 2009 6:34 am
by jwaldeck
Guys,

is it possible to include something like this in the CGBlog templates to display the Author First and Last names instead of its username of the CMS? http://forum.cmsmadesimple.org/index.ph ... 720.0.html

Instead of this:

Code: Select all

{if $entry->author}
	<div id="CGBlogPostDetailAuthor">
		[b]{$author_label} {$entry->author}[/b]
	</div>
{/if}
Something like this:

Code: Select all

{if $entry->author}
	<div id="CGBlogPostDetailAuthor">
		[b]{$author_label} {$entry->authorname}[/b]
	</div>
{/if}
But it didn't work like it does in the News module! Any tweak around it?

Tks!

Re: CGBlog Module with author being "Firstname Lastname"?

Posted: Thu Jan 28, 2010 9:24 pm
by jbdough
I have a rude hack that will get you halfway there.
Add two fields to table cms_module_cgblog

cms_module_cgblog
FieldTypeNullDefault
first_namevarchar(255)Yesyour first name
last_namevarchar(255)Yesyour last name



In
modules/CGBlog/action.default.php
and
modules/CGBlog/action.detail.php

add the line 
$onerow->authorname = $row['first_name'].' '.$row['last_name'];
just below
$onerow->author = $row['author'];

Code: Select all

    $onerow->author = $row['author'];
    $onerow->authorname = $row['first_name'].' '.$row['last_name'];
Now you can use "authorname" in your templates.
It still is a kludge - especially if you have other users, but at least you can post blogs without sharing your admin username with the world.

Re: CGBlog Module with author being "Firstname Lastname"?

Posted: Thu Jan 28, 2010 9:52 pm
by Jeff
First, any modification to code makes your code unsupported.

Second, instead of modifying the database just replace the line the stores the username as author with one that sets it as first and last name.

Re: CGBlog Module with author being "Firstname Lastname"?

Posted: Fri Jan 29, 2010 1:42 am
by jbdough
First, any modification to code makes your code unsupported.
I am not suggesting that my workaround is a fix. 
I am not suggesting I know what I am doing either.

I am saying I found one way to un-publish my admin username without throwing a wrench in the gears until I can figure it out.

http://calguy1000.com/blog.html

giveth and taketh away  :-X

Re: CGBlog Module with author being "Firstname Lastname"?

Posted: Fri Jan 29, 2010 4:18 am
by calguy1000
you can make as many crude hacks as you want....

just please:
a) don't share then with others
    - your hacks may not work to begin with
    - your hacks may work for you but not for others
    - your hacks invalidate yours (and anybody that follows them) support
      (because if I find out about it, I'll bill them twice my normal rate for supporting somebodies crude modifications).
  - others may not have the same abilities as you to modify code and make it work

b) don't ask any further questions relating to this module... or perhaps any others
    if you know enough to hack the source to make it perform the way you want... then you know enough to debug any other issues
    you may have as well.

I'm sorry if I sound crass... but it's tiring enough dealing with the people that have honest difficulties, let alone those lead down the wrong path, and gullable enough to follow it.

 

Re: CGBlog Module with author being "Firstname Lastname"?

Posted: Fri Jan 29, 2010 4:35 am
by jbdough
support?

You know what, the code is on my host that I paid for and the code is GPL.

I can do anything I want with it.  Do you think you own my mind?  

The feature request has been dismissed since June 2009.  
A simple honest question in this topic has not been addressed since November 2009.

I think maybe you're crippling some features and adding others to create mysteries only you can solve?

oh blah dee -oh blah dah

oh yeah, and the googlemap on my homepage is perfectly georeferenced on my house, so call in an air strike if the flame war is not working.

You know, I am actually enjoying this, and it would seem as I work on your sacred code, my two extra fields stay out of the way very nicely.

Maybe while I am wallowing in debug mode you can explain
Notice: Undefined index: hidden in /home/who-me/public_html/cmsms/tmp/templates_c/CGBlog^%%AC^ACC^ACC27B38%%module_file_tpl%3ACGBlog%3Barticlelist.tpl.php on line 53

Re: CGBlog Module with author being "Firstname Lastname"?

Posted: Fri Jan 29, 2010 5:22 pm
by Dr.CSS
All they are saying is that if you change any PHP files in a module or core then it makes it real hard to support the product as it isn't always obvious to the one trying to help as to what has been done...

If you do this and post it on the forum and others use it then it is appreciated it you say it is a hack and let it be known in the post that it is a hack and if used it will render the module or core or whatever it is unsupported...

Re: CGBlog Module with author being "Firstname Lastname"?

Posted: Fri Jan 29, 2010 5:28 pm
by tyman00
I had a nice long post written in response but Dr. CSS posted the cliff-notes version just before I hit post, so I'll let that be ;)

One final note. Please don't attack or "flame" here. We don't appreciate it, it isn't tolerated well and eventually ramifications set in. We hate when it goes there, so please don't take it to that point. Thanks!

Re: CGBlog Module with author being "Firstname Lastname"?

Posted: Fri Jan 29, 2010 9:59 pm
by jbdough
ajprog wrote: First, any modification to code makes your code unsupported.
Second, instead of modifying the database just replace the line the stores the username as author with one that sets it as first and last name.
WARNING !!! - THIS IS A HACK * ANY MODIFICATION TO YOUR CODE MAKES YOUR CODE UNSUPPORTED

line 66 in modules/CGBlog/action.admin_addarticle.php

Code: Select all

//  $username = $userobj->username;
$username = $userobj->firstname." ".$userobj->lastname;

Re: CGBlog Module with author being "Firstname Lastname"?

Posted: Fri Jan 29, 2010 10:46 pm
by tyman00
jbdough wrote: WARNING !!! - THIS IS A HACK * ANY MODIFICATION TO YOUR CODE MAKES YOUR CODE UNSUPPORTED
Thank you :)

Re: CGBlog Module with author being "Firstname Lastname"?

Posted: Sat Jan 30, 2010 12:24 am
by jbdough
you are welcome - I do enjoy this and I learned a lot about cmsms on this scavenger hunt, and there is a lot to like about cmsms.

Peace, apologies (where due) and I'll be good.  ;)