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

Review of a module?

Hello,

I wrote node_article.module, a complete module that manages an article's workflow with author, editor, editor in chief and copyeditor. Everybody a part from chief and author are optional.

It's been created to work well while creating Free Software Magazine.

why should I use theme()...? PLUS, how to you make additional info available to PHPtemplate?

Hello,

As most of you know, I've written node_article.
My question now is about themes.

I wrote a function called:

theme_node_article_editing_info($node)

I followed the node_sample template to start with.
Then, a function calls:

Is it OK to have non-db values in node_load?

Hello,

I have just finished developing node_article.
Now: in the node, I store the editor's uid. However, when I deal with the node I want to deal with the editor's login name.
So, in node_article_load I put:

 // Work out the node_id for the chosen editor
  if($additions->editor_uid == 0){
    $additions->editor_uid_name='';
  } else {
    $tmp=user_load( array('uid' => $additions->editor_uid));
    if(!$tmp){
      $additions->editor_uid_name="ERROR LOADING USER '".$additions->editor_uid."'!";
    } else {
      $additions->editor_uid_name = $tmp->name;
    }
  }

then, in node_article_update I have:

  // Work out the node_id for the chosen editor
  if($node->editor_uid_name == ''){
    $node->editor_uid=0;
  } else {
    $tmp=user_load(array('name' => $node->editor_uid_name));
    $node->editor_uid=$tmp->uid;
  }

Is this structurally OK?

In this function, I also create:

$additions->editing_finished

This variable will check if the author and the editor are assigned AND they is OK with the current version of the article - if that's the case, $additions->editing_finished is set to one. This way, people loading the node know that the editing is finished.
Again: is this structurally OK?

Finally, I need an HTML "editing string", which give a LOT of editing information in a very tiny string (using colour codes and font sizes, it tells you if the author, the editor and the editor in chief are OK, who is currently in control, and so on).

How much logic should go in node_article_insert and node_article_update?

Hi,

I've finally finished developing my article_node module.
However, I feel a little bit uneasy about it. Rhe main reason is that I am not 100% sure that I did things "right".

My main question is: how much logic should go into node_article_insert and node_article_update?

At the moment, I allow people to specify an editor for the article. Obviously, in the form the editor is specified by account name rather than UID.
So, in node_article_update I have something like:

  // Work out the node_id for the chosen editor
  if($node->editor_uid_name == ''){
    $node->editor_uid=0;
  } else {
    $tmp=user_load(array('name' => $node->editor_uid_name));
    $node->editor_uid=$tmp->uid;
  }

Then, I decided that if the editor is not sent then the editor CANNOT be "ok" with the article. So, later on in node_article_update, I have:

  if($node->editor_uid == 0){ $node->editor_ok = 0; }

And then things get worse...
In the form, I have an hidden field:

  $form['workout_oks'] = array('#type' => 'hidden', '#default_value' => '1', '');

This field will tell my module that I want to work out who's OK with what (if a new version of the node is saved, then the author's OK is automatically set to 0).
In node_article_update, I then have:


if($node->workout_oks == 1 && $op == 'update'){
_node_module_reset_other_peoples_oks($node);

how to have a block with no title region at all?

I'm writing a module banner_blocks.module that creates banner advertising blocks (using the distributed banner.module) in function banner_blocks_block. How to create a block that has no title area at all??? it is not enough to just have the title blank, for two reasons: it wastes the real-estate of the space for the title, and in my style.css I have a background image behind each block title which of course still displays even when title is blank.

Dynamically generated image for each node

I'm thinking about one function. Mayby you can help me somebody ...
I'd like set up ONE default (main) picture for EACH node (story). Imagine: on front page are 10 stories and on left side of each title and teaser is picture. So ... picture is not putted into the body texty, but automatically placed by engine near of story (teaser).

For each story I have to set-up WHAT picture will be used of course.

Pages

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