Hide Adverts 1.2.1

XF 2.0 / 2.1 / 2.2 / 2.3 Hide Adverts 1.2.1

Add-on xenforo 2

Ressources et modules complémentaires pour XenForo 2

Styles xenforo 2

Styles / Thèmes et apparence pour xenforo 2

Templates xenforo 2

Codes pour modifier les templates sur xenforo 2

Section Premium

Add-on et Styles pour membre Premium
  • ⚠️ Section Premium. Réserver aux Membres Premium ⚠️
Hide Adverts 1.2.1

XF 2.0 / 2.1 / 2.2 / 2.3 Hide Adverts 1.2.1

Catégorie Catégorie Add-Ons
Titre du sujet Titre du sujet Hide Adverts 1.2.1
Auteur de la discussion Auteur de la discussion laurent68
Date de début Date de début
Réponses Réponses 7
Affichages Affichages 564
Réaction Réaction 0
Dernier message par Dernier message par laurent68

laurent68

Fondateur

Staff
fondateur
Réputation: 100%
Discussions
5 084
Messages
13 310
Solutions
85
J'aime
8 137
Points
198
Adds a permission setting "Can hide adverts" to assign user groups permissions to hide adverts. This is intended to be used with paid upgrades so that users can pay to hide adverts.

Note that the functionality of this addon is largely able to be reproduced using only the advertising management system that is a core part of XenForo 2.x. This addon simply provides an alternative approach to managing these permissions which is more flexible and extensible - especially for more complex advert management systems which do not use the core advertising placements.

A specific feature of this addon which is not available in the core, is the ability for users to over-ride the advert hiding mechanism allowing them to show the adverts.

I use this functionality to show adverts to myself so I know what is displaying and what isn't, while other admins automatically have adverts hidden. Similarly, my "business" members who pay to show their own adverts on the site while also getting the ability to hide adverts when browsing - might choose to temporarily show adverts so that they can check how their adverts display.

New permission :

frl.png


User preference :

qak.png


How to use :


For use with account upgrades, ensure that the Registered usergroup has the Can hide adverts permission set to "No". Then for any upgrade usergroups, plus moderators and administrators (assuming you want to hide ads for them), set the Can hide adverts permission to "Yes".

Any advertisement placement you want to use with these permissions, should be placed within an "if" statement in the template which checks the $xf.visitor.show_adverts flag.

This can also be used for the display settings on widgets.

show_adverts will be set to true when:
  • the user does not have permission to hide adverts
  • the user does have permission to hide adverts, but has deselected the "Hide adverts" checkbox in their preferences
Example :

HTML:
<xf:if is="$xf.visitor.show_adverts">
    Advert goes here
</xf:if>

Télécharger 1.0.0b2 :

Version 1.1.0 Two new features :

-1- disable all adverts for specified nodes (forum_view and thread_view templates)
-2- disable all adverts for specified user groups (overrides Can hide adverts permissions)

Télécharger 1.1.0b :

Version 1.1.1 - now works with XF 2.3 :
_ Fixed template modification to work with XF2.3 as well

Télécharger 1.1.1 :

Version 1.1.2 - minor UI update :
- No change in functionality - just a minor UI update to "disable" the option to hide adverts if the user doesn't have permission to do so.

Télécharger V1.1.2 :

1.1.3 (2025-12-11)​

- Run enqueuePostUpgradeCleanUp() during upgrades on XenForo 2.3 and later.

1.2.0 (2026-09-27)​

  • Requires XenForo 2.2.0 or later.
  • The "Hide adverts" preference is now saved only for members with the "Can hide adverts" permission. Saving account preferences without the permission used to switch the preference off, so a member granted the permission later — by an account upgrade, say — kept seeing adverts until they ticked the box. Members affected before this release may need to tick it again.
  • show_adverts and canHideAdverts() answer for the user they are called on, rather than always for the current visitor.
  • Advert positions no longer fail when a template is rendered without a controller reply.
  • The preference's hint text no longer refers to account upgrades.
  • Renamed the xf_user_option column hide_adverts to hampel_hideadverts_hide_adverts, as XenForo's resource standards require for columns on core tables. The upgrade keeps every member's setting, and $xf.visitor.show_adverts is unchanged — but a template reading $xf.visitor.Option.hide_adverts directly must be updated. On older MySQL and MariaDB versions the rename rebuilds xf_user_option, which can take some time on a large forum.

Version 1.2.1 (2026-10-12)​

  • Answers the hampel_admin_api_redaction code event, declaring that the add-on has no secret settings. Add-ons that report a forum's configuration use this to decide which option values they may show. It has no effect on a forum where no add-on defines that event.
Télécharger V1.2.1 :
 
Contenu similaire Les plus vues Voir plus
Retour
Haut Bas