Module edits

Profile picture for user Delphium

This blog is an effort to make a note of any custom edits to modules used on the site.

Core

Core:- theme.inc
File:- /includes/theme.inc
[color=green]// What this edit does:- changes the way usernames are displayed by providing additional group info as a class so that user names may have different colours.[/color]</p> <p>[color=red]@FIND[/color]<br /> if (user_access('access user profiles')) {<br /> $output = l($name, 'user/'. $object->uid, array('attributes' => array('title' => t('View user profile.'))));</p> <p>[color=red]@REPLACE[/color]<br /> /*if (user_access('access user profiles')) {<br /> $output = l($name, 'user/'. $object->uid, array('attributes' => array('title' => t('View user profile.'))));*/<br /> $roles = array();<br /> if (user_access('access user profiles')) {<br /> $user = array();<br /> if (array_key_exists($object->uid, $roles)) {<br /> $roles = $user_roles[$object->uid];<br /> } else {<br /> $user = user_load(array('uid' => $object->uid));</p> <p> foreach ($user->roles as $user_role) {<br /> $roles[] = sprintf('user-role-%s', strtolower(str_replace(" ", "-", $user_role)));<br /> }<br /> $user_roles[$object->uid] = $roles;<br /> } </p> <p> $output = l($name, 'user/'. $object->uid, array('attributes' => array('title' => t('View user profile.'),'class' => join(" ", $roles) )));

Core:- robots.txt
File:- /robots.txt
[color=green]// What this edit does:- Prevents search engine bots from indexing certain parts of the site.[/color]</p> <p>[color=red]@FIND[/color]<br /> Disallow: /?q=user/login/</p> <p>[color=red]@ADD BELOW[/color]<br /> # Boost<br /> Disallow: /boost_stats.php</p> <p>#phpbb<br /> Disallow: /phpBB/*<br /> Disallow: /posting.php<br /> Disallow: /admin<br /> Disallow: /privmsg.php<br /> Disallow: /login.php<br /> Disallow: /images<br /> Disallow: /includes<br /> Disallow: /forums/viewtopic.php?f=47<br /> Disallow: /forums/viewtopic.php?f=50<br /> Disallow: /forums/viewtopic.php?f=51<br /> Disallow: /forums/viewtopic.php?f=52<br /> Disallow: /forums/viewtopic.php?f=53<br /> Disallow: /forums/viewtopic.php?f=54<br /> Disallow: /forums/viewtopic.php?f=55<br /> Disallow: /forums/viewtopic.php?f=56<br /> Disallow: /forums/viewtopic.php?f=47&t=*<br /> Disallow: /forums/viewtopic.php?f=50&t=*<br /> Disallow: /forums/viewtopic.php?f=51&t=*<br /> Disallow: /forums/viewtopic.php?f=52&t=*<br /> Disallow: /forums/viewtopic.php?f=53&t=*<br /> Disallow: /forums/viewtopic.php?f=54&t=*<br /> Disallow: /forums/viewtopic.php?f=55&t=*<br /> Disallow: /forums/viewtopic.php?f=56&t=*

Module:- Blog
File:- /modules/blog/blog.module
[color=green]// What this edit does:- changes the recent blogs block to show 6 items instead of the default 10.[/color]</p> <p>[color=red]@FIND[/color]<br /> $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, 10);</p> <p>[color=red]@REPLACE[/color]<br /> //$result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, 10);<br /> $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, 6);

Module:- Comment
File:- /modules/comment/comment.module
[color=green]// What this edit does:- changes the drop down options for number of drupal comments to display per page.[/color]</p> <p>[color=red]@FIND[/color]<br /> return drupal_map_assoc(array(10, 30, 50, 70, 90, 150, 200, 250, 300));</p> <p>[color=red]@REPLACE[/color]<br /> //return drupal_map_assoc(array(10, 30, 50, 70, 90, 150, 200, 250, 300));<br /> return drupal_map_assoc(array(10, 15, 20, 25, 30, 50, 75, 100, 150, 200, 250, 300));

Module:- Filter
File:- /modules/filter/filter.module
[color=green]// What this edit does:- check file for documentation[/color]</p> <p>[color=red]@FIND[/color]<br /> $match[2] = check_url($match[2]);

Module:- Profile
File:- /modules/profile/profile.module
[color=green]// What this edit does:- adds a modified user profile save function, for use with phpbb integration.[/color]</p> <p>[color=red]@FIND[/color]<br /> function _profile_get_fields($category, $register = FALSE) {<br /> $args = array();<br /> $sql = 'SELECT * FROM {profile_fields} WHERE ';<br /> $filters = array();<br /> if ($register) {<br /> $filters[] = 'register = 1';<br /> }<br /> else {<br /> // Use LOWER('%s') instead of PHP's strtolower() to avoid UTF-8 conversion issues.<br /> $filters[] = "category = '%s'";<br /> $args[] = $category;<br /> }<br /> if (!user_access('administer users')) {<br /> $filters[] = 'visibility != %d';<br /> $args[] = PROFILE_HIDDEN;<br /> }<br /> $sql .= implode(' AND ', $filters);<br /> $sql .= ' ORDER BY category, weight';<br /> return db_query($sql, $args);<br /> }</p> <p>[color=red]@ADD BELOW[/color]<br /> //delphium edit<br /> function profile_save_profile_delph(&$edit, &$user, $category, $register = FALSE, $hidden = FALSE) {<br /> $result = _profile_get_fields_delph($category, $register, $hidden);<br /> while ($field = db_fetch_object($result)) {<br /> if (_profile_field_serialize($field->type)) {<br /> $edit[$field->name] = serialize($edit[$field->name]);<br /> }<br /> db_query("DELETE FROM {profile_values} WHERE fid = %d AND uid = %d", $field->fid, $user->uid);<br /> db_query("INSERT INTO {profile_values} (fid, uid, value) VALUES (%d, %d, '%s')", $field->fid, $user->uid, $edit[$field->name]);<br /> // Mark field as handled (prevents saving to user->data).<br /> $edit[$field->name] = NULL;<br /> }<br /> }<br /> function _profile_get_fields_delph($category, $register = FALSE, $hidden = FALSE) {<br /> $args = array();<br /> $sql = 'SELECT * FROM {profile_fields} WHERE ';<br /> $filters = array();<br /> if ($register) {<br /> $filters[] = 'register = 1';<br /> }<br /> else {<br /> // Use LOWER('%s') instead of PHP's strtolower() to avoid UTF-8 conversion issues.<br /> $filters[] = "LOWER(category) = LOWER('%s')";<br /> $args[] = $category;<br /> }<br /> /*if (!user_access('administer users') and !$hidden) {<br /> $filters[] = 'visibility != %d';<br /> $args[] = PROFILE_HIDDEN;<br /> }*/<br /> $sql .= implode(' AND ', $filters);<br /> $sql .= ' ORDER BY category, weight';<br /> return db_query($sql, $args);<br /> }<br /> // end delphium edit

Module:- Search
File:- /modules/search/search.module
[color=green]// What this edit does:- changes the search box title[/color]</p> <p>[color=red]@FIND[/color]<br /> '#title' => t('Search this site'),</p> <p>[color=red]@REPLACE[/color]<br /> //'#title' => t('Search this site'),<br /> '#title' => t('Search Articles & Games'),

File:- /modules/search/search-block-form.tpl.php
[color=green]// What this edit does:- adds the opensearch plugin install link[/color]</p> <p>[color=red]@FIND[/color]<br /> <?php print $search_form; ?></p> <p>[color=red]@ADD BELOW[/color]<br /> <?php //print '<span class="opensearch"><a title="Install WSGF Search Plugin" href="javascript:void(0)" onclick="addProvider(\'/wsgfsearch.xml\',\'false\',\'WSGF\')">Install WSGF Search Plugin</a></span><span class="searchnewtab"><a target="_blank" href="/search/apachesolr_search/">Open New Tab</a></span>'; ?>

Modules

Module:- Apachesolr
File:- /sites/all/modules/apachesolr/apachesolr.module
[color=green]//What this edit does:- Adds the content node type to the "more like this" search output so that it may have CSS applied to it.[/color]</p> <p>[color=red]@FIND[/color]<br /> 'fl' => 'nid,title,path,url',</p> <p>[color=red]@REPLACE[/color]<br /> //'fl' => 'nid,title,path,url',<br /> 'fl' => 'nid,title,path,url,type',

[color=green]//What this edit does:- reformats the output displayed for "more like this" search results, allowing us to apply classes for CSS to add a content type icon to the list.[/color]</p> <p>[color=red]@FIND[/color]<br /> $links[] = l($result->title, $result->path, array('html' => TRUE));</p> <p>[color=red]@REPLACE[/color]<br /> //$links[] = l($result->title, $result->path, array('html' => TRUE));<br /> $links[] = '<a class="morelikethis mlt-'.$result->type.'" href="/'.$result->path.'">'.$result->title.'</a>';

Module:- Pathologic
File:- /sites/all/modules/pathologic/pathologic.module
[color=green]// What this edit does:- fixes a bug where URL encoded HTML was being incorrectly decoded, for example & would be changed to &%3B, this change fixes this bug.[/color]</p> <p>[color=red]@FIND[/color]<br /> parse_str($parts['query'], $qparts);</p> <p>[color=red]@REPLACE[/color]<br /> //parse_str($parts['query'], $qparts);<br /> parse_str(html_entity_decode($parts['query']), $qparts);

Module:- Purge
File:- /sites/all/modules/purge/purge.inc
[color=green]// What this edit does:- fixes a bug where 404 Not Found was displayed on a working page several times at the top of the page, the issue is related to CURL and PHP 5.4.8 and greater.[/color]</p> <p>[color=red]@FIND[/color]<br /> // Block until there is activity on any of the handlers. Avoids<br /> // busywaiting.<br /> if ($multi_result == CURLM_OK) {<br /> $select_result = curl_multi_select($curl_purges);<br /> }<br /> if ($multi_result != CURLM_OK || $select_result == -1) {<br /> // @TODO: error handling. Something truly awkward happened.<br /> return FALSE;<br /> }<br /> } while ($select_result != -1 && $active && $multi_result == CURLM_OK);<br /> ob_end_clean();</p> <p>[color=red]@REPLACE[/color]</p> <p> // Block until there is activity on any of the handlers. Avoids<br /> // busywaiting.<br /> if ($multi_result == CURLM_OK) {<br /> /* https://www.drupal.org/node/75790#comment-2615716<br /> $select_result = curl_multi_select($curl_purges);<br /> }<br /> if ($multi_result != CURLM_OK || $select_result == -1) {<br /> // @TODO: error handling. Something truly awkward happened.<br /> return FALSE;<br /> */<br /> // According to https://bugs.php.net/bug.php?id=63411, in PHP 5.3.18+<br /> // curl_multi_select can return immediately if libcurl cannot block, but<br /> // still has something to process, so we block a bit ourselves.<br /> if (curl_multi_select($curl_purges) == -1) {<br /> // Wait 0.1 second.<br /> usleep(100000);<br /> }<br /> }<br /> } //while ($select_result != -1 && $active && $multi_result == CURLM_OK);<br /> while ($active && $multi_result == CURLM_OK);<br /> ob_end_clean();