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

RTF/PDF Module

Is there any module that processes a RTF format into a PDF format?

Theming hook_form

I'm working on a module to implement a d20 character sheet and I'd like to pretty up the input form. For some reason, I can't seem to figure out how to apply a theme to the form. The base name of my module is "characters." Here's what I think is the relevant code

<?php
function characters_form(&$node) {

... // snip

// str
$form['attributes']['STR']['permstr'] = array(
'#type' => 'textfield',
//'#title' => t('STR'),
'#required' => TRUE,
'#default_value' => $node->str,
'#size' => 3
);
$form['attributes']['STR']['tempstr'] = array(
'#type' => 'textfield',
//'#title' => t('Temp STR'),
'#required' => FALSE,
'#default_value' => $node->tempstr,
'#size' => 3
);

// dex
$form['attributes']['DEX']['permdex'] = array(
'#type' => 'textfield',
//'#title' => t('DEX'),
'#required' => TRUE,
'#default_value' => $node->dex,
'#size' => 3
);
$form['attributes']['DEX']['tempdex'] = array(
'#type' => 'textfield',
//'#title' => t('Temp DEX'),
'#required' => FALSE,
'#default_value' => $node->tempdex,
'#size' => 3
);

// con
$form['attributes']['CON']['permcon'] = array(
'#type' => 'textfield',
//'#title' => t('CON'),
'#required' => TRUE,

How to avoid user warning: Query was empty query?

I am working on a module that will allow multiple users to have superuser access (uid 1 access).

Eventually, this code will be moved to a module, but for now I am modifying the core to make sure my code is right. PLEASE DO NOT POST HERE TELLING ME THAT CORE HACKING IS A BAD IDEA... I know that... this is temporary.

I added a few lines to user_access() which is in modules/user/user.module. The SQL query there will return a single column and single row with the value "superuser" if the user id in question has been assigned the role "superuser." If not, the SQL query should return an empty set. After adding this code in, I am getting a ton of errors that all say: user warning: Query was empty query: [snip/]. Can anyone tell me how to avoid this error?

function user_access($string, $account = NULL) {
global $user;
static $perm = array();

if (is_null($account)) {
$account = $user;
}

// User #1 has all privileges:
if ($account->uid == 1) {
return TRUE;
}

/********** START MY CODE **********/
// Users with role 'superuser' have all privileges
$is_superuser_query = "SELECT DISTINCT(sr.name) FROM {users_roles} ur, {shared_role} sr WHERE ur.uid=$account->uid and ur.rid = sr.rid and sr.name = 'superuser';";
$is_superuser = db_query($check_if_superuser_query);
if ($is_superuser) {
return TRUE;
}

Help on Node Access module developement

I looked into several access control modules that provides the functionality of controlling the access (viewing) to the node either by making it private (private module), password protect (node_protect module), granting permissions based on the user names (nodeaccess module) or by granting permissions based on the buddy groups (buddylist module). What I have NOT found is one single module that completely suits my need. What I would like to have is to provide the ability to the content creators (users) for every content type to choose whether they want the node to be any one of the following (with public being the default):

1. personal (only him/her)
2. private (only friends, if buddylist is enabled),
3. private extended (friends of friends, if buddylist is enabled),
4. protected (password protected) and finally
5. public (anyone)

I am thinking of creating a module by myself, to start with I added two fields to the node table - privacy and password. Privacy will hold any one of 1 thru 5 values above and password will hold the password supplied by the content creator. By using the nodeapi functions this selection field is added to the node creation form (for every type) and the information provided is saved in the database. But my problem is how to control the node visibility. I would like to include the following functionality:

Private taxonomy per user

I'm in interested in creating a Drupal system where each user has their own private taxonomy/vocabulary for freetagging. Has anyone had any experience with creating services using Drupal, where each user gets their own gated CMS? This relates to my privacy bounty. In addition to a users having their own private areas of the Drupal system where only they will view their content, each user would have their own vocabulary for freetagging entries.

Have problems with my custom node-module. Please, help. I'm a newbie.

I'm developing a custom module pretty much similar to news. Well, it is named "news" and serves "news" menu path under MENU_SUGGESTED_ITEM. It is based on node module, and there were no problems with that.

"news" menu path calls "news_page" function callback which simply shows 25 recent news nodes. Every item from that node has a link built with l() that points to news detail page with the following path formula "node/#", where # is $nid. This way, every news item opened has local task links provided by node module, those are "view" and "edit".

The problem is that I don't want url for these news nodes to be "node/#" type. So, I improved "news_page" function callback so it is a little smarter. Now it also serves links followed better formula for news items, such as "news/#". So when arg(1) is numeric and positive "news_page" calls for "news_item" function, to render selected news. And when in overview mode, the urls to news items are now all "news/#". So that was peachy.

But "view" and "edit" local tasks from node module are gone now. That is the problem. I need them!
I know, the path is different, not "node/#" type, and that is why buttons don't show. But I thought there is a way around it.

Pages

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