Recent Topics

1 Feb 13, 2010 13:17    

Tilqi generously helped me with this issue on IRC, but I thought I would document it here in case it is a real bug.

I was working on changing some of the function texts with an image in the Basic skin.

This was what is down the bottom of the skin:


		<?php
			user_login_link( ' [', '] ' );
			user_register_link( ' [', '] ' );
			user_admin_link( ' [', '] ' );
			user_logout_link( ' [', '] ' );
		?>

This had to be changed to:

	
<?php user_login_link( $before = '', $after = '', $link_text = '<img src="img/nameofimage.png"/>', $link_title = '#' );
//	user_register_link( ' [', '] ' );
user_logout_link( $before = '', $after = '', $link_text = '<img src="img/nameofimage.png"/>', $link_title = '#' );
user_admin_link( $before = '', $after = '', $link_text = '<img src="img/nameofimage.png"/>', $link_title = '#' );?>

...so that the text did NOT print, but were replaced with images.

Using

$link_text = '<img src="img/nameofimage.png"/>',

did not work.

2 Feb 13, 2010 21:43

This is not a bug!

Just use this

user_logout_link( '', '', '<img src="img/nameofimage.png"/>', '#' );

or this

$before = 'X';
$after = 'Y';
$link_text = 'Z';
$link_title = '#';

user_logout_link( $before, $after, $link_text, $link_title );

3 Feb 13, 2010 22:03

sam2kb wrote:

This is not a bug!

Just use this

user_logout_link( '', '', '<img src="img/nameofimage.png"/>', '#' );

yeah but isnt that weird anyway ? that you have to provide blanks to the other values in order to replace just the default text "log in" ?

afai am concerned user_logout_link( $link_text => 'whatever';) should replace link_text without providing others.

i mean isnt it

<a>$link_text</a> ?

so why does it do this instead:

whatever<a>Log in</a>

?

4 Feb 13, 2010 22:10

function get_user_logout_link( $before = '', $after = '', $link_text = '', $link_title = '#', $params = array() )
{
	global $current_User;

	if( ! is_logged_in() )
	{
		return false;
	}

	if( $link_text == '' ) $link_text = T_('Logout');
	if( $link_title == '#' ) $link_title = T_('Logout from your account');

	$r = $before;
	$r .= '<a href="'.get_user_logout_url().'"';
	$r .= get_field_attribs_as_string( $params, false );
	$r .= ' title="'.$link_title.'">';
	$r .= sprintf( $link_text, $current_User->login );
	$r .= '</a>';
	$r .= $after;
	return $r;
}

I don't get what you're saying... Try if this works better

user_logout_link( '', '', NULL );

EDIT:
Now I see what you mean :)
The function should be converted to use $params like all others? Feel free to edit it in CVS ;)

user_logout_link( array(
   'link_text' => 'blah',
) );

5 Feb 13, 2010 23:44

sam2kb wrote:

[php]

EDIT:
Now I see what you mean :)
The function should be converted to use $params like all others? Feel free to edit CVS ;)

[php]user_logout_link( array(
'link_text' => 'blah',
) );[/php]

precisely.thanks


Form is loading...