Allows processing of URLs to display custom post listing (search) pages in backend. Search parameters must be contained in a URL and must be specified in the form accepted by PHP scripts as an array. The array must be contained in parameter named 'search' and must contain single item with its key matching plugin ID; e.g., ?search[myplugin][key]=myposts&search[myplugin][status]=1.


Input (passed by reference)

$params array Search parameters array.
$params[plugin][%plugin_id%] array Array passed by means of GET parameters.
… your plugin code …


Array of JOIN clauses for post selection SQL query in the following format:
    'wa_contact' => array(    //array keys must be table names
        'type' => '', //e;g;, 'LEFT'
        'condition' => array(    //parts of 'ON' condition
            ' = blog_post.contact_id',
        'fields' => array(    //fields of joined table and their aliases to be returned by SQL auery
            'name' => 'contact_name',
            'company',    //if no alias is specified, field name is used as its alias
        'values' => array(    //alternative way to specify list of joined table's fields to be returned
            'name' => 'contact_name',    //in this case aliases are required
Simple array of WHERE clauses for post selection SQL query:
    'contact_id = 123',
    'LENGTH(TITLE)  > 100',
ORDER BY clauses for post selection SQL query.

Plugin code example


public function searchPostsBackend($params)
    waLog::log(print_r($params, true), 'blog/myplugin/search-posts-backend.log');

    //E.g., display posts added by current user at URL /webasyst/blog/?search[myplugin]=myposts
    if (isset($params['plugin'][$this->id])) {
        $result = array();
        if ($params['plugin'][$this->id] == 'myposts') {
            //adding custom WHERE condition
            $result['where'][] = 'contact_id = '.wa()->getUser()->getId();
            $response = wa()->getResponse();
            $response->setTitle(_wp('My posts'));
        } else {
            //select nothing if incorrect URL parameter value is passed instead of 'myposts'
            $result['where'][] = '0';
        return $result;