[wp-hackers] checking for user logged in a plugin

Lionel POINTET lionel.pointet at globalis-ms.com
Fri Apr 27 13:59:41 UTC 2012


Hi Chris,

This function is defined in the pluggable.php file, which is included
*after* the plugins, since this is designed to be overwritten by them.
So you have to wrap your code in a function that could be called on the
'plugins_loaded' hook for example.

Lionel

2012/4/27 Mika A Epstein <ipstenu at ipstenu.org>

> Try
>
> if ( (is_user_logged_in() ) && (current_user_can('administrator')) ) { ....
>
>
> ----
> Mika A Epstein (aka Ipstenu)
> http://ipstenu.org
>
> On 27 Apr 2012, at 8:41:43AM, Chris McCoy wrote:
>
> > Im doing this in a plugin
> >
> > if(is_user_logged_in() && current_user_can('administrator')) {
> >        add_filter('stylesheet', 'admin_role_theme');
> >        add_filter('template', 'admin_role_theme');
> > }
> >
> > But fires is_user_logged_in not defined, should I be firing this a
> diferent
> > way.
> >
> > It basically selects the theme for admin only so he can work on a
> different
> > design live.
> >
> >
> >
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list