Re: Weird login thing

Posted by Pedro on
URL: https://support.nabble.com/Can-t-log-out-or-be-invisible-tp7587784p7589459.html

Please, create a group called "online"and add the users that should be seem online.
Then edit your avatar macro like this:
<override_macro name="avatar" requires="user" parameters="size,group,border_class">
    <n.set_var. name="image_url">
        <n.if.is_banned>
            <then.default_avatar_url size="[n.size/]"/>
            <else.avatar_url size="[n.size/]"/>
        </n.if.is_banned>
    </n.set_var.>
    <n.remove_spaces_between_tags.>
        <n.if.is_empty.group>
            <then>
                <a href="[n.url/]" rel="nofollow" title="[t]View profile of [t.author.name/][/t]" class="nowrap no-decoration">
                    <img class="avatar [n.avatar_border.border_class/]" src="[n.var name='image_url'/]" height="[n.avatar_pixels.size/]" width="[n.avatar_pixels.size/]" alt="[n.name/]" title="[n.name/]"/>
                    <img src="/images/online.png" class="online[n.search_id/] online invisible" title="[t]User is online[/t]" alt="online"/>
                </a>
            </then>
            <else>
                <n.put_in_head.>
                    <script type="text/javascript">
                        var avatarBorder = "<n.avatar_border.border_class/>";
                        var userIsOnline = "<t>User is online</t>";
<![CDATA[
                        Nabble.createAvatar = function(showAvatar, url, id, size) {
                            var dim = size == 'small'? 24 : 100;
                            document.write("<img ");
                            if (showAvatar || showAvatar == null)
                                document.write("src='"+url+"' ");
                            else
                                document.write("src='/images/nop.gif' ");
                            document.write("xsrc='"+url+"' ");
                            document.write("width='"+dim+"' height='"+dim+"' class='"+avatarBorder+" avatar'/>");
                            if (id)
                                document.write('<img src="/images/online.png" class="online'+id+' online invisible" title="'+userIsOnline+'" alt="online"/>');
                        };
]]>
                    </script>
                </n.put_in_head.>
                <span class="avatar[n.group/]">
                    <a href="[n.url/]" rel="nofollow" title="[t]View profile of [t.author.name/][/t]" class="nowrap no-decoration">
                        <script type="text/javascript">
                            Nabble.createAvatar(window.hasAvatar<n.group/>, '<n.var name='image_url'/>', '<n.search_id/>', '<n.size/>');
                        </script>
                    </a>
                </span>
            </else>
        </n.if.is_empty.group>
    </n.remove_spaces_between_tags.>
    
    <n.if.this_user.is_in_group group="online">
        <then>
            <script type="text/javascript">
                console.log("<n.this_user.id/>");
                id = <n.this_user.id/>;
                $(document).ready(function(){
                $(".online"+id).css("display","inline");
                })
            </script>
        </then>
    </n.if.this_user.is_in_group>

    <n.call_later param="visitorOnline"/>
    <n.call_later value="[n.search_id/]" param="avatarOnline"/>
</override_macro>
My test forum.