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

image_assist.module hack for theming

I wanted to change the output of the image filter, so I edited this line that I found in the module code, but nothing has changed in the output image.assist generates. It still gives me the same format. Where shall I change the code if I wanted to add some divs and classes? Thanks!

An archive for every drupal user

I've been a drupal site user/admin for over a year and have found all kinds of great things to use it for. Just upgraded my site to 4.5.2 and I have to say it doesn't leave me wanting for much. There are a few things I wish it could do so I figured it was about time to roll up my sleves and dive in...

The first thing I am attempting to do is to make the archive.module block and page blogcentric - that is to say context sensitive to the currently displayed blog. I've managed to hack archive.module using some keen xtreme programming methodology (read: 5 nights trial and error) and have actually got it to work - however it's pretty ugly. I'd like to a) clean up the code using more drupalese syntax b) perhaps port to a seperate module as that seems the way to do things properly 'round here

1) Ok so the first thing I did was put !^blog\/([0-9]*)! into the block path for archive (neat trick that) so the calendar only shows up on the blog pages.

2) Next, in the archive_calendar function I added a preg_match to hack out the user id of the current blog from $_GET['q'] like this:

// get the users uid from the url
preg_match("/^blog\/([0-9]*)/",$_GET['q'],$blog_uid);

I didn't like this much but I couldn't figure out how to get at the $uid variable or the $node->$uid attribute from the archive module. Is there a better way to do this than what I have above?

3) from there it is a simple matter of changing the SQL to include a peek at the n.uid so as to pull out only nodes for the current blog's user

Session Variables

Trying to figure out a way to do something once per session regardless of whether or not a user has logged in. Have tried setting a variable in the $_SESSION array, but it does not appear to be saved from one page/screen to the next. Any ideas on how to do this? BTW, I'm running Drupal 4.5.0

Thanks!

Radi Shourbaji
http://radi-shourbaji.profconnect.org

Filter function

at end of filter.module function _filter_autop($text) must be updated:


function _filter_autop($text) {
$text = preg_replace('|\n*$|', '', $text) ."\n\n"; // just to make things a little easier, pad the end
$text = preg_replace('|
\s*
|', "\n\n", $text);
$text = preg_replace('!(<(?:table|ul|ol|li|pre|form|blockquote|h[1-6])[^>]*>)!', "\n$1", $text); // Space things out a little
$text = preg_replace('!()!', "$1\n", $text); // Space things out a little
$text = preg_replace("/\n\n+/", "\n\n", $text); // take care of duplicates
$text = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "

$1

\n", $text); // make paragraphs, including one at the end
$text = preg_replace('|

\s*?

|', '', $text); // under certain strange conditions it could create a P of entirely whitespace
$text = preg_replace("|

(

  • |", "$1", $text); // problem with nested lists
    $text = preg_replace('|

    ]*)>|i', "

    ", $text);
    $text = str_replace('

    ', '

    ', $text);
    $text = preg_replace('!

    \s*(]*>)!', "$1", $text);
    $text = preg_replace('!(]*>)\s*

    !', "$1", $text);
    $text = preg_replace('|(?)\s*\n|', "

  • Filter function

    at end of filter.module function _filter_autop($text) must be updated:

    function _filter_autop($text) {
      $text = preg_replace('|\n*$|', '', $text) ."\n\n"; // just to make things a little easier, pad the end
      $text = preg_replace('|
    \s*
    |', "\n\n", $text); $text = preg_replace('!(<(?:table|ul|ol|li|pre|form|blockquote|h[1-6])[^>]*>)!', "\n$1", $text); // Space things out a little $text = preg_replace('!()!', "$1\n", $text); // Space things out a little $text = preg_replace("/\n\n+/", "\n\n", $text); // take care of duplicates $text = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "

    $1

    \n", $text); // make paragraphs, including one at the end $text = preg_replace('|

    \s*?

    |', '', $text); // under certain strange conditions it could create a P of entirely whitespace $text = preg_replace("|

    (

  • |", "$1", $text); // problem with nested lists $text = preg_replace('|

    ]*)>|i', "

    ", $text); $text = str_replace('

    ', '
    ', $text); $text = preg_replace('!

    \s*(]*>)!', "$1", $text); $text = preg_replace('!(]*>)\s*

    !', "$1", $text); $text = preg_replace('|(?)\s*\n|', "
  • Automatic login?

    Hi all! Was wondering if anyone has worked out a way to provide an "automatic login" based on ip address, user-agent, etc. What I'm trying to do is provide a way for search engines to "login" to the site automatically so they can spider the "members" version of content.

    Thanks!

    Radi

    Pages

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