CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Custom Searches for Public Listing on Frontend
Pages: [1]

Author Topic: Custom Searches for Public Listing on Frontend  (Read 1438 times)

Cedeira

  • I post occasionally
  • **
  • Posts: 45
  • Karma: 1
    • CompuLogiX Systems, Inc.
Custom Searches for Public Listing on Frontend
November 13, 2008, 06:53:43 am
Hi all,

the wiki has the following to publish a custom search:
Quote
Test your search.
To load the search form, navigate to the following URL. In our example, the custom search record "value" we inserted was 6, so we use csid=6.
Drupal:
http://<your site>-/civicrm/contact/search/custom?csid=6&reset=1

Joomla:
http://<your site>-/administrator/index2.php?option=com_civicrm&task=civicrm/contact/search/custom&csid=6&reset=1

Unfortunately the Joomla code points to the /administrator/ branch which obviously is not available for anonymous access. How can I publish a custom search for public listings through the front end Joomla site with anonymous access? I looked through the forum without any luck. I also tried to copy the php file of the custom search to the custom directories, but I keep on getting the "You do not have permission to execute this url." message.

thanks,
Jose
God grant me the serenity to accept the things I can not change, valor to change the ones I can, and the knowledge to recognize the difference!

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Custom Searches for Public Listing on Frontend
November 13, 2008, 06:58:38 am

custom search is just another variation of basic / advanced search. If you expose custom search to the anon user, you will need to expose most of civicrm functionality to the anon user. If this is something you want to do, you need to modify component/com_civicrm/civicrm.php, function civicrm_check_permission

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Cedeira

  • I post occasionally
  • **
  • Posts: 45
  • Karma: 1
    • CompuLogiX Systems, Inc.
Re: Custom Searches for Public Listing on Frontend
November 13, 2008, 07:16:06 pm
After doing some research I though as much. The fact that most of the code in Civi is stored under the administrator/components/com_civicrm/civicrm gave me some clues. I assume that only certain "backend" features such as profiles, events, etc, basically the ones that can be used when creating links in Joomla, are exposed to the front end through the Joomla component and thus also available to be accessed through links, etc.

I will look into your suggestion.

thanks Lobo.


God grant me the serenity to accept the things I can not change, valor to change the ones I can, and the knowledge to recognize the difference!

Cedeira

  • I post occasionally
  • **
  • Posts: 45
  • Karma: 1
    • CompuLogiX Systems, Inc.
Re: Custom Searches for Public Listing on Frontend
November 14, 2008, 08:29:30 pm
Lobo,

your suggestion led me to try the following:

File(s): www/components/com_civicrm/civicrm.php
   Code change, line: 99 to 103
Added:
Code: [Select]
// allow custom contact search to be listed from front end for non authenticated users.
if ( $arg1 == 'contact' &&
         $arg2 == 'search' &&
         $arg3 == 'custom') {
return true;
    }
 

In addition I updated the following:

File: www/administrator/components/com_civicrm/civicrm/CRM/Contact/Form/Search/custom.php
   Code change, line: 65
   From:   CRM_Utils_System::appendBreadCrumb( $breadCrumb );
   To:   // CRM_Utils_System::appendBreadCrumb( $breadCrumb );
Purpose: remove the breadcrumb line in the custom listing for front end display so that non-authenticated users won’t be able to access the list of custom searches.

I have some concerns on this solution as the link in the browser has the CSID of the custom search and I could imagine someone trying to access other searches by trying different numbers for CSID. By modifying the custom.php file and removing the breadcrumbs there I can make it so that the form only lists the custom search results I need. I think if I insert this in some masking of the link I might be able to show the custom search results without any security issues. The code changes only allows access to the backend if the link contains "contact/search/custom".

I have to find where the other breadcrumbs are coming from as it stands the form still shows the  "Civicrm>>Find Contacts" breadcrumbs.

Any comments or constructive criticism is welcomed.

thanks,
Jose



« Last Edit: November 14, 2008, 08:41:20 pm by Cedeira »
God grant me the serenity to accept the things I can not change, valor to change the ones I can, and the knowledge to recognize the difference!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Custom Searches for Public Listing on Frontend

This forum was archived on 2017-11-26.