Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • brentwilliams2 Friend
    #206300

    I know this is not normal support, but I’m hoping you all can help me with this since we are still waiting on a new version.

    I needed a list of jobs that filtered out jobs by a certain user. I couldn’t figure out how to do this with the normal filter, so I created a new page that would alter the DB if it used a certain layout. I successfully did this by altering the administrator/components/com_jajobboard/models/jajobs.php.

    I added this code approximately at line 273:

    $layout = JRequest::getVar('layout');
    if($layout == "paid"){
    $paid = ' WHERE profi.user_id <> 13584 ';
    }

    And then added the $paid to the query like so:

    $query = "
    SELECT DISTINCT a.id, a.*, value.*, profi.company, profi.logo, profi.id AS profileid {$fields_show}, l.title AS language_title
    FROM #__$this->_table_name as a"
    . $join
    . " LEFT JOIN #__{$this->_table_name}_value AS value ON value.id = a.id "
    . " LEFT JOIN #__languages AS l ON l.lang_code = a.language "
    . $paid
    . $where . " GROUP BY a.id ORDER BY "
    . $orderby . ', a.effected_date DESC';
    $db->setQuery($query, $limitstart, $limit);

    I then added this line to administratorcomponentscom_jajobboardviewsjaviewmenu.xml in order to create a new link with the layout I wanted:

    <item title="Job Manager - Paid" link="option=com_jajobboard&view=jajobs&layout=paid"/>

    All of this worked GREAT when clicking my new “Job Manager – Paid” link in the admin section. HOWEVER, when I click to page 2 using the pagination at the bottom, it reverts back to the full list of jobs.

    I tried adding this code to line 473 of administratorcomponentscom_jajobboardhelperjapagination.php:

    if (JRequest::getCmd('layout', 'paid') == "paid") {
    $layout = 'paid';
    }

    And that seemed to work – when I moused over the the link for page 2, it showed the “layout=paid” in the link. But when I clicked it, it still reverted to the original list.

    So my question is: Is there a way to apply the layout I want to subsequent pages in the pagination. OR, is there a different way that I can accomplish this altogether?

    Thank you!!

    Luna Garden Moderator
    #570878

    Hi Brent,

    Follow your description, <blockquote>I needed a list of jobs that filtered out jobs by a certain user. </blockquote>

    JA Jobboard already the filter job post by a certain user. Please check this capture here: http://easycaptures.com/fs/uploaded/838/3224032573.png

    Is this what you need ?

    Luna Garden Moderator
    #735940

    Hi Brent,

    Follow your description, <blockquote>I needed a list of jobs that filtered out jobs by a certain user. </blockquote>

    JA Jobboard already the filter job post by a certain user. Please check this capture here: http://easycaptures.com/fs/uploaded/838/3224032573.png

    Is this what you need ?

    brentwilliams2 Friend
    #570972

    Thanks for getting back to me, but what I need is the reverse of this. I need to show all jobs EXCEPT one particular user. My code above tries to filter out user #13584.

    brentwilliams2 Friend
    #570974

    I believe I have figured out an option that works. I used the user id filter you mentioned and changed the code so if I entered a user id of “1”, which doesn’t exist, then it would show me a list of jobs excluding the one I wanted to exclude. I’m guessing nobody else will need this, but just in case, here is what I did:

    Find the following in administrator/components/com_jajobboard/models/jajobs.php

    if ($user_id) {
    $where_clause[] = 'a.user_id=' . (int) $user_id;
    }

    Replace it with: (Make sure to change 13584 with the user id you want to exclude)

    if ($user_id) {
    if($user_id == '1'){
    $where_clause[] = 'profi.user_id <> 13584 ';
    } else {

    $where_clause[] = 'a.user_id=' . (int) $user_id;
    }
    }

    Then, you can add this line into administratorcomponentscom_jajobboardviewsjavi ewmenu.xml in order to create a new link to this filtered list of jobs:

    <item title="Job Manager - Paid" link="option=com_jajobboard&view=jajobs&user_id=1"/>

    Why would anyone want to do this? Well, this allows you to have one account where you post jobs yourself, and to separate that account from all the rest of the normal paying accounts.

Viewing 5 posts - 1 through 5 (of 5 total)

This topic contains 5 replies, has 2 voices, and was last updated by  Luna Garden 8 years, 11 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum