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

Conditional Statement based on 2 values in the database

Hello everyone:

I have logintoboggan running and the redirects page to take users to the following page after login to choose their roles. At the moment it is a system of checks to either add or remove a certain role, but I'd like to make it so they only show up to add a role if they arent that role and only display to remove it if they aren't. Basically, I want a conditionals statement to display the form elements only if the users id and role id match that.

Here is the working model without conditionals, it just looks terrible if someone tries to add a role as a fan by accident if they are one and they get a database duplicate error, I want it to only show relevant choices... I got the idea from here: http://drupal.org/node/28379#comment-128757


<?php

global $user;

if ($_POST["AddFan"] == "Upgrade")
{
$userid = $user->uid;
db_query("INSERT INTO {users_roles} (rid, uid) VALUES ('%d','%d')", 4, $userid);
}

if ($_POST["AddBand"] == "Upgrade")
{
$userid = $user->uid;
db_query("INSERT INTO {users_roles} (rid, uid) VALUES ('%d','%d')", 5, $userid);
}

if ($_POST["AddBiz"] == "Upgrade")
{
$userid = $user->uid;
db_query("INSERT INTO {users_roles} (rid, uid) VALUES ('%d','%d')", 6, $userid);
}

if ($_POST["RemoveFan"] == "Downgrade")
{
$userid = $user->uid;

Unable to translate contrib modul

I have just made a Norwegian translation of the Weather module http://drupal.org/project/weather, but the weather module just don`t want to get translated. What I`m doing wrong here?

Altering an already altered form - changing taxonomy select boxes

The form API proposes a way to alter forms, but as far as I understand, one cannot alter the already altered parts of the form.
An example would illustrate the problem:
The taxonomy select boxes are generated through the taxonomy_form_alter function. Let's say I want to change all the select menus of the taxonomy terms, into checkboxes. The most intuitive way of doing so, is using form_alter:

Hooking into image and upload

I have image and upload modules working fine. I want to hook into the upload submit so that I can make a copy of the uploaded file in a different location. Is there an example around of this?

Thanks

PDFVIEw module: is there any way to have a table of content in the pdf document?

Hi

I have already changed a bit the book.module so the printer-friendly version has a table of content with link.
I'd like to have the same in the pdf export produced by the pdfview module.
I can't find any reference to pdf functions or pdf format to do it.
Do you know if it's possible? Any suggestion?

Cheers,

Luigi

Download specific user info into a CSV or PST file

I am looking for a module where registered users can download a file containing user info meeting certain criteria. The file would be used to upload into an Outlook address book. Anyone have any ideas what the best way is to accomplish this task?

Pages

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