LunaProxy - Top Proxy Service Provider with Over 200 Million IPs

Tutorials Customizing the layout with custom user fields

Tutorials - Customizing the layout with custom user fields - TheJavaSea Forum, Gaming Laptops & PCs Reviews, Linux Tutorials, Network Hacks, Hacking, Leaks, Proxies, Domains & Webhosting, Coding Tutorials, SEO Tips & Hacks, Security TIPS and much more.

Marks-Man

Administrator
Joined: Mar 15, 2021
Messages: 1,044
Resources: 405
Points: 113
Reaction score: 1,275
This is a simple guide explaining how custom user fields can be used to customise the layout and allow members to have some form of control over the content, depending on the options you provide.

For the purposes of this guide, we will be creating a checkbox for members to opt out of seeing the forum statistics in the sidebar.

Create the custom user field

The first step is to create the custom user field, like so:



Please Login or Register to view content


A new option will then be present on the account preferences page.


Please Login or Register to view content

Edit the widget

Now we enter a conditional statement in the widget display condition field to show the widget when the field is unchecked.
The code for that is:

Code:
!
Code:
Please Login or Register to view content


Please Login or Register to view content


Note how removeStatistics matches the ID of the custom user field.


That's it!
Any member who now checks the field in their preferences will no longer see the widget in the sidebar.


The same approach can be used for templates, forums, etc.
Just use the custom user field ID with a conditional statement to show/hide content
 
  • Tags
    create custom user fields xenforo
  • Top