Lucas Bustamante
Lucas Bustamante

Reputation: 9

(Wordpress) Execute plugin if admin is online

The problem

I have a CHAT plugin for wordpress, I would like it to be active only when administrator (EDITOR, to be more precise) is online. When the admin is offline there's no use to have a chat on the website, it only consume space.

Possible Sulutions

I know little of PHP/Wordpress programming, but I'm almost sure some kind of code in Functions.php might solve the problem, something with admin_init, but it has to disable when admin logs off too.

Conclusion

Desired administration role to activate the plugin: Editor

Plugin name: Online Chat (online-chat/online-chat.php)

Wordpress Version: 3.4.2

Thanks guys!! I'll be around, trying to make it work here too

Upvotes: 0

Views: 501

Answers (1)

Chrisdigital
Chrisdigital

Reputation: 404

I'm assuming you can do a play on this: http://wordpress.org/support/topic/display-info-if-admin-otherwise-hide where if Any user is an admin, then load a template part or trigger an action hook etc. but I haven't tested this myself.

Also check this out: http://wordpress.org/support/topic/checking-if-the-user-is-admin

Upvotes: 0

Related Questions