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

Need assistance sorting table *PLEASE*

I'm developing my own groups module. I've got a mysql table with group members (with a group id column and a member id column), and a group info mysql table with all the information regarding each group. I want to output a table with the name, date created, and number of members for each group. I also want to be able to sort on each of the headings. I got everything working, but I don't like the way the member count works. The problem is that the number of members is updated AFTER it's sorted. Can anybody please suggest a better way?
Here's what I have:
<?php
function group_groups_home()
{
$sql = "SELECT group_info.gid, group_info.title, group_info.nid, group_info.created, group_info.members FROM (group_info)";

$header = array(
array('data' => t('Group Name'), 'field' => 'title', 'width' => '100%'),
array('data' => t('Created'), 'field' => 'created', 'align' => 'center'),
array('data' => t('Members'), 'field' => 'members', 'align' => 'center')
);

$rows = array();

$sql .= tablesort_sql($header);
$result = pager_query($sql, 20);

while ($group = db_fetch_object($result)) {
// I don't like the way this is done, but this is the only way I could figure out how to sort by membercount
$membercount = mysql_num_rows(db_query("SELECT * FROM (group_members) WHERE group_members.gid = '%d'", $group->gid));

is there a 4-field node module I can hack instead of using flexinode

I want to make a content type called "example site" on www.drupalecommerce.com. I want it to have 4 fields like:
url
who made it
what modules it demonstrates
what else it demonstrates: themes, etc.

Are there any recommended books for module developers

Hi ,

Are there any recommended books for module developers which explains
drupal architecture in detail ?

If not is anyone thinking of writing such a book ?

Regards
Paul

An easy question?

I'm new at this... just wondering if anybody could point me in the direction of enabling / turning on a toolbar/line with bold/itallic/link/image and so forth for use in creating a page, block, etc.... It must be possible?

Getting a node's URL alias is not as easy as I thought... is there some other way?

I have a site with a great deal of nodes that want to appear on the front page, so I wrote a natty little module which just displays the titles neatly ordered in columns, and grouped by user.

Since about the same time my hosting provider was complaining to me that I was using far too much disc space, I decided to optimise things by using straight SQL to recover the node information I wanted (thus avoiding multiple calls to node_api etc etc).

This works great, the front page now loads much faster than it did, except.... my URL aliases have of course disappeared.

Problem with sorting Flexinode number fields in table view

I am having a problem sorting number fields created using Flexinode for Drupal 4.6. When I'm viewing the data in the Table or tabular view, numbers do not sort properly.

For example: Number Field 1 sorted ascending
1000
3
5

Is there a fix for this problem? Does Flexinode for 4.7 work better at sorting numbers?

Thanks.

Pages

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