admin links only show once logged in.


#1

Hello,

I have build a cms which works great. I was wondering is there any way that I can have admin links only show if I am logged in?

I have no code to show as am not sure how to go about this.

Any help or suggestions would be great thanks.


#2

If your CMS works with user IDs, you can simply use that as a condition:

[php]
if ($userid > 0) {
showAdminButtons();
}
[/php]

Or you could try the same with usernames:

[php]
if ($username != “” AND $username != “Guest”) {
showAdminButtons();
}
[/php]


#3

Thanks for your help but am still a little unsure how to implement this,

I created my cms following a few diffrent tutorials and went from there.

would it be possible to see an example?

thanks very much.


#4

Well, did you develop your CMS yourself, or did you grab a premade script? In the first case, I cannot help you. In the second case, I don’t think I’ll be able to help you either unless you specify just what you want where to happen.

I don’t think there’s much you can do without actually trying things out, and unless your CMS is already running in a PROD environment, you should be relatively safe.


#5

I wrote the cms myslef using tutorials I looked at a few tutorials to see how to do it and then created my own its a very basic cms.

I have static links at the top as I wanted them in a certain order, as every page I created using the cms added links to the navbar.

What I need is an admin link on the navbar but only to show once I’m logged in.

here’s the cms http://www.webguideuk.com/php

Well, did you develop your CMS yourself, or did you grab a premade script? In the first case, I cannot help you. In the second case, I don't think I'll be able to help you either unless you specify just what you want where to happen.

I don’t think there’s much you can do without actually trying things out, and unless your CMS is already running in a PROD environment, you should be relatively safe.

Okay thanks anyway