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

Random Quotes Block Module

Hi, I wrote this little module that displays random quotes in a block:

function random_quote_block($op = 'list', $delta = 0) {
  if ($op == 'list') {
    $blocks[0]['info'] = t('Random Quotes Block');
    return $blocks;
  }
  else if (user_access('access content')) {
    
	$quotes_array = file('quotes.txt');
	$quote = $quotes_array[rand(0, count($quotes_array) - 1)]; 
	$quote = trim($quote);
	$content = "<b><i>We tried to imagine our ideal boatyard...</i></b><br /><br />";
	$content .= "<i>&quot;".$quote."&quot;</i>";	
	$block['subject'] = t('');
    $block['content'] = $content;
    return $block;
  }
}

Everything went well, until I did an upgrade, whereupon all the single quotes (') in the quotes turned into question marks.

the quotes file looks like this:

We wanted a proper working boatyard with boatyard smells and activity where owners can come and go and do as much or as little on their boats as they wanted to; where there was professional advice and service on hand and expertise when it’s needed.
We wanted a quiet and peaceful location because we were going to spend a lot of time there and it was going to be holiday, care-free time to dream a little as well as to work and scrub and paint.
We wanted to feel that the yard would know us and know our boat and want to look after it and know how we wanted it to be kept and that it was safe when we left it.

Running form_alter on altered forms.

So, the new way to add stuff to the standard node_edit form is to use hook_form_alter. That's all good and dandy, except that I see no way to alter the alterations.

A concrete example:

Taxonomy has a taxonomy_form_alter function. This function changes the node_edit form to include category items.

Ambitious content type to discuss texts and other things....

Hopefully I can get across what it is I want, then maybe someone can point me (a newbie in Drupal development) in the right direction with tips / experience.

Ok, I will use an example to illustrate what I want. First, lets start with a snippet of legislation I'm getting from here:
http://www.publications.parliament.uk/pa/cm200506/cmbills/009/06009.i-iv...

-------

1 The National Identity Register

(1) It shall be the duty of the Secretary of State to establish and maintain a register
of individuals (to be known as “the National Identity Register”).

(2) The purposes for which the Register is to be established and maintained are
confined to the statutory purposes.

(3) The statutory purposes are to facilitate, by the maintenance of a record of registrable
facts about individuals in the United Kingdom—

(a) The provision of a convenient method for such individuals to prove
registrable facts about themselves to others; and

(b) The provision of a secure and reliable method for registrable facts about
such individuals to be ascertained or verified wherever that is
necessary in the public interest.

----
Now I'll define what words I'll use later when i get on to what I want....

As you can see we have a peice of text, with N levels in its hierarchy(here n =3, 1... (1)... and (a)...), I'll call all of the entries at one particular level a section, so that for example section "1." here is everything I've posted from the snippet, section "1. (1)" is just the two lines, and section "1.(3)" contains the 2 lines of text AND all of (a),(b). Finally, section "1.(1).(a)" contains only the two lines...

Syndicating events via RSS feed.

This is a module I'd like to see happen because it would save me work and allow a sort of content sharing beyond news/blogs. I administer a lot of different local websites and many of them have similar audiences but it's a pain in the ass to go into each of them and add events. So I was thinking it would be really cool if there was a way to subscribe to events via an RSS feed or something like that so that it could automatically add events from each other the different sites to the calendar.

Create a user in another Drupal site

I have 2 Drupal sites. They are on the same machine, but use different databases. Given a user click on one site, I want to be able to create a new user (or delete an old one) on the other site.

Given the sites are based on different databases on the same machine I guess I should be able to write the SQL that selects the other site's database and issues the SQL that does the INSERT or DELETE. But I suspect there's a bit more to adding or deleting users in a Drupal DB than that.

Recipe Module Import Option

I have over a hundred recipes that I would like to import to my Drupal site but I have no clue where to start.

Any advice would be nice. I would like to pay anyone for advice or any coding.

Thanks

Q

Pages

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