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

Trying to create a shortened "post blog" form on the front page

I'm trying to create a shortened version of the form at http://www.examplesite.com/?q=node/add/blog that just has fields for Title and Body, none of that other stuff. The problem is I have no idea where to start with this, I'm new to Drupal.

I tried adding the following code to my page.tpl.php file just as somewhere to start, but not really getting anywhere:

How to send emails from awardspace server?

Hello! Have you got smtp to work on awardspace free host? i Tried to use smtp module with phpmailer but it doesen't seem to work. Can you give me a hand on this stuff please? I'm not that good in programming!

How can i add fixed clickable images (not randomized) to a block on drupal 4.7.2 ?

I want to add images with links to pages. I have tinymce installed and configured, but i can't get images to show on a block. Could you help me please? I've searched a little bit on the forums but i have no clue yet. Thanks in advance. PS: I'm not that good in programming.

Can a Drupal Module be made to log in a user bassed on an already open PHP Session containing their user/pass?

I have a web app which opens a PHP session and stores the user's username and password inside it, as well as first and last name, and e-mail address.

I am installing Drupal in a subdirectory on the same server, and I need to use this information to _automatically_ log in to Drupal the moment they visit a page on Drupal. It is important that they not have to enter the username and password themselves.

I've written and successfully tested a PHP script already:

session_start();
$crazyuserobject = $HTTP_SESSION_VARS["user"];
$uservars = get_object_vars($crazyuserobject);
print('<br>USER: ' . $uservars['Username'] );
print('<br>PASS: ' . $uservars['Password'] );
print('<br>FNAM: ' . $uservars['FirstName'] );
print('<br>LNAM: ' . $uservars['LastName'] );
print('<br>MAIL: ' . $uservars['Email'] );

...that retrieves the variables I need, to verify that it can be done. What I want to do is, if that Drupal user exists, log in to it instantly. (If not existing, *maybe* create the account AND login. But that's not the important part.)

Using module table information as nodes (or, what if I can't use the auto-increment nid?)

I am developing a module that daily pulls data from an external source and inserts it into my module's tables.

A "normal" Drupal module would have functions to create nodes and insert rows with information about those nodes in the node table, letting the database auto-increment the nid column and then storing that same nid into the module-specific tables to use as a reference for getting data for that node.

Since the data I am using is coming from a source external to Drupal, I can't use that "normal" process.

Currently I have 5 tables worth of information from the external data source. The tables will be updated once a day by dropping their contents and reimporting the table. Each row of data in the 5 tables does have a unique id column that I'd like to use in a similar fashion to the nid. I have no direct control over the data in the 5 tables, needing to simply accept it as it comes. The tables will have some small percent of the data rows deleted each day in addition to new rows inserted. I can post-process the data after each daily reloading of it, but I'd like to avoid as much of that overhead as possible.

I've thought of three ways of integrating the data into Drupal nodes:

1. Each day after the tables are updated, delete all entries in the node table with the content 'type' for my module and then loop through all the rows in the 5 tables and create a new "node" for each row that references the data id in the title field. This simulates deleting all the existing nodes for the content type and re-adding all the content.
Flaws: This will increase the auto-incrementing nid very quickly (about 2000/day) and because a particular data row won't keep the same nid it won't preserve url paths to each row of data for bookmarking, search engines, etc...

2. Setup an intermediate table to map nid's to data unique id's and then run some sort of complicated process each day to create new node table entries for new data, delete node table entries for old data and update the mappings table to reflect all the changes.
Flaws: Probably workable, but really complicated in practice and probably error prone and resource intensive.

3. Since I know the approximate range of ids that will be in the module's data tables (18,000 to probably a max of 800,000 in the next 10 years), as part of the install I could manually set the auto-increment value for the node table to start at 1,000,000 so that other content types have node values of higher than the values that will be contained in the module's data tables and then I could post-process by dropping the existing rows that match my module's content type, then inserting the data table id's as the nid's, ignoring the auto-increment value for the column.
Flaws: A bit of a hack that risks the external data source deciding to change their id range (which is admittedly unlikely, but possible).

Right now I'm leaning towards solution #3 as the simplest and most straightforward, but I wanted to see if any of the more drupal experienced out there had any suggestions for an alternative method to accomplishing this or see additional pitfalls, etc...

Basically I want to take the imported data, generate node pages from it, make it searchable and sortable based on fields in the data and keep it all user and search engine friendly.

All ideas and suggestions are welcome.

my first module attempt - can't set up permissions for hook_settings correctly?

I'm trying to start writing drupal 4.7 modules but can't get past this simple problem.
As a registered user with "can set import news" permission i can't access module settings page, while as a first user / admin I can and is works.

Here is this simple code. What am I missing, so that registered user with opted out "can set import news" perm will be able to access drupal/admin/settings/import_news"?

Pages

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