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

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
 
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.
 
#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)
 
You can use media queries to show/hide certain content based on the screen width.

See this guide: https://xenforo.com/community/resources/responsive-design.2193/
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.
 
Back
Top Bottom