I am trying to create a custom navigation menu that changes depending on whether or not the user is logged in. I would also like to add links in the navigation to the admin panel etc. if the user has permission to use them.
Is there a function or easy method of testing whether the user is logged in and what permissions their account has?
Comments
`
if ( zp_loggedin() ) {
do something...
}
`
You can also check if a user is logged in with, for example, upload rights like this:
`
if ( zp_loggedin(UPLOAD_RIGHTS) ) {
do something...
}
`
You'll find rights definitions on this page http://www.zenphoto.org/news/an-overview-of-zenphoto-users
They are constants (i.e. OVERVIEW_RIGHTS, USER_RIGHTS, etc) Not sure what you mean exactly. Can you describe an example ?
I think the link you provided has all of the information I need, thank-you very much for taking the time to answer.
One last question. Is there a way to get and display the user's name? I would like to have the user's name printed (if supplied) as the text for the user page link.
http://www.zenphoto.org/news/zenphoto-plugin-architecture
A (rather complex) plugin doing these things is the Zenpage CMS plugin for example.
You can access user values via the Zenphoto_Administrator class:
http://www.zenphoto.org/news/zenphotos-object-model-framework