1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.5 Two conditional statements (mobile detector and plugins status detector)

Discussion in 'XenForo Questions and Support' started by Dadparvar, Oct 2, 2015.

  1. Dadparvar

    Dadparvar Well-Known Member

    Hi,

    I want to show a link, in profile page, just when:
    1. Cometchat plugin is enable.
    2. User is using desktop version, not visiting with mobile.
    Which conditional statements I should use? Any opinion will be appreciated.

    Regards,
    Hamed
     
  2. Mike

    Mike XenForo Developer Staff Member

    For #1, you'd be checking for: {$xenAddOns.cometChatAddOnId} . I don't know the ID of the add-on, so it'd need to be replaced with that.

    #2 doesn't really exist in XF. You'd generally need to use responsive design/media breakpoints in CSS.
     
    Dadparvar likes this.
  3. Dadparvar

    Dadparvar Well-Known Member

    #1 worked. Thanks.
    #2 can you help me more please? What I exactly want to do is:
    • I have cometchat installed. And I set not to be shown when users visit my forum with mobile.
    • Then I added "Chat With Me" button to Member Card.
    • Now, the "Chat With Me" button in Member Card is also shown when users are with mobile. (I want it to be hidden when users see member card with mobile)
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    Dadparvar likes this.
  5. Dadparvar

    Dadparvar Well-Known Member

    Worked. Thanks.

    For those who may need it:
    • I gave my link this Class: cometchatbutton
    • Then I added the code below to EXTRA.css
    Code:
    <xen:if is="@enableResponsive">
        @media (max-width:480px) {
            .cometchatbutton {
            display: none;
            }
        }
    </xen:if>
    Now when they use mobile or they resize desktop browsers to very low size, the link disappears.
     

Share This Page