Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Is a integration into OG groups/ group contents possible/ planned?
Comment | File | Size | Author |
---|---|---|---|
#48 | subscriptions_og-1456560-48.patch | 11.89 KB | herved |
|
Comments
Comment #1
salvisPossible yes, planned no.
I don't do OG, but I'm sure there'd be interest in a subscriptions_og.module add-on. If we find someone who wants to develop and maintain it (either as a contrib to Subscriptions or a separate module), then I will support the effort.
Comment #2
Traverus CreditAttribution: Traverus commentedI have a need for this and am willing to contribute. Could OP and/or salvis give some input on functionality that would be nice? The thoughts I have are the following:
If contrib module is enabled and subscription block is put in to a group node, then the following occurs:
Could anyone suggest other implementation criterion that could/should be added before I start work?
Salvis, should I make feature request issues for multiple parts of what this may entail, or just keep it all in this issue? Thanks and look forward to working with you.
Comment #3
salvisI have close to zero experience with OG and can't really help with requirements.
There exists a subscriptions_og project for D5 that is abandoned. This may be a source of inspiration for requirements, design, and even how-to-code.
A few years back there was some talk about whether to integrate OG with Notifications or Subscriptions. The result was that OG for D6 provided a neutral interface and Notifications picked up the ball. You should be able to find these discussions in the OG and Notifications queues.
Subscriptions has a modular architecture and I think you should be able to implement most everything in a Subscriptions add-on module. Ideally, you do this in your own sandbox, then you have full control, you can freely commit code and use your own issue queue to (hopefully) get feedback from other interested parties.
I would keep this issue open to track progress and to point to your sandbox, and if you need something specific from Subscriptions, then create a dedicated issue here that we can close when it's done.
Comment #4
mwallenberg CreditAttribution: mwallenberg commentedI have written a module which integrates OG (7.x-1.x) with Subscriptions. Complete module is attached, both as a patch to current 7.x-1.x branch and as a compressed archive to be used as a standalone module.
The module is tested with OG 7.x-1.4 and working on the site I wrote it for, though I would recommend testing it out a bit before putting it in production. From the functionality listed by Traverus in #2, this module implements the following:
"Generate subscription link for group content change (if group content is created/updated/deleted that has this group node in the audience field, notification sent)"
I am not sure I can devote time to maintaining a contrib module, so if anyone wants to pick up this for use or base a project on it, you are more than welcome. Salvis, is there any chance of getting this into Subscriptions?
Comment #5
salvisThank you for posting this.
If we can gather some positive reviews here then I'm willing to put it under a contrib\subscriptions_og directory (make your patch accordingly!), but because we're unable to support or maintain it ourselves, I'd prefer it to be a separate module.
From http://drupal.org/node/add/project-issue/subscriptions (which you haven't seen because you posted a reply):
Your patch file is empty, and no one looks inside zip files, so your chances for getting any review feedback are severely diminished.
Comment #6
mwallenberg CreditAttribution: mwallenberg commentedOk, let's give that another try. I'm new to git, as you can probably guess :)
Comment #7
mwallenberg CreditAttribution: mwallenberg commentedComment #8
salvisThere's a very useful Firefox add-in called Dreditor. It adds a [Review] button to patches and in your case it shows lots of erratic white space errors.
Please set your editor to convert tabs to two spaces and to remove trailing spaces. This does not make any difference in functionality, but the Drupal community spends a lot of effort to keep a uniform coding style, because that eliminates a lot of useless friction.
So, OG users, please try this out! And mwallenberg, please eliminate the white space errors for the next iteration.
Let's see if we can wake up the testbot...
Comment #9
salvisWe don't have any automated tests at this point, but the "PASSED" confirms that the patch applies just fine.
Comment #10
mwallenberg CreditAttribution: mwallenberg commentedThere was more to patching than I thought :) Salvis, thanks for all your help. Here's another version, which hopefully has correct whitespaces.
Comment #11
salvisThat looks much better, thank you! It may seem nit-picky, but it makes sense to embrace the http://drupal.org/coding-standards from the beginning — this gives you a head start in the community.
Some more formal comments. After that, your code will be pretty close to formally perfect.
The folks interested in OG will need to take over from here.
No quotes.
No version -- this is added by the packaging script.
"Implements" -- "Implementation" is D6 style. And always put a full stop at the end.
Indent by 2.
Wrap columns at 80. Dreditor marks column 81.
Single quotes are preferred if no processing is required.
Maybe use switch().
Full stop at the end of comments, but the end seems to be missing here.
Start comments with a capital letter and end with a full stop (everywhere).
Empty line before @return.
Indent subsequent lines.
Try to start with a verb in the third person singular, e.g. "Compares..." and to keep it to one line. This line goes into the Description column on pages like http://api.drupal.org/api/drupal/modules!system!system.module/7 (you'll see that core is not perfect...). Follow with an empty line and then as much text as you want.
Functions are always "callable". This type of function is often called "Helper function", e.g.
_system_sort_requirements Helper function to sort requirements.
Comment #12
mwallenberg CreditAttribution: mwallenberg commentedHere we go: functionally identical to the previous patches, but fixed to better follow coding standards.
Comment #13
lhubbert CreditAttribution: lhubbert commentedI've installed this, and it would be very helpful, but it doesn't seem to be respecting private groups. My test account, which is only a member of one group, has access to all groups (and gets all group notifications). Do I have something configured incorrectly?
Comment #14
mwallenberg CreditAttribution: mwallenberg commentedNope, that's a coding error rather than a configuration error. That was not in the requirements for the site I originally wrote the module for, so it slipped my mind :) I won't have time to fix it at the moment, but if you (or anyone else) have the time to look into it, I think the place to start is where the groups are loaded for the subscription overview page (line 163 in subscriptions_og.module).
Comment #15
salvisComment #16
Traverus CreditAttribution: Traverus commentedPutting this code starting at line 166 right after the foreach loop in subscriptions_og.module fixes the public/private issue. If someone could please apply this to their installation and re-create the patch I would be thankful, I'm not sure how to do this myself.
Comment #17
mwallenberg CreditAttribution: mwallenberg commentedThanks Traverus! Here's the updated patch.
EDIT: I've tested the update (not with og_access, but rather with published/unpublished nodes) and it works as intended for me.
Comment #18
Traverus CreditAttribution: Traverus commentedJust as a heads up og_access module hooks in to the node_access system to implement its show/hide capabilities so the node_access calls respect og_access.
Tested and works fine for me too.
Comment #19
drupalycious CreditAttribution: drupalycious commentedany chance you do the same for OG (7.x-2.x) ?
I would like to test it.
Thank you
Comment #20
mwallenberg CreditAttribution: mwallenberg commentedI'm afraid not. I developed this because a site I built at the time needed it, and I unfortunately can't commit time to update it to 7.x-2.x. Anyone who wants to is welcome to take the code and update it, though. Also, if I remember correctly OG 7.x-2.x is integrated with Message Notify, which could solve your problem.
http://drupal.org/project/message_notify
Comment #21
drupalycious CreditAttribution: drupalycious commentedThanks for the answer, I know message notify, it is a really good module, but I am not yet fully understanding how to correctly build the code for what I would like to do. So I was trying something easier like subscriptions module ;)
Comment #22
torrance123 CreditAttribution: torrance123 commentedI made a rough port of the code in comment 17 to work with OG2.x, for those interested.
Comment #23
Patribus CreditAttribution: Patribus commentedHello!
I have installed the module with the latest patch, but I get the following error opening a node which is group
Fatal error: Call to undefined function og_get_group() in /home/www/web48/html/drupal7/sites/all/modules/subscriptions_og/subscriptions_og.module on line 119
Some ideas?
I'm using the OG 7.x-2.x branch.
Thanks
Comment #24
torrance123 CreditAttribution: torrance123 commented@osmanedosbatuque: it looks like you're using the patch from comment 17 (which has a called to
og_get_group()
on line 119). Please try my patch from comment 22 — this should be OG2 compatible (and has no mention of a call toog_get_group()
).Comment #25
Patribus CreditAttribution: Patribus commentedHello again,
I found an additional error, namely when creating new content. After submitting the create form, I get the following error.
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'usr_web48_12.field_data_group_audience' doesn't exist: INSERT INTO {subscriptions_queue} (uid, name, language, module, field, value, author_uid, send_interval, digest, suspended, last_sent, load_function, load_args, is_new) SELECT u.uid AS uid, u.name AS name, u.language AS language, s.module AS module, s.field AS field, s.value AS value, s.author_uid AS author_uid, s.send_interval AS send_interval, su.digest AS digest, su.suspended AS suspended, COALESCE(sls.last_sent, 0) AS last_sent, 'subscriptions_content_load_node' AS load_function, '425' AS load_args, 1 AS is_new FROM {subscriptions} s INNER JOIN {subscriptions_user} su ON s.recipient_uid = su.uid INNER JOIN {users} u ON su.uid = u.uid LEFT OUTER JOIN {subscriptions_last_sent} sls ON su.uid = sls.uid AND s.send_interval = sls.send_interval INNER JOIN {field_data_group_audience} ga ON s.value = ga.group_audience_gid WHERE (s.module = :db_condition_placeholder_0) AND (s.field = :db_condition_placeholder_1) AND (s.author_uid IN (:db_condition_placeholder_2, :db_condition_placeholder_3)) AND (ga.entity_id = :db_condition_placeholder_4) GROUP BY u.uid, ga.entity_id; Array ( [:db_condition_placeholder_0] => node [:db_condition_placeholder_1] => group_audience [:db_condition_placeholder_2] => 1 [:db_condition_placeholder_3] => -1 [:db_condition_placeholder_4] => 425 ) in subscriptions_queue() (Zeile 536 von /home/www/web48/html/drupal7/sites/all/modules/subscriptions/subscriptions.module).
Comment #26
Patribus CreditAttribution: Patribus commentedHello torrence123,
I did download your patch.
Is there some mismatch? What could it be?
Or I did not apply it correctly... Mmmm will repeat the process.
EDIT1: Just to be sure: The idea is to patch the module in comment #4 ?!
Comment #27
Patribus CreditAttribution: Patribus commentedOK, I found my problem.
The patch generates the drupal directory tree for modules. I did not see that and used the unpatched files.
Seems to work fine know.
PS: A question which does not belong here: Is the subscription link as it appears on a normal node available as a block or something similar in order to integrate it in panels?
Comment #28
Patribus CreditAttribution: Patribus commentedSorry for all these comments, I did find some other error.
Starting from my user account subscription page
/user/%/subscriptions
Using the group-tab I navigate to
/user/%/subscriptions/og
and get the error
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'usr_web48_12.og' doesn't exist: SELECT s.value AS value, s.send_interval AS send_interval, s.author_uid AS author_uid, s.send_comments AS send_comments, s.send_updates AS send_updates, og.label AS label FROM {subscriptions} s INNER JOIN {og} og ON s.value = og.etid AND og.entity_type = 'node' WHERE (s.module = :db_condition_placeholder_0) AND (s.field = :db_condition_placeholder_1) AND (s.recipient_uid = :db_condition_placeholder_2) ORDER BY s.author_uid ASC; Array ( [:db_condition_placeholder_0] => node [:db_condition_placeholder_1] => group_audience [:db_condition_placeholder_2] => 1 ) in subscriptions_og_page() (Zeile 115 von /home/www/web48/html/drupal7/sites/all/modules/subscriptions_og/subscriptions_og.module).
some idea?
Comment #29
Patribus CreditAttribution: Patribus commentedSomeone an idea?
Comment #30
salvisYou have no {og} table? Do you have OG installed at all?
Yes, the node subscriptions UI can be exposed as a block (see the Subscriptions settings). I don't know whether that works with Panels or not. Please try it out and let us know.
Comment #31
Patribus CreditAttribution: Patribus commentedhehehe, yes I have og installed, thats why the error irritates me.
can I deliver some more info in order to track the error origin?
Comment #32
Patribus CreditAttribution: Patribus commentedIs there someone else having this problem?
Comment #33
torrance123 CreditAttribution: torrance123 commented@osmanedosbatuque: You're right, og2.x no longer uses the
{og}
table anymore. In my case, I've upgraded and I still have the old table, but it's no longer being updated. You must have a clean installation and therefore no{og}
table at all.I'll have a look at fixing this on Monday, and I'll upload a new patch if I can make this work.
Comment #34
Patribus CreditAttribution: Patribus commentedthat are nice news.
Just a question about the functionality of this module.
In case of subscriptions, the subscription link on nodes shows different subscription possibilities like: subscribe to this node with or without edits and/or comments, subscribe to this node type, with or without edits and/or comments, etc. Will there be also an option at this point for the respective group subscription? I.e, the subscription link will than show the option to subscribe to the group content? Because for the moment I do not see this anywhere. In order words, where is the link to subscribe to the group content of a node?
Thanks
Comment #35
torrance123 CreditAttribution: torrance123 commentedUpdated 2.x version is here: https://github.com/fuzionnz/subscriptions_og
This no longer relies on the
{og}
table.There already is this option: if you look at a group node you'll see an option to "[Subscribe] To content posted in [node title]". I'm not sure why you aren't seeing this.
Comment #36
Patribus CreditAttribution: Patribus commentedHello, the link is not working! Can correct it please?
Thanks
Comment #37
torrance123 CreditAttribution: torrance123 commentedSorry, try again — I'd accidentally set the repo to private.
https://github.com/fuzionnz/subscriptions_og
Comment #38
Patribus CreditAttribution: Patribus commentedjust perfect!
everything seems to be running correctly now. Will keep you informed about possible bugs or strange behaviors.
Cheers
Comment #39
salvisThe patch in #22 seems to be outdated.
Comment #40
torrance123 CreditAttribution: torrance123 commentedThe patch in #22 has been superseded by the github repo here: https://github.com/fuzionnz/subscriptions_og
For your convenience, I've attached the latest diff of this repo.
Comment #41
torrance123 CreditAttribution: torrance123 commentedComment #43
salvisI think #40 is missing a newline at the end of the patch file. This keeps the testbot from applying the patch.
Please put your module into subscriptions/contrib/subscriptions_og and create the patch from the subscriptions directory.
Comment #44
timwoodI don't see a contrib subdirectory in subscriptions module, not in any release/packaged version nor any D.O. Git branch. Were you referring to some other version of subscriptions where sub-modules have been moved to a contrib subdirectory?
Comment #45
salvisYou need to create the contrib directory.
The idea is not to move the submodules there but to make a clear separation between the submodules that I maintain (which remain where they are) and those that have been contributed by others and that I will not maintain.
The ideal way of handling this would be to make a separate d.o project.
If this is not possible, but there's a consensus that a submodule warrants inclusion in Subscriptions, then we can put it into the new contrib directory. Support will need to come from those that have contributed it (or are interested in it), and if there are issues that cannot be resolved, then I will take the liberty to remove it.
Comment #46
timwoodI've recreated the patch per salvis' suggestion to include it as a sub-module under a "contrib" folder inside the Subscriptions module. Same exact code as in the Github repo linked from comment #40 (which is slightly different than the patch in #40) with a new line at the end of the file for the bot's consideration.
Comment #47
salvisThank you, timwood!
OG users: Please review and test!
Comment #48
herved CreditAttribution: herved at Randstad Digital commentedThanks a lot everyone for this patch.
Here's a new patch with some small improvements:
- Fixes some phpcs issues
- Creates an .install file (move the hook_disable() inside and add hook_uninstall() to delete the subscriptions_og_autosubscribe variable)
- Send subscriptions for active OG members only (had to patch subscriptions.module to achieve this as it doesn't accept more than 1 JOIN initially).
- Allows a user to view and subscribe to any/all groups if he has the "administer group" permission (at user/%user/subscriptions/og).
Also we might want to unsubscribe automatically a user when he leaves a group or adapt subscriptions_og_page().
If a user unsubscribes with subscriptions_og_autosubscribe set to FALSE he's currently unable to leave the group as the group won't show up any more in subscriptions_og_page().
For now I'll just use this with subscriptions_og_autosubscribe set to TRUE.
Hervé
Comment #49
vistree CreditAttribution: vistree commentedSorry for reopening an old task, but is the patch in #48 supposed to work with OG 7.2 or only with OG 7.1. @herved - can you please clarify?
Comment #50
herved CreditAttribution: herved commentedHello @vistree,
The last release of OG 7.x-1.x dates back from 26 September 2012 which is very old.
The project I was working on was using OG 7.x-2.x when I updated the patch. And it still is AFAIK.
Comment #51
vistree CreditAttribution: vistree commentedGreat, than I will better try your patch from #48 and not the github module referenced in #40 for my OG 7.2 implementation, correct?
Comment #52
herved CreditAttribution: herved commentedCorrect.
The patch of timwood in #46 contains the same code as the github repo from #40.
My patch in #48 contains some improvements to patch #46.
Comment #53
vistree CreditAttribution: vistree commentedThank you herved: will test and report back ;-)
Comment #54
vistree CreditAttribution: vistree commentedPatch from #48 worked well. I did some modifications, as I need to be able to subscribe to all public groups + the private groups a user is assigned to. Works well ;-)
Now I need to implement one more thing: we use og_subgroups and therefor I need to implement some inheritance for the subscriptions also. What would be the best way? I thought, that I could do a bulk subscribe to all child groups if a user subscribes to the parent group. And if he unsubscribes from the parent group I need to also unsubscribe him from the child groups.
Is there somehow a possibility to react on subscribe/unsubscribe action?
Comment #55
salvisAdding a hook for this might make sense.
Comment #56
vuilThe patch #48 is ready to be deployed in
7.x-1.x-dev
branch. Thanks to everyone!Comment #58
salvisOk, thank you all for your efforts and patience!
@vistree (#54): Please open a new issue if more work is needed.