b2evo: author links to website instead of user page

by prettyscripts on 2010-03-09 11:47:00

phpb2evolution

in the skin, the function call to show author of a post is $Item->author(). by default it links to user page. i wanted to link to user's website. there aren't much information on how to use this function and the doc is outdated.

source code is always the best documentation. the function is defined in inc/items/models/_item.class.php. it seems these are new array parameters introduced in V3.

one of which is link_to. the default is userpage. another available option is userurl - this is what you want.

depends on the skins, locate any files that calls $Item->author() and add 'link_to':

PHP:

$Item->author(array(
    ..... // whatever the current skin uses
    'link_to'  => 'userurl'// add this
));

the author text now links to website, if defined in user setting in backoffice.

just for references, the default parameters and values:

PHP:

array(
    'before'       => ' ',
    'after'        => ' ',
    'format'       => 'htmlbody',
    'link_to'      => 'userpage',
    'link_text'    => 'preferredname',
    'link_rel'     => ''// eg nofollow
    'link_class'   => '',
    'thumb_size'   => 'crop-32x32',
    'thumb_class'  => '',
);

extra security

create _user.disp.php in the skin and edit accordingly.

Tags: author, b2evo, link, skin

No feedback yet

Leave a comment


Your email address will not be revealed on this site.
PoorExcellent
note: all comments are moderated. do not spam and do not advertise. only comments relevant to the post will be published.
(Line breaks become <br />)
(For my next comment on this site)
(Allow users to contact me through a message form -- Your email will not be revealed!)