CGBlog Module with author being "Firstname Lastname"?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
jwaldeck

CGBlog Module with author being "Firstname Lastname"?

Post 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!
jbdough
New Member
New Member
Posts: 9
Joined: Sun Jan 10, 2010 8:28 am

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

Post 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.
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm

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

Post 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.
jbdough
New Member
New Member
Posts: 9
Joined: Sun Jan 10, 2010 8:28 am

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

Post 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
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

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

Post 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.

 
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
jbdough
New Member
New Member
Posts: 9
Joined: Sun Jan 10, 2010 8:28 am

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

Post 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
Last edited by jbdough on Fri Jan 29, 2010 12:02 pm, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

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

Post 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...
tyman00
Power Poster
Power Poster
Posts: 906
Joined: Tue Oct 24, 2006 5:59 pm

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

Post 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!
If all else fails, use a bigger hammer.
M@rtijn wrote: This is a community. This means that we work together and have the same goal (a beautiful CMS), not that we try to put people down and make their (voluntary) job as difficult as can be.
jbdough
New Member
New Member
Posts: 9
Joined: Sun Jan 10, 2010 8:28 am

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

Post 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;
tyman00
Power Poster
Power Poster
Posts: 906
Joined: Tue Oct 24, 2006 5:59 pm

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

Post by tyman00 »

jbdough wrote: WARNING !!! - THIS IS A HACK * ANY MODIFICATION TO YOUR CODE MAKES YOUR CODE UNSUPPORTED
Thank you :)
If all else fails, use a bigger hammer.
M@rtijn wrote: This is a community. This means that we work together and have the same goal (a beautiful CMS), not that we try to put people down and make their (voluntary) job as difficult as can be.
jbdough
New Member
New Member
Posts: 9
Joined: Sun Jan 10, 2010 8:28 am

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

Post 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.  ;)
Locked

Return to “Modules/Add-Ons”