WordPress.org

Ready to get started?Download WordPress

Forums

Quick Chat
Display Quick Chat to User Group only (7 posts)

  1. nnamed
    Member
    Posted 1 year ago #

    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/

  2. Marko-M
    Member
    Plugin Author

    Posted 1 year ago #

    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); ?>
        }
    }
  3. leoly
    Member
    Posted 1 year ago #

    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.

  4. nnamed
    Member
    Posted 1 year ago #

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

  5. leoly
    Member
    Posted 1 year ago #

    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?

  6. Marko-M
    Member
    Plugin Author

    Posted 1 year ago #

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

  7. Woz_Mann
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic