We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16834
    • 93 Posts
    hello

    using v1.8.0

    is there a way of getting search results from private documents visible to guest users? the intention is for the guest to click on the link and get the usual register/log-in form.

    i.e. can I force AjaxSearch not to respect access controls.

    thanks

    Lee
      • 5811
      • 1,717 Posts
      is there a way of getting search results from private documents visible to guest users?
      By using a parameter, I haven’t any solution.

      By hacking the code, to not take into account of the privacy of documents, simply comment the following block of code lines in the classes/search.class.inc.php file (line 285 to 326):
                // document group allowed regarding user authentification
                if ($this->validListIDs($this->cfg['docgrp'])) {
                  $this->main['jfilters'][] = array(
                    'tb_name' => "{$modx->dbConfig['dbase']}.`{$modx->dbConfig['table_prefix']}document_groups`",
                    'tb_alias' => 'dg',
                    'main' => 'id',
                    'join' => 'document',
                    'field' => 'document_group',
                    'oper' => 'isnull or in',
                    'value' => $this->cfg['docgrp']  
                  );
                }
                else {
                  // documents should be public
                  $this->main['filters'][] = array(
                      'field' => 'privateweb',
                      'oper' => '=',
                      'value' => '0'  
                  );     
                }
      By commenting these lines, the search occurs in all the documents (private or not).
      Unfortunately it doesn’t exist a placeholder regarding privacy to use for displaying or not the content. So if you hide the extract, you will do for all the documents found (private or not).
        • 16834
        • 93 Posts
        absolutely what I needed.

        many, many thanks

        L