Is it at all possible to have the Signup module on activated nodes appear as a block on the side of the page? Is there any way to accomplish this? Thanks.

Comments

dww’s picture

Status: Active » Postponed (maintainer needs more info)

You mean the signup form? The list of people who have signed up? Please be more specific.

x2222’s picture

Both actually, would be nice to have in block form. Is either having the signup form or the list of those signed up, in block form an option? Thanks.

dww’s picture

Title: Signup Module in a block? » Signup form in a block
Version: 5.x-1.0 » 5.x-2.x-dev
Category: support » feature
Status: Postponed (maintainer needs more info) » Active

Nope. ;) You can't do anything like that in the 5.x-1.* series.
In 5.x-2.* there's views support, so you should be able to define a view with the list of signed-up users and put that in a block.
However, views and forms don't play nicely together, so there's no good way to get the signup form itself in a block.

That said, in the 5.x-2.* series, you *can* put the signup form in a separate tab on the node. When I added that feature (which someone sponsored my time for) I designed it such that it'd be relatively easy to make a setting to put the signup form in a block as a 3rd option. See http://drupal.org/node/190553. So, that's what you'd want to do if you wanted to work on this yourself. If you're not a coder, you could consider hiring me to implement it. I don't personally need it, so I'm not going to work on it on my own.

Cheers,
-Derek

kdotcom’s picture

Can you set a limit on how many people can sign up for an event?

dww’s picture

@kdotcom: That's totally off topic in this thread. If you want to ask such a question in this issue queue, please create a new support request for it. In this case, the answer to your question is easily found via the CHANGELOG linked on the project home page.

markfoodyburton’s picture

Something like this?


/**
 * Implementation of hook_block
 */
function signup_block($op = 'list', $delta = 0, $edit = array()) {
  if ($op == 'list') {
    $blocks[0] = array('info' => t('Signup block to show signup form'),
      'weight' => 0, 'status' => 1, 'region' => 'left');
      // BLOCK_CACHE_PER_ROLE will be assumed for block 0.
    return $blocks;
  }
  else if ($op == 'configure' && $delta == 0) {
    return '';
  }
  else if ($op == 'save' && $delta == 0) {
  }
  else if ($op == 'view') {
    $block=array();
    if (arg(0) == 'node' && is_numeric(arg(1))) {
      $node = node_load(array('nid' => arg(1)));
      if ( _signup_needs_output($node)) {
        switch($delta) {
          case 0:
            $block = array('subject' => t('Signup'),
                           'content' => _signup_node_output($node));
            break;
        }
        return $block;
      }
    }
  }
}
markfoodyburton’s picture

Status: Active » Needs review

updating status - please review the patch :-)
(One problem is that this patch does not 'switch off' the normal sign up mechanism, it just adds a block)

dww’s picture

Status: Needs review » Needs work

That's not a patch. ;) Please post a real patch (that's not full of code style problems) if you want me to review/test/commit.

Furthermore... yes, this definitely needs to modify the admin setting for where the signup form appears so there's an option to disable it entirely (with help text about placing it via this block).

Thanks,
-Derek

markfoodyburton’s picture

Status: Needs work » Active

Hey, fine with me, I just copy'n'pasted (with a few edits - clearly) from the drupal source for a block hook...
If I get round to rolling a patch up and cleaning the code, I will, but like you, I've got other fish to fry, hopefully somebody will pay you to do this properly. This "hack" works for me, which is all I need right now... - Shall we just leave this as 'active'?

dww’s picture

Status: Active » Needs work

Cool, no worries. Let's call it "needs work" so it's clear there's the start of some code in here, it's just not a viable patch just yet. Thanks.

fehin’s picture

subscribing.

onekamel’s picture

Version: 5.x-2.x-dev » 6.x-1.x-dev

Hi,
I'm trying to implement signup_block and it is working on http://localhost/proj/node/302/edit but is not displayed on http://localhost/proj/node/302 (signup_block is never called on node page). Could someone help me?

asb’s picture

sub

xaa’s picture

thanks markfoodyburton :)
comment #6 still working fine with the v6.1

xaa’s picture

hi,
I have added the code provided on the comment #6. it's working fine to subscribe/unsubscribe from a block but I receive an undefined function error if I navigate on a signup admin page.

Fatal error: Call to undefined function _signup_node_output().

Could you help, please ?
thanks

xaa’s picture

pending solution is to hide the block on the admin pages and other pages where the error appears