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

Extend a node module

I'm a newbie here and trying to develop a module that extend node module so that my structure is consider as a node type. I have a few question to ask and hope to get some answer

1. When do i need to use _nodeapi() ? I notice there are hook_insert(), hook_delete(),... must I use both nodeapi() and those hook or I can use either one? Wat is the normal way of developing a module that extend node

2. I have this error

warning: Invalid argument supplied for foreach() in E:\AnAServerFile\sports_comm\includes\common.inc on line 1519.

I chekc out the location of the error and foudn this piece of code:

/**
 * Format an attribute string to insert in a tag.
 *
 * @param $attributes
 *   An associative array of HTML attributes.
 * @return
 *   An HTML string ready for insertion in a tag.
 */
function drupal_attributes($attributes = array()) {
  print_r($attributes);
  if ($attributes) {
    $t = array();
    foreach ($attributes as $key => $value) {
      $t[] = $key .'="'. check_plain($value) .'"';
    }
    return ' '. implode($t, ' ');
  }
}

as you can see, i try to print the content of $attributes and it did print out thing, so what are the problems that could lead to this error.

3. When I try to create a node of this module i create, the Preview and Submit button doesn't work, where can I make correction.

Thank a milli

New Project Subversion module

Hi

I've just completed a module that integrates the project module with a Subversion repository. I would like to contribute this code to Drupal but I have no idea how to go about this. The code is as follows:

<?php
/*
$Id: project_svn.module,v 1.7 2005/10/10 22:59:53 axon Exp $

Copyright (C) 2005 Ricardo Gladwell

This file is part of Drupal Subversion Project Module.

Drupal Subversion Project Module is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.

Drupal Subversion Project Module is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Drupal Project Module; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

function project_svn_help($section) {
switch ($section) {
case 'admin/modules#description':
return t('Support for Subversion integration with the project module.');
}
}

function project_svn_settings() {;

More E-Publish sql errors

On a stable vBulletin-Drupal instance, I'm getting an error when I attempt to delete a section (yes I prefixed my tables):

Unknown column 'sid' in 'where clause'
query: UPDATE drupal_epublish_edition_node SET tid=0 WHERE sid = '2'

Script       : http://www.MYSITE.com/drupal/?q=admin/epublish/edit/section/2

At least one other vB-Drupal developer is having the same. Issue.

download a book as pdf

any plan to implement this feature?
so we can let users to download some books as a pdf file.
even better, the book complete with the cover and stuffs...
just like the real printed books.

so, if the users really like a hardcopy,
they can just print it out...

php error with hook_insert or hook_load

With the following code, I'm getting warning: Invalid argument supplied for foreach(). This is obviously a syntax error on my part, but I'm not getting it.

In the implemented hook_insert function, I have the following code. (->images is supposed to be an array of image nodes loaded earlier in the code.)

Idea for profile extensions

On my web site I want to have additional profile fields based on the users role. Some roles need certain profile fields, while others do not. And further it would be BAD to let all roles have all the profile fields.

...so...

I took a look at the profile.module and have a proposal which I want to swing by y'all before I implement it.

Database new table:

  • profile_roles: "fid" matching profile.fid, "role_id" matching the role id -- affording a flexible mapping between role and profile fields ... TBD: Need a way to declare the profile field is suitable for all roles
  • Alternatively ... instead of making a new table, the profile table could have a new column "roles" in which you enter the roles as a space-separated item. Then to check whether that profile field is suitable for the given role you simply do a LIKE query.

The visible changes would be in the admin area where profile fields are defined. Profile field add/edit pages would list the roles, letting the admin define which roles the profile fields are appropriate for.

Then there's several places to change non-visible behavior ... because there's several places where a list of profile fields are made for either display or edit. Those places need changes to ensure that fields are not displayed when the user doesn't have the right role for the given field. The main one of concern is the edit page for the users profile, to make sure that edit widgets are not made for profile/roles they do not have.

Pages

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