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

What is wrong with this mysql statement?

I'm scratching my head over this... Especially as it works perfectly? I can't work out what might be causing the error(s)?

Anyways, here's the code:

<?php
/**
* Creates the table with adminitrating links for operations.
*/
function tablemanager_admin($tid, $list_length = 10000000) {
if (!$tid) {
return 'Invalid Table ID';
}
$sql = "SELECT tmd.id, tm.tid, tm.header, tmd.tid, tmd.data FROM {tablemanager_data} tmd INNER JOIN {tablemanager} tm ON tm.tid = tmd.tid WHERE tmd.tid = '$tid'";
$fetch = pager_query($sql, $list_length);
// fooled 'pager' into thinking we're using Drupals own calls, but we can't because of serialized data
// write the real query over the top of the pager one so we load $rows with ALL results
$fetch = db_query($sql);
$rows = array();
while ($result = db_fetch_object($fetch)) {
if (!$header) {
$header = unserialize($result->header);
array_push($header, array('data' => t('Operations'), 'colspan' => '2'));
}
$data = unserialize($result->data);
array_push($data, l(t('edit'), 'admin/tablemanager/edit/'.$result->id), l(t('delete'), 'admin/tablemanager/delete/'.$result->id));
$rows[] = array ( 'data' => $data);
}
if (!$header) {
$result = db_fetch_object(db_query("SELECT tm.tid, tm.header FROM {tablemanager} tm WHERE tm.tid = '$tid'"));

Bookreview Module

Apologies if this is the wrong forum.

I have installed the bookreview module and am in the process of changing the style. I am editing the bookreview.css file.

My question is, how can I edit the gray background color as seen in the photo below:

http://img147.imageshack.us/img147/6238/screen31pd.jpg

Where is this color coming from, it doesnt seem to be defined in bookreview.css

Thank you.

Add administer section

Hi all. I have created my module but I have problem with create the administation section.

I have these functions:


/**
* Implementation of hook_perm().
*/
function zbnews_perm() {
return array('create zbnews', 'edit own zbnews','administer zbnews');
}

/**
* Implementation of hook_access().
*/
function zbnews_access($op, $node) {
global $user;

if ($op == 'create') {
return user_access('create zbnews');
}

/*
if ($op == 'update' || $op == 'delete') {
if ((user_access('edit own zbnews') && ($user->uid == $node->uid)) || user_access('administer zbnews')) {
return TRUE;
}
}
*/
}

function zbnews_menu($may_cache) {
$items = array();

if ($may_cache) {
$items[] = array('path' => 'node/add/zbnews', 'title' => t('Aggiungi una notizia'),
'access' => user_access('create zbnews'));
}

$items[] = array(
'path' => 'zbnews/goto',
'title' => t('Pagina di redirect'),
'callback' => 'zbnews_goto',
'type' => MENU_CALLBACK,
'callback arguments' => $node ,
'access' => user_access('create zbnews'));

if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
if ($node->nid) {
$items[] = array('path' => 'node/'. arg(1) .'/edit', 'title' => t('edit'),
'callback' => 'zbnews_form',
'access' => node_access('administer zbnews', $node),

Converting 4.6 - 4.7 + advice wanted on etiquette

I have some half-dozen modules that need converting to Drupal 4.7 - and since I'm a plagiarist at heart a lot of "my" code is a bit opaque to me. Imagine my dismay when I saw the list of critical-looking modifications that have to be made to Drupal modules to upgrade from 4.6 to 4.7!

Chat module

I've played with a few chat modules, but I would like to know is there any way to restrict access to chat modules based on roles? I would like two different roles to have 2 different chat boxes. Is there anything like that available?

My other alternative would be to make a simple chat module using ajax and just get it done that way.

What do you think?

Adding hooks for insert, update, delete, load to core modules.

I'm trying to add several fields to the core blog.module -- for image id handling, and a few other things I need for our site.

In my own node type modules, I have been using hook_insert, hook_delete, hook_update, hook_load - to manage updates to a seperate table. But when I try to do the same thing within the blog.module, these hooks don't get called. Wondering if there is another way for handling a core module?

Modified section is below... the form seems to work fine. I have a node_blog table with the new fields in it.

Thanks
-Greg

<?php
/**
* Implementation of hook_form().
*/
function blog_form(&$node) {
global $nid;

$form['blogentry'] = array('#type' => 'fieldset', '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => -5, '#title' => t('Blog Entry'));
$form['blogentry']['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#required' => TRUE, '#default_value' => $node->title, '#weight' => -5);
$form['blogentry']['body_filter']['body'] = array('#type' => 'textarea', '#title' => t('Body'), '#default_value' => $node->body, '#rows' => 20, '#required' => TRUE);
//$form['body_filter']['filter'] = filter_form($node->format);

$form['blogimage'] = array('#type' => 'fieldset', '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => -4, '#title' => t('Blog Post Images'));
$form['blogimage']['imgId'] = array('#type' => 'textfield', '#title' => t('Full Size Image Id'), '#default_value' => $node->imgId, '#size' => 10, '#description' =>t('Enter the Image ID number for full size image from Gallery.'));

Pages

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