-
AuthorPosts
-
brentwilliams2 Friend
brentwilliams2
- Join date:
- January 2013
- Posts:
- 231
- Downloads:
- 0
- Uploads:
- 23
- Thanks:
- 4
- Thanked:
- 33 times in 1 posts
May 13, 2015 at 2:22 am #206300I 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 ModeratorLuna Garden
- Join date:
- July 2011
- Posts:
- 2617
- Downloads:
- 80
- Uploads:
- 96
- Thanks:
- 78
- Thanked:
- 453 times in 425 posts
May 18, 2015 at 7:28 am #570878Hi 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 ModeratorLuna Garden
- Join date:
- July 2011
- Posts:
- 2617
- Downloads:
- 80
- Uploads:
- 96
- Thanks:
- 78
- Thanked:
- 453 times in 425 posts
May 18, 2015 at 7:28 am #735940Hi 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 Friendbrentwilliams2
- Join date:
- January 2013
- Posts:
- 231
- Downloads:
- 0
- Uploads:
- 23
- Thanks:
- 4
- Thanked:
- 33 times in 1 posts
May 18, 2015 at 5:25 pm #570972Thanks 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 Friendbrentwilliams2
- Join date:
- January 2013
- Posts:
- 231
- Downloads:
- 0
- Uploads:
- 23
- Thanks:
- 4
- Thanked:
- 33 times in 1 posts
May 18, 2015 at 6:34 pm #570974I 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.
-
AuthorPosts
This topic contains 5 replies, has 2 voices, and was last updated by Luna Garden 9 years, 6 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum