Add search by node creation date and the author
mohanjith - March 12, 2008 - 20:30
| Project: | Drupal |
| Version: | 7.x-dev |
| Component: | node system |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Description
It makes sense to be able to search by author and the creation date for a site with many nodes. This patch will add the ability to search by the author and creation date.
| Attachment | Size |
|---|---|
| node.module.patch | 3.58 KB |
| Testbed results | ||
|---|---|---|
| node.module.patch | failed | Failed: Failed to apply patch. Detailed results |

#1
Attaching a revised version of the patch that is relative to the main drupal folder.
#2
created-evaluator looks specific to your site. Can you make that a generic Drupal term?
#3
-1 to module_exists('js_calendar') as well.
#4
created-evaluator is the name of the form-field for the comparison selector, not site-specific
+ $form['advanced']['created']['created-evaluator'] = array(
+ '#type' => 'select',
+ '#title' => t('Created date comparison'),
+ '#options' => array('' => '---', '<' => 'Before', '=' => 'On', '>' => 'After'),
+ '#multiple' => FALSE,
+ );
#5
This still needs a reroll minus the js_calendar code.
#6
#7
I've rerolled to remove the js_calendar part, renamed created-evaluator to created-comparator, and added the searching code for 'author', which was missing.
Still not really a fan of the organization, but I think fixing that would be for a follow-up patch.
#8
Alright, a few tabs in that patch. Here's a new one without tabs.
There should really be a check for all submitted patches through coder.module to confirm that the coding standards were adhered to. Would probably speed up development time.
#9
Makes it a little nicer to have the autocomplete feature available for usernames if the user have
access user profilespermission.I would think it'd be easier if the FAPI for textfield could check the menu system for appropriate permissions before attaching autocomplete URLs than having to do the check this way.
#10
Maybe it's necessary another revision for Drupal 5.10.
The last part of patch doesn't match node.module:
@@ -1978,6 +2030,15 @@if (isset($form_state['values']['language']) && is_array($form_state['values']['language'])) {
$keys = search_query_insert($keys, 'language', implode(',', array_filter($form_state['values']['language'])));
}
+ if (isset($form_state['values']['author']) && $form_state['values']['author'] != '') {
+ $keys = search_query_insert($keys, 'author', $form_state['values']['author']);
+ }
+ if (isset($form_state['values']['created-comparator']) && $form_state['values']['created-comparator'] != '') {
+ $keys = search_query_insert($keys, 'created-comparator', $form_state['values']['created-comparator']);
+ }
+ if (isset($form_state['values']['created-date']) && $form_state['values']['created-date'] != '' && strtotime($form_state['values']['created-date']) !== FALSE) {
+ $keys = search_query_insert($keys, 'created-date', strtotime($form_state['values']['created-date']));
+ }
if ($form_state['values']['or'] != '') {
if (preg_match_all('/ ("[^"]+"|[^" ]+)/i', ' ' . $form_state['values']['or'], $matches)) {
$keys .= ' ' . implode(' OR ', $matches[1]);
#11
This patch isn't for Drupal 5.x, it's for 7.x, as all feature requests currently should be.
#12
#13
Why was this set to "won't fix"? Looks like a useful addition to node.module to me!
#14
The last submitted patch failed testing.