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

Posts on forum not visible

I installed the forum module and posted a new topic in a new container. When I checked the forum it said: "-1 new", but when I open the forum where the topic is at, that topic is not visible. But it is certainly there cause in the 'administer -> content' the topic is published.
What do I do to make those posts visible?

B.t.w. it is the first time I installed the module so the posts have never been visible before, they always were hide.

SQL query help

I'm trying to modify the using the voting.module so that it can display a sortable table listing each node's title along with the number of votes and average vote for that node. But I'm stuck and need some help to continue. Here's what I have so far (it's missing average vote and number of votes):

  $header = array(
    array('data' => t('title'), 'field' => 'n.title'),
    array('data' => t('changed'), 'field' => 'n.changed', 'sort' => 'desc'),
    array('data' => t('vote'), 'field' => 'v.vote'),
  );

  $sql = "SELECT n.nid, n.title,"
       . "   n.created, n.changed, v.vote"
       . " FROM {node} n"
       . " LEFT JOIN {votes} v ON n.nid = v.content_id  AND v.uid = $user->uid" 
       . " WHERE n.type = 'contribution'";
  $sql .= tablesort_sql($header);
  $result = pager_query(db_rewrite_sql($sql), 50);
    
  while ($row = db_fetch_object($result)) {
    $rows[] = array(l($row->title, "node/$row->nid"), date("Y-m-d", $row->changed), $row->vote);
  }
  
  if ($pager = theme('pager', NULL, 50, 0, tablesort_pager())) {
    $rows[] = array(array('data' => $pager, 'colspan' => 3));
  }

Here's the table that votes are stored in:


CREATE TABLE votes (
voting_id int(10) unsigned NOT NULL auto_increment,
content_type varchar(20) default NULL,
content_id int(10) unsigned default NULL,
vote tinyint(1) unsigned default NULL,

new node module wouldn't call hooks or display type

so after sitting here for many hours trying to figure out why some hooks were being called and others not in my new content type module, i realized the problem .....

the 'node type' field in the database only allows 16 characters and I had my module named with 16. I originally assumed it took the type from the name hook, but it seems to take it from the name you place on the module itself?

tablesort_sql and pager with query from form

I have a form with name, personalcode, fiscalcode and city. When the users write in the form I build the query and I make a pager. In the first step is ok, i have my data in the table with pager and the form.... but when user click in the pager or in the link to order the table, I lost the data in the form because the links are not correct.
The code is this:
[.....]
case t('search'):

$condition = '';
if ($edit['name']) {
if ($condition == '') $condition = ' name like \'%'.$edit['name'].'%\'';
else $condition .= ' AND name like \'%'.$edit['name'].'%\'';
}

if ($edit['fiscalcode']) {
if ($condition == '') $condition = ' fiscalcode like \'%'.$edit['fiscalcode'].'%\'';
else $condition .= ' AND fiscalcode like \'%'.$edit['fiscalcode'].'%\'';
}
if ($edit['personalcode']) {
if ($condition == '') $condition = ' personalcode like \'%'.$edit['personalcode'].'%\'';
else $condition .= ' AND personalcode like \'%'.$edit['personalcode'].'%\'';
}

if ($condition != '') $condition = ' WHERE '.$condition;

// Build the query
$sql = 'SELECT
id,
name,
city,
fiscalcode,
personalcode
FROM {gest_subject}
'.$condition;

// Title of table
$header = array(
array('data' => t('Nome/Ragione Sociale'), 'field' => 'name', 'sort' => 'desc'),
array('data' => t('Citta\''), 'field' => 'city'),

a problem of showing a png picture!

hi,all

I use GD lib for implementation of png picture showing and my simplified code is:

function show_image(){
        $bgpng = "png";
        $bg = imagecreatefrompng($bgpng);
        header("Content-Type: image/png");
        imagepng($bg);
        imagedestroy($bg);
}
show_image();

but the function "header()" cause an error:

Gallery Module Problem

Hope I am doing this right...am a newb... I have installed Drupal and Gallery2 and both work independently. Installed Galley module for Drupal and tried to setup. I may have screwed up either in not having Gallery in the Drupal directory OR not setting up the path correctly. In any case I have only totally blank Drupal pages unless I remove the Gallery Module from the Modules Directory. I tried re-installing and still no good. Just blank pages. I have tripped something up with the Galley module.

Pages

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