I have been trying to create a list of taxonomy subscriptions as a block in subscriptions_taxonomy.module -
/**
* Implementation of hook_block().
*
*
*
* @ingroup hooks
*/
function subscriptions_taxonomy_block($op = 'list', $delta = 0) {
switch ($op) {
case 'list':
$blocks[0]['info'] = t('Subscriptions Taxa');
return $blocks;
case 'view':
global $user;
$vocabularies = function_exists('taxonomy_help') ? taxonomy_get_vocabularies() : array();
$omits = variable_get('subscriptions_omitted_taxa', array());
foreach ($omits as $omit) {
unset($vocabularies[$omit]);
}
$account = $user;
return array(
'subject' => t('Subscriptions'),
'content' => drupal_get_form('subscriptions_taxonomy_taxa_form', $vocabularies, $account, $form)
);
}
}
This is fine within user/subscriptions, but I can't get it to fire on say, a usernode (white screen and HTML header is all i get). Am I missing something simple?
Thanks
Comments
Comment #1
salvisTry removing code until it stops crashing and then very carefully build on what you have. Compare with subscriptions_ui_block().
Comment #2
salvisFeel free to reopen and post where you stand.
Comment #3
gregarios commentedTried to get this working in the D6 version using this block.
I get this error in the logs along with the WSOD:
PHP Fatal error: Call to undefined function subscriptions_form_helper() in /sites/all/modules/subscriptions/subscriptions_taxonomy.module on line XXX(The line number is wrong because I added the hook_block code to the file.)
If you change
$vocabulariesto something like'dummytext'in thedrupal_get_formline then the block will successfully show up, but only with a block subject and no block body contents. No PHP errors reported, but no subscriber form.I would be very interested to get this working. ( Even more than the template issue ;-) )
Comment #4
salvisSeems like you're missing an include for the file where the function is located.
Comment #5
gregarios commentedThanks Salvis! That did it. I have the user's taxonomy categories listing (just like the "taxa" subdirectory in their profile page) in a block on each Taxonomy term page now.
All it needs now is a small filter to only show the one taxonomy category checkbox that corresponds to the page I'm viewing.
Have any quick genius how that should be incorporated into this function?
I have some code that shows how to get the term ID in the theme files, but not sure how it would incorporate here, nor how to use it as a filter:
Any ideas?
Oh... here is what I have that works so far:
Comment #6
salvisYou'll have to massage the form that you get from drupal_get_form().
dpm() what you get so you see its structure, then add code to loop over the terms and unset() those that you don't want.
Comment #7
jaysonjaynes commentedHey there, I'm completely new to Drupal, and don't really know PHP. Is there a way of doing this in D7? What I'm really looking to do is to have a "Subscribe to this term" checkbox like the "Subscribe to this page". Any ideas how I could do that? I appreciate any help...
Comment #8
karingIf you've enabled Taxonomy Subscriptions module and
- if eg you were to have a site with nodes about all your website projects
- if you were on one of these nodes and it had Taxonomy Term "Drupal project"
- then you would find a Checkbox to Subscribe 'To content in Drupal project' in the Subscribe field set (by default at the bottom of the node).
Hope that helps.
PS - This thread is about blocks in D6 - if you're going to reply please open a new issue and move your post there. That helps us to keep things organized. Thanks,
Comment #9
gregarios commented@KarinG: I believe this thread is about creating a block with links to subscribe/unsubscribe to taxonomy terms from taxonomy term pages, not from nodes.
Comment #10
karing@gregarios: yep - that was my shorthand version. @Jayson's message didn't seem to fit in this queue.
Comment #11
salvisI think this thread should have been closed in March.
Comment #12
gregarios commentedYou're right. It was closed, but it certainly wasn't fixed. ;-)
Comment #13
salvisI consider a support request to be fixed when the OP stops posting.
Comment #14
jaysonjaynes commentedWhat I'm asking for is a "subscribe to" on a taxonomy page, not a node page. This isn't the right page? Is that cause I'm using D7? I'll create a new thread, but it seemed to fit this one. I'm new to forums, so thank you for helping me out. I really appreciate it!
Comment #15
salvis@Jayson Jaynes:
The short answer is: no, we don't have that.
The long answer is: the situation in D7 is unchanged from D6. Creating a block is a possible approach (but you'll also need a [Save] button, of course). Ask gregarios why it didn't work for him.
I would probably implement this as a subscribe/unsubscribe link. This would require a hook_form_alter(). You can create a new feature request, maybe someone will pick it up...
Comment #16
raulmuroc commentedWhy this won't fix? Is really an interesting feature and even necessary.
Is a little in-congruent having a Taxonomy subscriptions way that you have to enter into my account > list of taxonomies available to subscribe and choose with checkboxes. <--- Computer guy mentality!
The mentality of end-user is more of " ok, i go at that term page to visit and see it, for example #NewYork and look, i like it really a lot and wish to subscribe to have the new, i will subscribe in it... wait a minute: where the f*** is a subscribe button????"
That's the user-mentality and that's what we net to cover so yes, is needed a SUBSCRIBE link at the term page itself.
This issue should be turn to Active or at least wrihte a reference link to other issue which actually deals with this topic.
Comment #17
raulmuroc commentedDuplicate of: Cannot subscribe to taxonomy terms on term page
Fortunately, cuz would be a pity if we don't work to solve this point :-)