Website Membership: auto-subscribe original posts

By Deborah - March 13, 2015

Hi. Using my first instance of the Website Membership plugin in conjunction with the Website Comments plugin and am stuck here...

1) The site has a forum accessible only by Website Membership users.

2) Users can post a new topic to the "topics" table. After a topic is submitted, Website Membership members can view the topic and post comments or subscribe to comment updates.

3) If a member posts a new topic, they are not automatically subscribed to that topic for receiving the email comment updates. The person would need to review their own post and click the subscribe link. I don't think most people would think to do this, and think they'll want/expect to receive an email alert when comments to their topic were made by other users.

Is there a way that I can set up the "topics" form submission to automatically subscribe that Website Membership user to Website Comments for that topic?

Deborah

By Dave - March 17, 2015

Hi Deborah, 

Sounds like you have website membership, website comment AND a forum? 

How's it all built and who build it (was it us?) and how does it all work together?

Whatever the mechanism is for "subscribing" to a topic (not sure if that's in the forum or comments) it should be possible with a few lines of custom code to have a user automatically "subscribe" to the topic they just created.  You'd just need to call whatever code gets run as when they normally click on the subscribe link.

Let me know some more details and I'll try to help and/or point you in the right direction.

Thanks!

Dave Edis - Senior Developer
interactivetools.com

By Deborah - March 17, 2015

Dave, Everything I'm referring to is being built (so far, just by me) with CMSB and the two plugins, Website Membership (WM) and Website Comments (WC).

The Members Area of the site is only accessible to WM members.

Once logged in, the member can view general content or visit the forum.

Inside the Forum area:

  • There is a list of previously created forum post titles. The titles link to a detail page with the full post, display of any comments, and the WC comment form.
  • The original forum posts are submitted via a form that writes to the 'topics' table. (See attached PHP file.) This form is only used for posting a NEW topic.
  • The member viewing a post can comment, subscribe/unsubscribe (WC plugin).
  • When a member comments on a post (WC plugin), they are automatically subscribed via email to future post updates.

What I'm challenged with is that when the member starts a new topic (using the attached form), I would like them to be automatically subscribed to comments (comments made via the WC plugin).

I hope I'm describing that well enough. I'm really excited to have gotten this far along with building this!

~ Deborah

Attachments:

submit-new-topic.php 3K

By Deborah - March 27, 2015

Dave, your reply took some time for me to work through, but in the end, I've accomplished my goal! (And on a Friday... yes!)

This tip you provided was crucial:

But you've got another table 'topics' in your setup, so you may need to create a new comment on the topic first.  Have a look at the code in wsc_comments_addRecord() for how to go about that.

The relationships between CMSB, Website Membership, and Website Comments wasn't easy to figure out at first, but it is a complex and powerful relationship, in the end. This is my first install of Website Comments and I am impressed!

Your guidance was invaluable...thanks so much!

~ Deborah