WordPress.org

Support

Support » Plugins and Hacks » Quick Chat » Display Quick Chat to User Group only

Display Quick Chat to User Group only

  • Im trying to display the Chat with the following code:

    <?php if (current_user_can(‘team’) || current_user_can(‘level_7’) && function_exists(‘quick_chat’)) global $quick_chat;
    echo $quick_chat->quick_chat(400, ‘default’, 1, ‘left’, 0, 0, 1, 1, 1, 1);
    ?>

    to users in the Group of “Team” or with the level of 7.

    But its visible to all users.

    Can someone fix the code for me?

    http://wordpress.org/extend/plugins/quick-chat/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Marko-M

    @marko-m

    You can’t use function_exists for object methods, you must use is_object and method_exists:

    if(current_user_can('team') || current_user_can('level_7')){
        global $quick_chat;
        if(is_object($quick_chat) && method_exists($quick_chat, 'quick_chat')){
            echo $quick_chat->quick_chat(400, 'default', 1, 'left', 0, 0, 1, 1, 1, 1); ?>
        }
    }

    Hello, I think this is what I am looking for.

    I want a chat that is only visible to selected members. Reading this post, it seems I can create a new user group for example – team, and then use the PHP code above. However, where do I paste the code above too?

    thanks.

    edit: Wherever you want your function (chat) to be visible.

    Thanks for replying.
    If I want to put the chart on a separate page in WordPress, do I paste the code in the functions.php?

    Plugin Author Marko-M

    @marko-m

    No, for WordPress pages you must use shortcode not PHP.

    Marko, Thanks for the code, but where exactly do we paste that code?

    Or, how can I make it restrict to various groups. I have it working for logged in users only, but not the different groups.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Display Quick Chat to User Group only’ is closed to new replies.
Skip to toolbar