Put the Advanced Search Filter in a Block

Updated on Dec 18, 2015

When browsing for users on your PHPFox website, there are certain criteria that you can choose from. There is also a button for advanced search criteria, which includes all of the custom fields you created on your website.

 

However, this makes things complicated for your users as they need to perform one additional click to get there. As we always try to optimize certain features and allow users easier access to different functions, we are glad to present a way of creating a custom block on the browse section of your website, which will display all of the advanced search options directly on the same page.

 

Initially, the browse section has an Advanced Filter button and it looks like this:

 

Preview of standard advanced filter block in PHPFox

 

To complete the tutorial, you will need to follow these steps:

Step 1 Create a Custom Block

First, you need to access the administrative area of your PHPFox website. Log into your website as administrator and then click on the AdminCP button at the top-right corner of the screen.

 

Access administrative panel in PHPFox

 

Click on the CMS tab at the tom menu and then Blocks > Add New Block.

 

Add custom block in PHPFox

 

Edit the Block Details:

 

  • Product: Select Core
  • Module: Select User
  • Title: Enter the title of the new block
  • Type: HTML Code
  • Controller: user > user.browse
  • Placement: Block 3
  • Active: Set the block as active/inactive

 

You also need to enter the following code:

 

<form method="post" action="{if isset($aCallback.url_home)}{url link=$aCallback.url_home view=$sView}{else}{url link='user.browse' view=$sView}{/if}">
<div class="block">
<div class="title">
          {phrase var='user.advanced_filters'}
</div>
{foreach from=$aCustomFields item=aCustomField}
          {template file='custom.block.foreachcustom'}
{/foreach}
<input type="submit" value="{phrase var='user.browse_filter_submit'}" class="button" name="search[submit]" />
</div>
</form>

 

Choose the User groups that will have access to the block.

 

Edit block details in PHPFox

 

Hit the Submit button to keep the changes.

 

Step 2 Remove the Advanced Filter Button

If you wish to remove the Advanced Filter button from the browsing page, you will have to edit a core file of the product.

 

Void support

By editing core file of PHPFox, the support service their team provides will no longer be available for you. Thus, make sure that you are aware of the complications this may cause to your product before proceeding further.

To remove the button, you need to access the location of your PHPFox website via FTP. Then search for and access the following file:

 

          /module/user/template/your-template/block/filter.html.php

 

where your-template is the actual template you are using on your website. Edit the file and remove the following lines from it (around line 72):

 

<ul id="js_user_browse_advanced_link">
          <li><a href="#" onclick="$('#js_user_browse_advanced').show(); return false;" id="user_browse_advanced_link">{phrase var='user.advanced_filters'}</a></li>
          {if isset($bIsInSearchMode) && $bIsInSearchMode}
                    <li><a href="#"><a href="{url link='user.browse'}">{phrase var='user.reset_browse_criteria'}</a></a>          </li>
          {/if}
</ul>

 

When completing the changes above, the browse section on your website will look like the following screenshot.

 

Preview advanced filter block in PHPFox

On this page...

    PHPFox Hosting

    • Free PHPFox Installation
    • 24/7 PHPFox Support
    • Free Domain Transfer
    • Hack-free Protection
    • Fast SSD Storage
    • Free PHPFox Transfer
    • Free CloudFlare CDN
    • Immediate Activation
    View More