News module: howto show author's name?
-
numer9
News module: howto show author's name?
Hey,
in news module, i want to show author-of-the-article name or alias. There is an option during adding new user to give firstname and lastname, how can I reach it from the news template?
I want to modify $entry->author so that i'll reach the real name, not the login name...
maybe i'm just blind, but been searching for the answer for so long and nothing - maybe someone will help me?
in news module, i want to show author-of-the-article name or alias. There is an option during adding new user to give firstname and lastname, how can I reach it from the news template?
I want to modify $entry->author so that i'll reach the real name, not the login name...
maybe i'm just blind, but been searching for the answer for so long and nothing - maybe someone will help me?
-
cyberman
Re: News module: howto show author's name?
Have you tried $entry->authorname ? (seen in News 2.1 help)numer9 wrote: I want to modify $entry->author so that i'll reach the real name, not the login name...
-
numer9
Re: News module: howto show author's name?
big thanks man. I was pretty sure I checked all possibilities, but what i did it was $entry->authorsname, with "s" in the middle
and maybe there a chance to divide between first and last name?
and another one - is there a chance to easily modify the author? I mean - if someone added the news-article, but I want to show another author (another cms ms user of course). And I don't want to go into the core database (that's the way i'm doing it right now), is there a way to do it "smoothly"?
thanks again!
Last edited by numer9 on Mon Sep 11, 2006 10:28 pm, edited 1 time in total.
-
cyberman
Re: News module: howto show author's name?
For this you have to modify source of action.default.php. Go to line 128numer9 wrote: maybe there a chance to divide between first and last name?![]()
and change it to$onerow->authorname = $row['first_name'].' '.$row['last_name'];
Code: Select all
$onerow->authorfirst = $row['first_name'];
$onerow->authorlast = $row['last_name'];Code: Select all
Posted by: {$entry->authorfirst} {$entry->authorlast}I think for this action.editarticle.php must be modified. I'm trying something - please wait for my reply.and another one - is there a chance to easily modify the author?
Last edited by cyberman on Tue Sep 12, 2006 1:06 pm, edited 1 time in total.
Re: News module: howto show author's name?
Tried to find smarty function for this but it seems there is only one which would be suitable, and this is more of a hack 
and untested
from http://smarty.php.net/manual/en/languag ... eplace.php
{$entry->authorname|regex_replace:"/ .*/":""} would print first name and
{$entry->authorname|regex_replace:"/.* /":""} would print last name IF there is a space between the names
the power of regexp
and untested
from http://smarty.php.net/manual/en/languag ... eplace.php
{$entry->authorname|regex_replace:"/ .*/":""} would print first name and
{$entry->authorname|regex_replace:"/.* /":""} would print last name IF there is a space between the names
the power of regexp
-
numer9
Re: News module: howto show author's name?
now I know almost everything about this feature 
big thanks for now (waiting for more, of course
)

big thanks for now (waiting for more, of course
Last edited by numer9 on Wed Sep 13, 2006 9:27 am, edited 1 time in total.
-
cyberman
Re: News module: howto show author's name?
Have submitted my hack for changing news author herenumer9 wrote: big thanks for now (waiting for more, of course)
http://dev.cmsmadesimple.org/tracker/in ... 8&atid=111
-
numer9
Re: News module: howto show author's name?
Ok, thanks for getting involved 
one more question - won't uninstall-and-install news module remove all the current news? Cause my problems is about "live" site, so i can't afford loosing all the news. In first spare moment i'll do a backup and try it on backup copy, but maybe you've tested it already?
thanks!
one more question - won't uninstall-and-install news module remove all the current news? Cause my problems is about "live" site, so i can't afford loosing all the news. In first spare moment i'll do a backup and try it on backup copy, but maybe you've tested it already?
thanks!
-
cyberman
Re: News module: howto show author's name?
Yes, all news will be removed. Please look once again to my hack, have added forgotten files for an upgrade
...
But a backup is a very good idea every time before upgrading.
But a backup is a very good idea every time before upgrading.
-
numer9
Re: News module: howto show author's name?
Yap, backup is definetly good thing before doing anything on "live organism"
But it takes some time. Especially in this case - i don't have a shell account, it's just ftp access to the files and phpMyAdmin to SQL... so downloading, then uploading to test env, upgrading, uploading again... and there goes another hour of work 
and thanks for the patch. In first spare moment I'll try that and keep you informed about it
and thanks for the patch. In first spare moment I'll try that and keep you informed about it
-
numer9
Re: News module: howto show author's name?
BTW - i got another one... i want to show photo in summary (small) and i want it to be bigger in content... is there any support for automatic photo embedding in News? I mean i know i can insert img src... tag inside the summary and content, but that's not the good solution, since the small photo will show up also in detailed template look...
i hope i'm clear
i hope i'm clear
-
cyberman
Re: News module: howto show author's name?
IMHO small photo will not show up if you use different templates for summary and details view ...numer9 wrote: I mean i know i can insert img src... tag inside the summary and content, but that's not the good solution, since the small photo will show up also in detailed template look...
Last edited by cyberman on Fri Sep 29, 2006 12:52 pm, edited 1 time in total.
Re: News module: howto show author's name?
If it does you can make it go away with CSS...
#NewsPostDetailSummary img {display: none}
#NewsPostDetailSummary img {display: none}


