Answers.Body: <p>The custom search interface does not implement an API for those actions as yet. I dont think those are hookable right now, but I suspect the best first step would be to modify the code (and submit the patch back) to make those actions hookable.</p>
  
  <p>Once that is done, it should be relatively easy, for the custom search interface to expose the hook as an API</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-15T07:46:03.610Z
Answers.Text: Thanks Lobo. I will look into that. Another point related to above codes. On  civicrm 4.6, when I manually select a result by using the checkbox,  ACTION MENU (below search parameters) remains deactivated.  Action options only activates if i select the option "Select ALL Records". How can I fix it Please?
Answers.UserDisplayName: Tapash
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-15T15:28:06.753Z
Answers.Text: That seems like  a bug. can you please try and reproduce this on our demo servers
Answers.UserDisplayName: Donald Lobo
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-16T10:27:17.660Z
Answers.Text: I think its more like my script than bug, bcos all other searches are working perfectly fine, in terms of selecting few contact from result and execute an action based on that. Do you see anything in my script that can be adjusted to work?
Answers.UserDisplayName: Tapash
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-14T15:00:56.567Z
Answers.LastActivityDate: 2015-04-14T15:00:56.567Z
Answers.UserDisplayName: Donald Lobo
Body: <p>I have a custom search extension for contacts. Search result shows by default "VIEW EDIT" option in "ACTION" Column.</p>
  
  <p>How Can I bring the "MORE" option just like the one appears if I use built in Basic search function from Search menu?</p>
  
  <p>Content of my customsearch.php</p>
  
  <pre><code>        &lt;?php
  
  class CRM_Guestsearch_Form_Search_Guestsearch extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface {
  
        function __construct(&amp;$formValues) {
          parent::__construct($formValues);
        }
  
        function buildForm(&amp;$form) {
          CRM_Utils_System::setTitle(ts('Recently Registered Guest (Unassigned)'));
  
          $form-&gt;assign('elements', array('name'));
        }
  
        function summary() {
          return NULL;
          // return array(
          //   'summary' =&gt; 'This is a summary',
          //   'total' =&gt; 50.0,
          // );
        }
  
        function &amp;columns() {
          // return by reference
          $columns = array(
            ts('Contact Type') =&gt; 'contact_sub_type',
            ts('Name') =&gt; 'sort_name',
            ts('Phone') =&gt; 'phone',
            ts('Email') =&gt; 'email',
            ts('Date of visit') =&gt; CIVICRM_GUESTSEARCH_CUSTOM_COLUMN_NAME,
          );
          return $columns;
        }
  
        function all($offset = 0, $rowcount = 0, $sort = NULL, $includeContactIDs = FALSE, $justIDs = FALSE) {
  
          return $this-&gt;sql($this-&gt;select(), $offset, $rowcount, null, $includeContactIDs, NULL);
        }
  
        function select() {
          return "
            contact_a.id                  as contact_id  ,
            contact_a.contact_sub_type    as contact_sub_type,
            contact_a.sort_name           as sort_name,
            phone.phone ,
            email.email  ,
            date.
          " . CIVICRM_GUESTSEARCH_CUSTOM_COLUMN_NAME;
        }
  
        function from() {
          return "
            FROM      civicrm_contact contact_a
            LEFT JOIN civicrm_activity_contact a ON (a.contact_id = contact_a.id)
            LEFT JOIN civicrm_phone phone ON (phone.contact_id = contact_a.id)
            LEFT JOIN civicrm_email email ON (email.contact_id = contact_a.id)
            LEFT JOIN " . CIVICRM_GUESTSEARCH_CUSTOM_TABLE_NAME . " date ON (date.entity_id = contact_a.id)
          ";
        }
  
        function where($includeContactIDs = false) {
          $params = array();
  
          $where = "contact_a.contact_sub_type = 'Guest' AND activity_id IS NULL ORDER BY date." . CIVICRM_GUESTSEARCH_CUSTOM_COLUMN_NAME . " ASC ";
              return $where;
            }
  
        function templateFile() {
          return 'CRM/Contact/Form/Search/Custom.tpl';
        }
      }
  </code></pre>
  
Tags: <search><search-results><custom-search>
Title: How to add "ACTION" Column in a custom Search?
ThreadText: # How to add "ACTION" Column in a custom Search?
  
  (Asked by: username_0 on 2015-04-14)
  
  I have a custom search extension for contacts. Search result shows by default "VIEW EDIT" option in "ACTION" Column.
  How Can I bring the "MORE" option just like the one appears if I use built in Basic search function from Search menu?
  Content of my customsearch.php
          assign('elements', array('name'));
        }
  
        function summary() {
          return NULL;
          // return array(
          //   'summary' => 'This is a summary',
          //   'total' => 50.0,
          // );
        }
  
        function &columns() {
          // return by reference
          $columns = array(
            ts('Contact Type') => 'contact_sub_type',
            ts('Name') => 'sort_name',
            ts('Phone') => 'phone',
            ts('Email') => 'email',
            ts('Date of visit') => CIVICRM_GUESTSEARCH_CUSTOM_COLUMN_NAME,
          );
          return $columns;
        }
  
        function all($offset = 0, $rowcount = 0, $sort = NULL, $includeContactIDs = FALSE, $justIDs = FALSE) {
  
          return $this->sql($this->select(), $offset, $rowcount, null, $includeContactIDs, NULL);
        }
  
        function select() {
          return "
            contact_a.id                  as contact_id  ,
            contact_a.contact_sub_type    as contact_sub_type,
            contact_a.sort_name           as sort_name,
            phone.phone ,
            email.email  ,
            date.
          " . CIVICRM_GUESTSEARCH_CUSTOM_COLUMN_NAME;
        }
  
        function from() {
          return "
            FROM      civicrm_contact contact_a
            LEFT JOIN civicrm_activity_contact a ON (a.contact_id = contact_a.id)
            LEFT JOIN civicrm_phone phone ON (phone.contact_id = contact_a.id)
            LEFT JOIN civicrm_email email ON (email.contact_id = contact_a.id)
            LEFT JOIN " . CIVICRM_GUESTSEARCH_CUSTOM_TABLE_NAME . " date ON (date.entity_id = contact_a.id)
          ";
        }
  
        function where($includeContactIDs = false) {
          $params = array();
  
          $where = "contact_a.contact_sub_type = 'Guest' AND activity_id IS NULL ORDER BY date." . CIVICRM_GUESTSEARCH_CUSTOM_COLUMN_NAME . " ASC ";
              return $where;
            }
  
        function templateFile() {
          return 'CRM/Contact/Form/Search/Custom.tpl';
        }
      }
  
  **Tags:** search, search-results, custom-search
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-04-14. Score: 2
  
  The custom search interface does not implement an API for those actions as yet. I dont think those are hookable right now, but I suspect the best first step would be to modify the code (and submit the patch back) to make those actions hookable.
  
  Once that is done, it should be relatively easy, for the custom search interface to expose the hook as an API
  
  > **Comments:**
  > **username_0**: Thanks Lobo. I will look into that. Another point related to above codes. On  civicrm 4.6, when I manually select a result by using the checkbox,  ACTION MENU (below search parameters) remains deactivated.  Action options only activates if i select the option "Select ALL Records". How can I fix it Please?  
  > **username_1**: That seems like  a bug. can you please try and reproduce this on our demo servers  
  > **username_0**: I think its more like my script than bug, bcos all other searches are working perfectly fine, in terms of selecting few contact from result and execute an action based on that. Do you see anything in my script that can be adjusted to work?  
  
  ---
  
  