I have a block like this

<li><a href="mywebsite/user/login">Login</a></li>
<li><a href="mywebsite/user/register">Sign In</a></li>

and I want to replace log in with my account when the user logs in and make disappear sign in without using user menu if it's possible.

Thank you

Comments

naveenvalecha’s picture

your block is made using custom module ?

global $user;
if ($user->uid > 0) {
  // show the text login and signin
}
else {
  // show My Account link lin
}

--
Naveen Valecha
http://valechatech.blogspot.in

Jaypan’s picture

You got those backwards.

This will work:

global $user;
if ($user->uid) {
  // Show my account link
}
else {
  // show the text login and signin
}
Joekz’s picture

where i put this ?

I have just a full html block

Thank you

Joekz’s picture

where i put this ?

I have just a full html block

Thank you

Joekz’s picture

No, just full html block

Joekz’s picture

No, just full html block

rameshbabu.g’s picture

Enable PHP filter module in bock and use php filter to add given php code.

But using php filter is always not recommendable. Instead of adding php code in block, create block programatically.

Use block info hook to create block programatically. In that add your conditions to block body.
http://kahthong.com/2013/06/create-your-own-custom-drupal-block-programm...

naveenvalecha’s picture

Enable PHP filter module in bock and use php filter to add given php code.

But using php filter is always not recommendable. Instead of adding php code in block, create block programatically.

Suggested --

U

se block info hook to create block programatically. In that add your conditions to block body.
http://kahthong.com/2013/06/create-your-own-custom-drupal-block-programm...

Agreed 100++

--
Naveen Valecha
http://valechatech.blogspot.in

waqarit’s picture

Goto module section and enable php filter module. Now come to block section you will see new filter listed there.

xlin’s picture

You can try something like following.

<li><a class="not-login-link" href="mywebsite/user/login">Login</a></li>
<li><a class="not-login-link" href="mywebsite/user/register">Sign In</a></li>
<li><a class="login-link" href="mywebsite/user">My Account</a></li>

.logged-in .not-login-link {
  display:none;
}
.not-logged-in .login-link {
  display:none;
}