• Resolved justin171185

    (@justin171185)


    Hello,
    I am currently using the shortcode placed in a widget, on the footer of my site. I run a web site for an online radio station, and am using buddypress as the framework for a listeners club. This basically gives users their own profile, access to the chat, free downloads area, and so forth. I plan to keep adding new stuff as interaction increases.
    I love Simple Ajax Chat. I wanted something similar to a traditional facebook chat, but for all members to interact with one another, not just with private messages. So in that regard, the plugin is meeting my needs. Anyway, I use the display widgets plugin to decide which pages a particular widget should be shown on, and have it set to show on everything it will let me. However, there is no default profile page in Buddypress, as they are automatically generated. I mean, it isn’t a static page that is then populated with user info, so I can’t select that for the widget to show up. Thus, a user might have SAC on the majority of the site pages, but when they go to their profile, it disappears.
    My idea is to switch from using the shortcode to embedding directly in to the template, thus forcing it to be loaded no matter what. So, I have two questions:
    1. First, if I want to keep it in the footer, where exactly in the code should I insert it? I am using the Twenty Seventeen theme. I am totally blind, and want to be sure it is going to look good where it is placed.
    2. In addition, I would like it to only show when a user is logged in. So, if a user is logged out, I don’t want any message about how the user should log in or anything like that. I like the fact that I can set it so that only registered users can access the chat. But iff the person is not logged in, I would just prefer that it doesn’t display anything.
    I know that you have tons to do, and I really value your time, effort, and support. Thanks in advance for any tips you can give me.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter justin171185

    (@justin171185)

    Hi there,
    Just a quick update. I was able to get the chat embedded in the twenty seventeen footer.php file, so that’s good. I hope it looks good where I have it, since with my screen reader it reads just fine, but that’s no guarantee it’ll look good.
    However, the problem of the display message to unregistered users remains. I need to either be able to completely hide the chat from people who aren’t logged in, or at least change the display message. Instead of “Youu must be logged in to use this chat,” I would translate it, and add a login link right there. I really don’t know how to do either. Which file would I need to edit? What would you recommend?

    Plugin Author Jeff Starr

    (@specialk)

    I can’t recommend editing any core files, but I have added this to the to-do list for a future update. I’ll implement a filter hook so the message can be customized however is desired. Thank you for the feedback, justin171185.

    Plugin Author Jeff Starr

    (@specialk)

    Sorry accidentally marked as “resolved”. Changed it back to “unresolved”. Let me know if there is anything further that I can do to help. Thank you.

    Plugin Author Jeff Starr

    (@specialk)

    Just to follow up with this, in the next version of the plugin, I have added a filter hook to customize the login-required message. The hook is named sac_require_login_message, so you can customize the message by adding this snippet to your theme’s functions.php file:

    function sac_custom_login_message($message) {
    	
    	return 'Please <a href="'. wp_login_url(get_permalink()) .'">Log in</a> to chat.';
    	
    }
    add_filter('sac_require_login_message', 'sac_custom_login_message');

    Then you can customize the message however is desired. Again, this will work in the next version of the plugin, 20170731, which should be available in the next week or so.

    Worked out nicely – thank you.

    wireB

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘better integration with buddypress’ is closed to new replies.