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

Using wildcards inside mysql statements with db_query()

How can i use the '%' multiple character wildcard in a query when the '%' is used to specify the arguments in that query ?

If I use it, it casts the error of too few args for the sprintf in db_query().

Replacing the '%' with the right number of its single character equivalent '_' does the job for my case.
But someday someone (me?) will need multiple character wildcard in his queries.

block module

hoi!

i'm trying to learn how to write a drupal module, that puts a block at the side. i read the "Creating modules: post 4.3.1" in the module developer's guide and tried to do the same. i can select the module in the modules section, but the block does not appear in the blocks section and i also can not see any permission. this is even if i copy and paste the onthisdate module from the module developer's guide.

MP3 field type for flexinode

I'm attempting to write an MP3 field type for the flexinode module. It is my first real forray into Drupal as a programmer, and I am already in need of guidance.

The field is an extended version of field_file.inc which does the following:
1 - accepts only a restricted set of filetypes (.mp3 and possibly other music formats)
2 - reads and stores metadata contained in the MP3
3 - creates an m3u file and tracks its location
4 - displays links to both the mp3 (for download) and the m3u (for streaming).

Filestore2 with node based file access control

Hi,

Today I made it my task to hack role based access control to uploaded files into Drupal. It turned out to be considerably easier than I originally anticipated. I'm new to drupal development, so I'm posting to ask how well my approach conforms with the "drupal way" and how secure it is.

This was done using a checkout from drupal cvs on the 15th of August. First of all, the filestore2 module makes a call to filter_tips_short which has been removed in the current version of drupal, so I changed this to filter_filter_tips(0, FI
LTER_HTML_STRIP). I don't know if this is right, but it works at least.

It is reasonable to assume that if someone has access to the node with which the file is associated, then they should have access to the file itself. Someone can only really know the url for the file itself without appropriate access permissions if they are doing something bold. Therefore, all we have to do before making a call to fscache_download is call node_access() to see if the user is allowed to read the node associated with the file. If it is, we proceed as normal by calling fscache, otherwise we do nothing and a blank document gets returned.

Comments very gratefully received.

PATCH:

91d90
<
94,97c93,98
< $node = node_load(array("nid" => arg(2)));
< if (fscache_download(array("fsid" => $node->fsid), TRUE)) {
< db_query("UPDATE {filestore2} SET downloads = downloads + 1 WHERE nid = $node->nid");

Comic strip module

I was looking for a module that would display a bunch of comic strips updated everyday, so I ended up writing one myself. You can see my implementation of it at http://forums.ahpnational.org/?q=comics. The module collection itself is at http://java.yukstah.com/~joe/comics.tar. I appreciate any sort of feedback on it. Please note that the sql is for PostGres, but it is very easy to port to MySql.

Using ping.module to notify Yahoo!

I'd like to modify ping to alert Yahoo! when my site is updated (as per their directions at http://my.yahoo.com/s/publishers.html#latepost), but I'm not especially familar with the format used. Normally I'd be happy to get in there and start messing with the code (and this looks fairly straightforward), but my site is in production, and I don't want to screw up my ping module. If anyone can shed a little light on this, I'd really appreciate it.

Thanks,
Dieter

Pages

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