ZenphotoCMS Forum
An 'is_admin' function ? - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: Themes (https://forum.zenphoto.org/forum-5.html)
+--- Thread: An 'is_admin' function ? (/thread-3198.html)



An 'is_admin' function ? - ClicClac - 2008-06-29

Hello,

Does an 'is-admin' function (like in WordPress) exist in Zenphoto ?

I have a button for copying the image path in clipboard, but I want to display it only for me, not for visitors.


An 'is_admin' function ? - acrylian - 2008-06-29

You could use `if(($_zp_loggedin & ADMIN_RIGHTS)) { <copy to clipboard> }`


An 'is_admin' function ? - ClicClac - 2008-06-29

Perfect!!
Many thanks for this very fast solution...


An 'is_admin' function ? - sbillard - 2008-06-29

More precicely, `if (zp_loggedin())` will tell you if the viewer is logged in as an admin. acrylian' code is more precice on what kind of administrator is logged in. Most of the time it is not improtant what the admin's rights are so `zp_loggedin()` is appropriate. Also, it works anywhere. If you use `if(($_zp_loggedin & ADMIN_RIGHTS)) ` within a function you will need to declare `global $_zp_loggedin;`


An 'is_admin' function ? - acrylian - 2008-06-29

I actually copied too quickly the wrong thing...


An 'is_admin' function ? - ClicClac - 2008-06-29

Thanks for this detail, sbillard !