Closed (fixed)
Project:
Job Posting
Version:
5.x-1.3
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
13 Sep 2008 at 20:46 UTC
Updated:
9 Oct 2008 at 14:18 UTC
To make a listing have an expiry date, the existing code is:
$form['required']['job_posting_expires'] = array(
'#type' => 'radios',
'#title' => t('Expires'),
'#description' => t('Choose whether you want this job posting to have an
application deadline associated with it. Expiring nodes are automatically
de-activated and purged from display views once the specified deadline
passes. Pick false if you want this posting to remain active until manually
removed.'),
'#options' => array(1 => t('True'), 0 => t('False')),
'#required' => TRUE,
'#default_value' => isset($node->job_posting_expires) ? $node->job_posting_expires : 1,
'#weight' => -6,
);
And, to make it hidden I have it changed to this:
$form['required']['job_posting_expires'] = array(
'#type' => 'hidden',
'#value' => isset($node->job_posting_expires) ? $node->job_posting_expires : 1,
);
Once the job listing has reached its deadline it still exists (although, people can not apply for it). But, is there a way to have it disappear forever at deadline?
Have I done something wrong that would effect the job not to be 'de-activated and purged' from display views as it states in the description in original code?
Comments
Comment #1
Andy Galaxy commentedSorry, make it:
And, to make it hidden I have it changed to this:
Comment #2
gmarus commentedThat comment you're referring to regarding 'display views' only applies to the built-in node *listings* provided via the job_posting_list_nodes() and job_posting_block() functions which contain SQL to limit their result set based on whether a particular node is 'expirable' (sic?) and/or its deadline has passed.
The node display itself is not automatically deleted from the system and remains until it's removed manually just like any other node type. I did it this way partly to avoid 404s for search engines and anyone who bookmarks a particular listing before it expires. Many organizations might prefer to have these job postings remain in a sort of archival state anyway.
On a side note, if you want the job_posting_expires field to be 'read-only' you might consider using the 'value' type instead of 'hidden' so that it doesn't even appear in the markup:
Comment #3
Andy Galaxy commentedThanks gmarus. You are a lifesaver. I do understand...
As I have taken out
#type' => 'radios'and#options' => array(1 => t('Yes'), 0 => t('No')),would it not beComment #4
gmarus commentedYes. The ternary expression isn't needed since type is always going to be the same value. I don't think it matters much whether you use True or 1 since the value is ultimately stored in mysql as an int anyway (not sure about postgres, though so maybe True is slightly better) and PHP does type conversion.
Comment #5
Andy Galaxy commentedThanks gmarus. This module is great.
Comment #6
Andy Galaxy commentedHi gmarus
Looks like the client wants the job to "disappear" automatically once reaching deadline. Is this possible?
Regards
Comment #7
Andy Galaxy commentedI ended up paying someone to do this. Don't ask me what he did, but it works. All posts "unpublish" when deadline is reached.
Comment #8
gmarus commented