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

Frequently Asked Questions

Discussion in 'XenForo Questions and Support' started by Brogan, Oct 6, 2010.

Tags:
Thread Status:
Not open for further replies.
  1. Brogan

    Brogan XenForo Moderator Staff Member

    This FAQ will hopefully provide answers to some of the most commonly asked questions.
    It has been written in such a way to make it easy for everyone to understand and be as search friendly as possible.

    It has been divided into sections to make it easier to find the answers you're looking for.
    Click on the links below to go to each section.
    1. Features / Functionality
    2. Installation / Importing / Upgrading
    3. Configuration / ACP
    4. Styling / Design
    5. Template Editing / Template Syntax
    6. Conditional Statements
    7. Development
    8. Troubleshooting
    For any other questions you may have, check the following resources:
    This thread will be updated periodically. To suggest additions, please post in this thread.

    The information in this FAQ has been compiled from various sources, including posts here on XenForo.com.
    Thank you to everyone who has contributed to it, either directly or indirectly.


    Last updated: Monday 2 February 2015
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Features / Functionality

    1. How and where can I insert advertisements?
    There are a number of dedicated templates which are specifically for this purpose. Refer to this resource for more information.


    2. How can I implement advertisements in a responsive style?
    See this resource which explains how to make different ad slots be served based on the browser width for Google AdSense. For other ad serving providers, it is up to them to provide solutions.


    3. Can I use HTML in posts?
    Currently it is only possible to use BB Code in posts, HTML is not supported.


    4. How do I stop BB Code from being parsed in posts?
    Use the plain tags like so: [plain]This content will [b]not[/b] be parsed.[/plain]


    5. Can I use BB Code in Pages?
    Currently it is only possible to use HTML in Pages, BB Code is not supported.


    6. Why can't I upload an image, even though it is smaller than the maximum dimensions (pixels) permitted?
    Server-side file size (KB) resizing is not supported. Any files which are larger than the maximum size specified in the ACP -> Options -> Attachments: Maximum Attachment File Size (KB) will be rejected.


    7. Why can I upload an image, even though it is larger than the maximum file size (KB) permitted?
    Uploaded files are first resized based on the maximum physical dimensions (pixels) set in the ACP -> Options -> Attachments: Maximum Attachment Image Dimensions. If the resized image is below the maximum file size (KB) limit, then it will be allowed.
    Note that with XenForo 1.2 and above, by default, images of 20 megapixels and over will not be resized; this is to prevent fatal errors due to running out of memory. If the Maximum Attachment Image Dimensions combined total (width x height) is set lower than this limit, images greater than 20 megapixels, or with a dimension larger than that permitted, will be rejected with an error stating The uploaded image is too big. If the Maximum Attachment Image Dimensions combined total (width x height) is set to 0 or greater than 20 megapixels, the image will appear as an attachment without a thumbnail. The 20 megapixels limit can be changed using a config.php switch; refer to this section of the XenForo Manual.


    8. How do I go to the first post in a thread when viewing the thread list?
    Click on the date/time under the thread title.


    9. Why don't images embedded from a URL appear in the lightbox?
    The lightbox can only be triggered by an attached image. Once the lightbox has loaded, all images in the post (or page) will be displayed, including embedded images.


    10. Why is my animated avatar not working?
    Avatars are resized for use throughout the forum and the default software used to perform the resizing does not support animated images. They will however still be displayed correctly on member cards and profiles. In order to display animated avatars throughout the forum, you must have the PECL imagick extension available on your server, then select it in the ACP -> Options -> Attachments: Default Image Processor.


    11. Why don't categories open in a new page?
    Category titles act as anchors unless they have been set as separate pages in the ACP -> Options -> Node & Forum List: Create Pages for Categories.


    12. Where is the global RSS feed?
    The global RSS feed is available at the following URL, relative to the installation path: /forums/-/index.rss
    For example, here on XenForo.com the URL is https://xenforo.com/community/forums/-/index.rss


    13. Why can't I search for words with 3 characters or less?
    This is a limitation of the MySQL Full Text search function. Find more information on the MySQL site.
    Note that with XenForo 1.1 and above, it is possible to set the minimum word length in the ACP -> Options -> Search Options: Search Minimum Word Length. This value must correspond with the MySQL full text minimum word length in the my.cnf configuration file. If the value in my.cnf is changed, all full text indices on the server (within MySQL) must be rebuilt, after which, the minimum word length value can be changed in the ACP.


    14. Why can't I search for certain words?
    The MySQL search function has what are called stopwords, which are typically common words, and are excluded from searches. Find more information on the MySQL site.
    Note that the XenForo Enhanced Search add-on, which is installed here on XenForo.com, does not suffer the same constraints as default MySQL search does with regards to minimum word length and stop words. The stopwords for elasticsearch are listed here.


    15. How do I search using OR instead of AND?
    Use "|" between words, for example: xenforo | software


    16. How and when are user and post counts updated?
    The global user and post counts are updated via a cron job (Rebuild Board Totals Counter) every 10 minutes.


    17. Why do banned users still show as normal members?
    Ensure you have defined a user group with the relevant title and styling to add banned members to and set it in the ACP -> Options -> User Discouragement and Discipline: Add User Group on Ban.
    Note that banned members do not appear in the member list or in search results; Administrators however can still access profile pages of banned members.
     
    LanceBase, lazy llama, Tize and 13 others like this.
  3. Brogan

    Brogan XenForo Moderator Staff Member

    Installation / Importing / Upgrading

    1. Should I install XenForo in the web root or a directory?
    This is personal preference and depends how you intend to structure your site. If you plan to install additional software in the root such as a CMS or have a home page, then it may make more sense to install the software in a directory.
    Note that you can not have two files with the same name in the same directory, for example index.php.


    2. What is the difference between the upgrade and full packages?
    The upgrade package does not include the following files and directories:
    .htaccess
    data
    internal_data



    3. Do all releases have to be installed in sequence or can I skip a version?
    You can upgrade from the current version to any later version, safely missing out any interim releases.


    4. Can I change the domain or URL where the software is installed?
    Yes, as long as you remove the original installation before installing it elsewhere. Ensure you update your account details in the Customers area.


    5. How can I move my installation to a different directory?
    Update the Board URL in the ACP -> Options -> Basic Board Information and move the files to the new directory (or rename the directory). You may need to restart the server for the change to take effect.
    Note that redirection will be required to ensure any indexed links continue to work.

    For example, if the installation is moved from the /community directory to the root, the following line needs to be added to the .htaccess file, after the default XenForo rewrite rules:
    Code:
    RewriteRule ^community/(.*)?$ /$1 [R=301,L]
    Alternatively, if you move from the root to the /community directory, this would need to be added to an .htaccess file in the root:
    Code:
    RewriteEngine on
    RewriteCond %{REQUEST_URI} ^/$
    RewriteRule (.*) /community/ [R=301]
    If you rename the directory, for example from /forums to /community, create an .htaccess file in the old /forums directory with the following:
    Code:
    Redirect permanent /forums http://domain.com/community

    6. How can I move my installation to a different domain or host?
    Backup the existing database and server files. Copy them to the new domain/server and update the library/config.php file with the new database details as required. It may be necessary to set permissions for the data and internal_data directories to world writeable (CHMOD 0777). Lastly, update the Board URL in the ACP -> Options -> Basic Board Information, if it has changed.
    Note that if you are moving to a different type of web server and have Friendly URLs enabled, you will need to make the appropriate changes. Refer to the Friendly URLs section of the XenForo Manual for more details.
    Note also that redirection will be required if the domain name changes, to ensure any indexed links continue to work. Furthermore, if you have redirection scripts in place, you will need to edit the 301config.php file to reflect the new location.


    7. What information and data is imported?
    Forum and user data, attachments, and avatars are imported. Styles, template code, HTML, and CSS are not imported.
    Note that any data related to features which are unsupported will be ignored.


    8. How are default and custom user groups imported from vBulletin?
    All user groups and user states are imported. Any groups other than groups 1 to 7 are imported as a custom group.


    9. What are outdated templates and why do I need to revert or merge them? Can't I just continue using the old ones?
    If a template is changed between releases, i.e. from 1.0.0 to 1.0.1, and you have manually edited it, then it will be marked as outdated. This is done because the software doesn't automatically overwrite those templates, thereby causing certain functionality which you have added to be lost. It is an indication that the core code has changed and you need to take action. The software will continue to function with these outdated templates but you may be missing important updates and bug fixes so it is recommended to revert and reapply any edits or use the template merging functionality.


    10. How can I compare changed code when I have outdated templates which need to be reverted and edited once more?
    You can use a file compare program which will highlight any differences between two files. One such free program which runs in Windows is Notepad++.
    Note that with XenForo 1.2 and above, template merging is built in. Refer to the discussion thread in the forum for more information.


    11. How can I create a local installation using XAMPP?
    Refer to the discussion thread in the forum for instructions.
     
    LanceBase, JustinHawk, Fikria and 9 others like this.
  4. Brogan

    Brogan XenForo Moderator Staff Member

    Configuration / ACP

    1. How do I remove index.php from the URL?
    Enable Friendly URLs in the ACP -> Options -> Search Engine Optimisation (SEO): Use Full Friendly URLs.


    2. Can I change the URL structure?
    With XenForo 1.2 and above, the Route Filters function can be used to change routes and URLs. Refer to this section of the XenForo Manual for more information.


    3. Can I change index.php to something else such as forum.php?
    It is not possible to rename the index.php file.


    4. Can I change which page is loaded when visitors access my site?
    With XenForo 1.2 and above, it can be set in the ACP -> Options -> Basic Board Information: Index Page Route.


    5. What is stored in the file system?
    Only avatars and attachments are stored in the file system. Everything else, including templates, is stored in the database.


    6. How do I replace the XenForo header logo with my own?
    Upload your logo to the server and change the image path in the ACP -> Styles -> Style Properties -> Header and Navigation -> Settings: Header Logo Image Path.


    7. How do I replace the XenForo social media (Facebook, Twitter, etc.) share logo with my own?
    Upload your logo to the server and change the image path in the ACP -> Styles -> Style Properties -> Header and Navigation -> Settings: Open Graph Logo. Due to caching it can take several weeks for the image to update on the Facebook servers. You can attempt to force an update of the cache using the debugger.
    Note that the image must be square with minimum dimensions of 200px and maximum dimensions of 350px.


    8. How do I set up Facebook, Twitter, and Google integration?
    Refer to relevant section of the XenForo Manual for instructions.


    9. How can I force a forum to use a particular style?
    This is set in the ACP per node; simply check the Override user style choice and select the style to be displayed.


    10. How do I create a Page node?
    Refer to this resource for instructions.


    11. How do I change the avatar size?
    It is not possible to change the pre-defined avatar sizes (s, m, l) without editing the core files and associated templates.


    12. What is the difference between Awaiting email confirmation and Awaiting email confirmation (from edit)?
    Awaiting email confirmation is the user state of newly registered members who haven't yet clicked on the link sent to them via email to verify their account. Awaiting email confirmation (from edit) is the user state of existing members who subsequently change their email address and need to verify the new address is valid.


    13. How does the permissions system work?
    Refer to the Permissions section of the XenForo Manual for information. There is also this resource which explains the system in more detail, and this resource which explains how the cumulative permissions work across multiple user groups.


    14. How do I create an 'Announcements' forum which only staff members can post in?
    Navigate to the node tree and click on the Permissions link for the node you wish to change. Revoke the permissions (for example Post new thread and Post replies) for the Registered user group and Allow them for any staff user groups.


    15. How do I create Moderators and Administrators?
    Refer to the Users section of the XenForo Manual for instructions.


    16. Why do the moderator functions not appear for my Administrator account?
    Adminstrators do not automatically have moderator capability, they must be explicitly made a moderator and granted the permissions, as with any other user. Refer to the Moderators section of the XenForo Manual for more information.


    17. What is the difference between a Super Administrator and an Administrator?
    A Super Administrator can not be created or edited by an Administrator and always has all permissions in the ACP.


    18. How do I add another Super Administrator?
    Edit the library/config.php file and add any additional users IDs, comma delimited like so:
    PHP:
    $config['superAdmins'] = '1, 2, 3';
    Note that users must already be Administrators.


    19. How can I redirect all traffic to the www or non-www version of my site?
    If you are on an Apache server, this can be achieved by editing the .htaccess file.

    These are some examples of how to remove www:
    Code:
    RewriteCond %{HTTP_HOST} www.example.com$
    RewriteRule ^(.*)$ http://example.com$1 [R=301,L]
    Code:
    RewriteCond %{HTTP_HOST} !^example\.com$
    RewriteRule ^(.*)$ http://example.com$1 [R=301,L]
    Code:
    RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
    RewriteRule ^(.*)$ http://example.com/$1 [R=301,L,QSA]
    These are some examples of how to force www:
    Code:
    RewriteCond %{HTTP_HOST} ^example.com$ [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
    Code:
    RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
    Code:
    RewriteCond %{HTTP_HOST} !^www.example\.com$ [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L,QSA]
    Note that all servers are different and you may have to try several variations until you find one which works.
    Any custom rewrite rules must come before the XenForo rewrite rules.


    20. How do I force HTTPS instead of HTTP?
    If you are on an Apache server, this can be achieved by adding the following to the .htaccess file:
    Code:
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    Note that any custom rewrite rules must come before the XenForo rewrite rules.

    If HTTPS is not being set by the server automatically, add this to the end of the library/config.php file:
    PHP:
    $_SERVER['HTTPS'] = 'on';

    21. How do I restrict access to admin.php or the install directory to make them more secure?
    If you are on an Apache server, you can edit the .htaccess file to password protect it or limit it to an IP address. Refer to this guide for more information.


    22. Where can I access the PHP information on the server?
    Navigate to http://www.example.com/forum/admin.php?tools/phpinfo.


    23. How do I change the internal data path from the default of internal_data?
    Edit the library/config.php file and add the following:
    PHP:
    $config['internalDataPath'] = 'new_internal_data_path';
    Change the path to suit.
    Note that the path is relative to the installation path.


    24. How do I change the external data path from the default of data?
    Edit the library/config.php file and add the following:
    PHP:
    $config['externalDataPath'] = 'new_external_data_path';
    $config['externalDataUrl'] = 'new_external_data_url';
    Change the paths to suit.
    Note that the path is a file path (it can be relative to the installation path) and the URL is how the data will be loaded by users. These values need to point to corresponding locations.


    25. How do I change the JavaScript path from the default of js?
    Edit the library/config.php file and add the following:
    PHP:
    $config['javaScriptUrl'] = 'new_js_url';
    Change the path to suit.
    Note that the path is relative to the installation URL.


    26. How do I change the number of days for which the Admin Log in the ACP is retained?
    Edit the library/config.php file and add the following:
    PHP:
    $config['adminLogLength'] = 30;
    Change the value to the number of days required. The default setting is 60 days.


    27. How do I enable caching?
    Refer to the cache section of the XenForo Manual for instructions.


    28. How can I change the cookie settings such as domain, prefix, and path?
    Edit the library/config.php file and add the following:
    PHP:
    $config['cookie'] = array(
        
    'prefix' => 'xf_',
        
    'path' => '/',
        
    'domain' => ''
    );
    Edit the data as required. Refer to the discussion thread in the forum for more information.


    29. Where can I find a full list of switches for config.php?
    Refer to this section of the XenForo Manual.
     
  5. Brogan

    Brogan XenForo Moderator Staff Member

    Styling / Design

    1. How do I create a fixed width style?
    In the ACP -> Styles -> Style Properties -> General: Page Width Controller, enter the following settings in the Miscellaneous field:
    Code:
    width: 992px;
    margin: 0 auto;
    Change the values to suit.
    Note that with XenForo 1.2 and above, styles can be fully responsive. In order to utilise that functionality replace width with max-width.


    2. What is the relationship between parent and child styles?
    Child styles inherit the settings from the parent but can themselves also be individually styled. Refer to the discussion thread in the forum for more information.


    3. How do I add more elements to the message user block under the avatar in posts?
    This can be done in the ACP -> Styles -> Style Properties -> Message Elements


    4. How do I change the colours?
    This can be done in the ACP -> Styles -> Style Properties -> Color Palette. Refer to the Styling section of the XenForo Manual for more information.


    5. How can I apply styling to user titles and names?
    This can be done per user group via the User Title Override and User Name CSS fields. Refer to the User Group Styling section of the XenForo Manual for more information.


    6. How can I style each post so it is in a separate container or box?
    Refer to the discussion thread in the forum for instructions.


    7. How do I style the quote boxes?
    This can be done in the ACP -> Styles -> Style Properties -> BB Code Elements.


    8. How do I change the text colour of the unselected navigation tabs?
    Add this to the EXTRA.css template:
    Code:
    .navTabs .navTab.PopupClosed .navLink {
    color: @primaryDark;
    }
    Change the colour to suit.


    9. How do I change the background colour of the unselected navigation tabs?
    Add this to the EXTRA.css template:
    Code:
    .navTabs .navTab.PopupClosed .navLink {
    background-color: @primaryLight;
    }
    Change the colour to suit.


    10. How do I change the text colour of the navigation tabs on hover?
    Add this to the EXTRA.css template:
    Code:
    .navTabs .navTab.PopupClosed .navLink:hover {
    color: @secondaryDark;
    }
    Change the colour to suit.


    11. How do I change the background colour of the navigation tabs on hover?
    Add this to the EXTRA.css template:
    Code:
    .navTabs .navTab.PopupClosed .navLink:hover {
    background-color: @secondaryLight;
    }
    Change the colour to suit.


    12. How do I change the background colour of an individual category strip?
    Add this to the EXTRA.css template:
    Code:
    .nodeList .node_x .categoryStrip {
    background-color: @primaryLighter;
    }
    Replace node_x with the actual node ID, for example, node_10. Change the colour to suit.


    13. How do I replace the category strips with images?
    Refer to the discussion thread in the forum for instructions.


    14. How do I set custom icons for each forum?
    Refer to the discussion thread in the forum for instructions.


    15. How can I change the style of sticky threads?
    Refer to the resource for instructions.


    16. How can I apply styling to posts made by staff?
    You can use the .staff CSS class.


    17. How can I style alternate posts?
    Add this to EXTRA.css for odd and even posts respectively:
    Code:
    .message:nth-child(odd) {
    background-color: @primaryLighter;
    }
    
    .message:nth-child(even) {
    background-color: @primaryLight;
    }
    Change the styling to suit.


    18. How do I create custom thread prefix CSS?
    Refer to the resource for instructions.


    19. How do I change the text colour of the Copyright link?
    Add this to the EXTRA.css template:
    Code:
    #copyright {
    color: @dimmedTextColor !important;
    }
    Change the colour to suit.


    20. How do I change the text colour of the Terms and Rules link?
    Add this to the EXTRA.css template:
    Code:
    #legal a:link,
    #legal a:visited {
    color: @dimmedTextColor !important;
    }
    Change the colour to suit.


    21. How can I remove the title from the forum home page?
    Add one of the following to the EXTRA.css template:
    Code:
    .forum_list .titleBar {
    display: none;
    }
    or
    Code:
    .forum_list .titleBar h1 {
    font-size: 0px;
    }
    Note that this may have an impact on SEO. Refer to the discussion thread in the forum for more information.


    22. How can I limit the size of images in posts and conversations?
    Add this to the EXTRA.css template:
    Code:
    .message .messageContent .messageText img {
    max-width: 50%;
    }
    Adjust the percentage to suit, or substitute for a set pixel size.
    Note that the images will still zoom to full size when clicked. To prevent that append the max-width with !important, for example max-width: 50% !important;.


    23. How can I limit the size of images in signatures?
    Add this to the EXTRA.css template:
    Code:
    .signature.messageText img {
    max-width: 200px;
    }
    Adjust the size to suit, or substitute for a percentage.
    Note that the images will still zoom to full size when clicked. To prevent that append the max-width with !important, for example max-width: 200px !important;.


    24. How do I block images and quotes in signatures?
    With XenForo 1.2 and above, signature limits can be set via user and user group permissions.


    25. How can I make hidden members more obvious by adding * or other characters to the user name?
    Add this to the EXTRA.css template:
    Code:
    .invisible:before {
    content: "*";
    }
    
    .invisible:after {
    content: "*";
    }
    Change the * to the desired characters.


    26. How do I remove the bold font from category and forum titles for guests?
    Refer to the discussion thread in the forum for instructions.


    27. How do I make embedded images on Pages zoom to full size as they do in forum posts?
    You need to use the bbCodeImage CSS class. Refer to the discussion thread in the forum for more information.


    28. How do I place an image or advert in the header on the right?
    Use the ad_header template and wrap the contents in a div like so:
    Code:
    <div style="float: right">
        Image or advert code
    </div>

    29. How do I place an image or advert in the header on the right and center it vertically?
    Use the ad_header template and wrap the contents in a div like so:
    Code:
    <div style="display: block; float: right; line-height: {xen:calc '@headerLogoHeight - 4'}px; *line-height: @headerLogoHeight; height: @headerLogoHeight; vertical-align: middle">
        Image or advert code
    </div>
     
    LanceBase, JustinHawk, v2hao and 14 others like this.
  6. Brogan

    Brogan XenForo Moderator Staff Member

    Template Editing / Template Syntax

    1. What is the best way of manually editing the CSS if not using Style Properties?
    It is recommended to utilise EXTRA.css as this template is never overwritten during an upgrade. Refer to this resource for more information.


    2. How can I change some elements in EXTRA.css of a child style without duplicating all of the other content from the parent style template?
    Refer to the discussion thread in the forum for instructions.


    3. How can I find out which template to edit?
    Using your browser, view the page source and look for a line of code near the top of the page which begins
    <div id="content" class="; the class is the name of the template. So for the main forum page, the line of code is: <div id="content" class="forum_list">, which makes the template forum_list.


    4. Which template should I edit if I want it to be applied to all pages?
    The PAGE_CONTAINER template.


    5. Where can additional JavaScript be placed?
    Additional JavaScript can be placed in the PAGE_CONTAINER, page_container_js_head or page_container_js_body templates. If PAGE_CONTAINER is used, it can be placed anywhere in the template. If page_container_js_head is used, it will be included in the head section of PAGE_CONTAINER. If page_container_js_body is used, it will be included in the body section of PAGE_CONTAINER, after the footer. It depends on the JavaScript to a large extent; some require to be placed in the head, some in the body.


    6. How do I include a template?
    Code:
    <xen:include template="name_of_template" />

    7. How do I include a CSS template?
    Code:
    <xen:require css="name_of_css_template.css" />

    8. How do I include a JavaScript file?
    Code:
    <xen:require js="name_of_javascript_file.js" />

    9. How do I comment in a template to remove existing code or add notes?
    Code:
    <xen:comment>
        This content is commented out
    </xen:comment>
    Note that using <xen:comment> will prevent the content from being output (rendered) altogether, so it won't show even when viewing the page source.


    10. How do I add an internal URL link?
    Code:
    <a href="{xen:link 'link_path/'}">Link name</a>

    11. How do I add an external URL link?
    Code:
    <a href="link_path" target="_blank" class="externalLink">Link name</a>

    12. How do I add a sidebar to other pages or templates?
    Code:
    <xen:sidebar>
        Sidebar content
    </xen:sidebar>

    13. How can I add a sidebar without the member avatar block at the top?
    Code:
    <xen:sidebar>
        <xen:container var="$noVisitorPanel">1</xen:container>
        <xen:if is="!{$noVisitorPanel}">
            Sidebar content
        </xen:if>
    </xen:sidebar>

    14. How do I remove the breadcrumbs from a specific node or page?
    Add this to the EXTRA.css template:
    Code:
    .nodex .breadBoxTop,
    .nodex .breadBoxBottom {
    display: none;
    }
    
    Replace the x in nodex with the actual node ID, for example, node1.


    15. How can I tell if a class is CSS or JavaScript?
    Classes with an initial small case letter are CSS, classes with an initial capital letter are JavaScript.


    16. What is the purpose of <xen:edithint>?
    It instructs the editor in the ACP, as well as IDEs when editing templates via WebDAV, to load additonal tabs; i.e. templates which could be two levels of includes lower or included globally, such as the header CSS.


    17. Where can I find which variables are available?
    Refer to the discussion thread in the forum for more information.


    18. Where can I find which tags are available?
    That data is available in the library/XenForo/Template/Compiler.php file. Refer to the discussion thread in the forum for more information.


    19. Where can I find which helper functions are available?
    That data is available in the library/XenForo/Template/Helper/Core.php file. Refer to the discussion thread in the forum for more information.
     
    LanceBase, IPF, JustinHawk and 32 others like this.
  7. Brogan

    Brogan XenForo Moderator Staff Member

    Conditional Statements

    Due to the 10,000 character limit, the contents of this post have been recreated as a resource.

    Conditional Statements
     
  8. Brogan

    Brogan XenForo Moderator Staff Member

    Development

    1. How do I access the Development tab in the Admin Control Panel?
    Debug mode must be enabled.


    2. How do I enable debug mode?
    Edit the library/config.php file and add the following:
    PHP:
    $config['debug'] = true;
    Note that it is not advised to run a live site with debug mode enabled due to the increased resources utilised.


    3. How do I enable debug mode for a specific IP address?
    Edit the library/config.php file and add the following:
    PHP:
    if($_SERVER['REMOTE_ADDR'] == '127.0.0.1'){$config['debug'] = true;}
    Substitute 127.0.0.1 with the desired IP address.


    4. How can I find which parameters are available in a specific template?
    You can render a new template called DEFAULT in both the public and ACP areas until custom templates are authored, using the following code:
    PHP:
    return $this->responseView('Example_ViewPublic_Thing''DEFAULT'$viewParams);
    Note that the current controller name, action and view name will also be listed. Refer to the discussion thread in the forum for more information.


    5. How can I find which variables are available in a specific template?
    Refer to the discussion thread in the forum for instructions.


    6. How can I check if a specific variable is available in a template?
    Add the following code to the template:
    PHP:
    {xen:helper dump$variable_name}
    Replace variable_name with the actual variable. If an array is returned then it is available, otherwise if NULL is returned then it is not available.


    7. Where can I find a list of changes between database schemas for each release?
    Refer to the discussion thread in the forum for more information.


    8. How do I globally disable all listeners?
    Edit the library/config.php file and add the following:
    PHP:
    $config['enableListeners'] = false;

    9. How do I disable error reporting?
    Edit the library/config.php file and add the following:
    PHP:
    error_reporting(0);
    Note that this will prevent errors being reported on the front end and in the ACP server error log.


    10. How do I prevent email from being sent?
    Edit the library/config.php file and add the following:
    PHP:
    $config['enableMail'] = false;
     
  9. Brogan

    Brogan XenForo Moderator Staff Member

    Troubleshooting

    If you are experiencing a problem with your forum, there are some basic checks which can be done to try and identify the cause or provide more information. The following steps are not exhaustive, but should help in most cases.
    • Confirm all the files are present and correct by using ACP -> Tools -> File Health Check.
    • Check for outdated templates and phrases and revert them. Refer to this section of the FAQ for why that is necessary.
    • Confirm that the style you are using is compatible with the current version of the XenForo software. If in doubt, check whether the problem exists in an unedited, default style. You can create a new default style if required in the ACP -> Styles.
    • Confirm that any installed add-ons are compatible with the current version of the XenForo software.
    • Disable or uninstall all add-ons. If the problem is resolved, enable the add-ons one at a time until you identify which one is causing the problem.
    • Check for any errors in the ACP -> Tools -> Server Error Log.
    • Check the installation directory on the server for an error log file.
    • If you use cPanel or similar, check the error log and any other server error logs. Ask your host for support if you don't know how to do this or don't have access.


    Some of the actions listed below could cause your forum to stop functioning and result in lost or damaged data. Only attempt these if you are confident of what you are doing.


    1. How can I check the PHP information on my server?
    Navigate to http://www.example.com/forum/admin.php?tools/phpinfo.


    2. I mistakenly edited the master templates, how do I restore them or rebuild the master data without doing a re-installation?
    Navigate to the install path, for example http://www.example.com/forum/install/ and click on Rebuild Master Data.


    3. I am trying to upgrade but it is attempting to do a new installation, how do I proceed without overwriting the existing data?
    It's possible you have uploaded the files from the full package, rather than the upgrade package. Or you have uploaded the correct files but to the wrong location. Check that your data and internal_data directories have not been overwritten. If they have, you will need to restore the files from a backup. To continue with the upgrade, you will need to ensure the correct details are in library/config.php and replace the internal_data/install-lock.php file.


    4. I see a blank page, is there any way of seeing more details to identify the cause of the problem?
    A blank page is sometimes due to a suppressed error. Edit the library/config.php file and add the following:
    PHP:
    ini_set('display_errors'true);
    Or if you are on an Apache server, add this to the .htaccess file:
    Code:
    php_value display_errors 1

    5. I have a problem which may be related to an add-on, is there a way of quickly disabling all add-ons?
    Edit the library/config.php file and add the following:
    PHP:
    $config['enableListeners'] = false;

    6. I have the following error: Mysqli prepare error: Table './db_name/xf_session' is marked as crashed and should be repaired. How do I resolve it?
    Log in to phpMyAdmin and repair or truncate (empty) the xf_session table. If it occurs regularly then it could indicate server issues, which you should contact your host about.


    7. Why are members constantly being logged out?
    This is typically due to the server being configured to use a reverse proxy (which is constantly changing) and the real IP address isn't being exposed consistently, or due to CloudFlare being in use.
    If your server uses a reverse proxy, edit the library/config.php file and add the following:
    PHP:
    if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
    {
    $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    Note that the exact code depends on server configuration. You can confirm whether the variable being used for the correct IP address is 'HTTP_X_FORWARDED_FOR' by navigating to admin.php?tools/phpinfo when logged in to the XenForo ACP. It could be _SERVER['HTTP_X_REAL_IP'] or some other _SERVER value.

    If CloudFlare is in use, edit the library/config.php file and add the following:
    PHP:
    if (isset($_SERVER['HTTP_CF_CONNECTING_IP']))
    {
    $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP'];
    }

    8. I am experiencing PHP memory limit errors when uploading large files, how can I increase the limit?
    Edit the following entries in the php.ini file:
    Code:
    upload_max_filesize = 10M
    post_max_size = 10M
    Or if you are on an Apache server, add this to the .htaccess file:
    Code:
    php_value upload_max_filesize 10M
    php_value post_max_size 10M
    Change the values (in megabytes) to suit.


    9. I am receiving a fatal error related to allowed memory size when performing certain functions, how can I increase or remove the limit?
    To increase the limit, edit the library/config.php file and add the following:
    PHP:
    ini_set('memory_limit'256 1024 1024);
    Change the value (in megabytes) to suit. To remove the limit set the value to -1.


    10. I am receiving a fatal error related to maximum execution time when performing certain functions, how can I increase or remove the limit?
    To increase the limit, edit the following entry in the php.ini file:
    Code:
    max_execution_time = 180
    Or edit the library/config.php file and add the following:
    PHP:
    ini_set('max_execution_time'180);
    Or if you are on an Apache server, add this to the .htaccess file:
    Code:
    php_value max_execution_time 180
    Change the value (in seconds) to suit. To remove the limit set the value to 0. Note that values in library/config.php will always apply as they come after any XenForo specific values.


    11. After importing, all Conversations are marked as unread, how can I mark them all as read?
    Run the following queries:
    Code:
    UPDATE xf_conversation_recipient SET last_read_date = UNIX_TIMESTAMP();
    UPDATE xf_conversation_user SET is_unread = 0;
    UPDATE xf_user SET conversations_unread = 0;
    Note this will mark all conversations as read for all members. Refer to the discussion thread in the forum for more information.


    12. After importing, there are a large number of threads and posts in the Moderation Queue, is there a way to approve them all?
    Run the following queries for threads:
    Code:
    DELETE FROM xf_moderation_queue WHERE content_type = 'thread';
    UPDATE xf_thread SET discussion_state = 'visible' WHERE discussion_state = 'moderated';
    DELETE FROM xf_data_registry WHERE data_key = 'moderationCounts';
    The following queries for posts:
    Code:
    DELETE FROM xf_moderation_queue WHERE content_type = 'post';
    UPDATE xf_post SET message_state = 'visible' WHERE message_state = 'moderated';
    DELETE FROM xf_data_registry WHERE data_key = 'moderationCounts';
    Refer to the discussion thread in the forum for more information.


    13. Emails sent from my forum are being marked as spam, what can I do to resolve this?
    Refer to this resource for more information.


    14. Emails are failing or are not being received, what steps can I take to investigate and resolve it?
    Refer to this resource for more information.
     
    Cylent1, Jarod, LanceBase and 32 others like this.
Thread Status:
Not open for further replies.

Share This Page