This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Adding search to aggregator.module

Hello,
I would like to contribute some code to be included in the next release of Drupal. It adds search to aggregator.module

You can see it at work here: http://www.phillyfuture.org/search?keys=wifi

I believe this is a very important feature that should be part of Drupal's default aggregator.module. If you take a look at my example, it shows you just how poweful such a search can be - since it is limited by RSS feeds that are flowing thru my aggregator - it provides high quality results that are relevent to the mission of my site.

The feature was simple to add. I just added an implementation of hook_search():


/**
* Implementation of hook_search().
*/
function aggregator_search($keys) {
$find = array();

// Replace wildcards with MySQL/PostgreSQL wildcards.
$keys = str_replace('*', '%', $keys);

$words = explode(",", $keys);
foreach ($words as $word) {
$word = trim($word);
$title_filter[] = "lower(i.title) LIKE '%" . $word . "%'";
$feed_filter[] = "lower(f.title) LIKE '%" . $word . "%'";
$content_filter[] = "lower(i.description) LIKE '%" . $word . "%'";
}
$filter_query = implode(" OR ", $feed_filter) . ' OR ' .implode(" OR ", $title_filter) . ' OR ' . implode(" OR ", $content_filter);

$result = db_query_range("
SELECT i.*, f.link AS feed_link, f.title AS feed_title, f.url AS feed_rss
FROM {aggregator_item} i

Advertising at the top of node pages

I want my module to add advertising to all node and taxonomy pages.
I need not Drupal block, I need to place some HTML at the top of main area of the page.

Can I do it without modifying node and taxonomy modules or themes ?

Article.mod -- Depth question

In the Taxonomy.mod if you change the param "Depth", you can change the depth result. Form what I'm seeing the Article.mod, it has the same feature and I have made a paste of the code in question below. I'm not a programer, so really I don't have clue what it actually does. But from the little I do understand it looks like it should work, but it hasn't been. could somone comment please. i;ve been chagng the $depth on line 14.

* @param $tids
* An array of term IDs to match.
* @param $operator
* How to interpret multiple IDs in the array. Can be "or" or "and".
* @param $depth
* How many levels deep to traverse the taxonomy tree. Can be a nonnegative
* integer or "all".
* @param $pager
* Whether the nodes are to be used with a pager (the case on most Drupal
* pages) or not (in an XML feed, for example).
* @return
* A resource identifier pointing to the query results.
*/
function article_select_nodes($tids = array(), $operator = 'and', $depth = 1, $pager = TRUE, $count = 0) {
if (count($tids) > 0) {
// For each term ID, generate an array of descendant term IDs to the right depth.
$descendant_tids = array();
if ($depth === 'all') {
$depth = NULL;
}
foreach ($tids as $index => $tid) {
$term = taxonomy_get_term($tid);
$tree = taxonomy_get_tree($term->vid, $tid, 1, $depth);
$descendant_tids[] = array_merge(array($tid), array_map('_taxonomy_get_tid_from_term', $tree));

Code Snippets module

Snippets offer functionality similar to standard PHP-execution filter, but I hope in more flexible manner. Site admin or power users may create named snippets of PHP-code (with access to Drupal API), then categorize and store them to the site code repository. Particular users can't view PHP-code - only snippet name and help. From user point of view - snippets are macros, which may be used in postings - nodes and comments. Macros may accept parameters which transferred to snippet code. Example: [macro], [macro|param1|param2], [link|9165].

Where are Permissions by role defined in the Database?

Where are Permissions by role defined in the Database?

I have created a Module that uses the _perm hook but I am curious where it is actually stored within the system? I have looked throught the database and cannot find it under any of the tables.

I thought it would be under the variables table but did not see it in there.

Very curious because I wanted to clean up some old hooks I made. Mostly because I want to know where Drupal keeps this list.

Thanks!

Form validation for user profiles?

I've added a bunch of new user profiles under: administer -> users -> configure -> profiles

If I want to do some simple data validation on these new fields, what is the most logical place to put my PHP code?

thanks!

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions