Recent Topics

1 Dec 14, 2007 05:45    

This one drove me bonkers:

In current HEAD, file _comment.class.php, line 297 in function get_author_name, the correct code should be:

return $this->author_User->get_preferred_name();

Currently exists is:

return $this->author_User->preferred_name( 'raw', false );


That incorrect code uses an echo which screws up the return value in the function, and drives people nuts when they can't figure out why functions are printing their return values instead of returning them ;).

(just in case it's not clear, get_author_name should only return a value and not echo anything. Current behavior echos stuff and doesn't return anything due to the wrong function call).

2 Dec 18, 2007 17:19

I don't doubt for a minute that your offered solution is an effective one, but there may be another way to reach your goal. UNTESTED, but try using "->nickname" where you want the author's preferred name but do not want it to echo.

The functions are set up to echo - as you've found. In many cases you can do away with the function call (the () bit at the end ya?) and get the variable, but "preferred name" is not something saved in the database. In the database the user's preferred name is saved as 'nickname'.

UNTESTED, but hopefully this will - at least - provide a new way for you to think about how stuff works in b2evolution.

3 Jan 03, 2008 20:49

That'd probably do the trick, too, but I offered this as a bug report because the convention whereby get_xxx doesn't echo; that it should return a string instead. If you look at the code, it's actually trying to return a string, but the incorrect function call outputs HTML instead.

A quick glance at the other get_xxx methods seems to indicate that they're okay, but I've not tested them.

4 Jan 03, 2008 23:48

The problem is that the false part of the statement is being ignored ( it's meant to tell the function to suppress output ).

I thought I'd fixed this once in CVS but obviously not ;)

¥


Form is loading...