• Resolved mrarrow

    (@mrarrow)


    Hi

    So my guest/casual website visitors are able to ask Questions by filling out a Gravity Form which simply creates a categorised post. One of the required fields in the front-end form is for the visitor to complete their email address which is subsequently stored as a custom field for that post.

    Is there anyway to enable Subscribe to Comments Reloaded to use that custom field to automatically subscribe that email address to any further comments on the respective post? So rather than a user then having to actively visit that post (once approved) and type in their email address manually.

    I would clearly put the required privacy warnings in the form before the user submitted it.

    I had something _similar_ set up in TDO Mini Forms and the original Subscribe to Comments plugin but Subscribe to Comments Reloaded seems a lot more powerful.

    Thanks in advance. Any thoughts or suggestions?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi there,

    what you can do is to customize your Forms manager so that it adds a new row into my plugin’s table wp_subscribe_reloaded, with the proper information for each column. Subscribe to Comments Reloaded won’t notice the difference and will process those subscriptions accordingly.

    Camu

    Thread Starter mrarrow

    (@mrarrow)

    Awesome thanks! As simple as that. I’ll post anything back once I’ve worked out how to do it.

    Many thanks

    sure, keep us posted! Thanks!

    Thread Starter mrarrow

    (@mrarrow)

    So, I’ve already written a function which sends an email (using the address in the custom field) to confirm that the submitters post is now published. I figured I could bolt on your suggestion to this function.

    I also thought I could modify one of your own functions to take advantage of code further down your plugin and to keep it compatble with any plugin updates. The one I spotted was add_subscription($_email, $_status, $_post_ID);

    So, I pasted your function into my themes functions.php and changed those variables to match ones I’m already calling in my own function (namely referencing the correct custom field and retrieving the post ID). Briefly these exra lines in my functions.php file are:

    global $post;
    $email_to = get_post_meta($post->ID, 'Author Email', true);
    .........
    include 'https://<nameofdomain>/wp-content/plugins/subscribe-to-comments-reloaded/subscribe-to-comments-reloaded.php';
    add_subscription($email_to, $_status, $post->ID);

    I thought that this would work, but depending on where I put thos last two lines (the include line and add_subscription, it either white-screens come publishing, or simply ignores that code. Mmy other custom function continues to work fine, so its definitely the monkey-business I’ve been doing with this!

    This should work in principle though shuoldn’t it – over-riding one of your functions with my own values?

    Any thoughts much appreciated!?!?!

    Hi there,

    in order to avoid conflicts with other plugins/functions, I encapsulated my functions within a class. In order to use add_subscription you need to instantiate the class first (no need to include the file, I guess):

    $instance = new wp_subscribe_reloaded();
    $instance->add_subscription(parameters);

    Good work, though!
    Camu ??

    Thread Starter mrarrow

    (@mrarrow)

    Well cover me in egg and flour and bake me for 14 minutes. It’s worked!

    global $post;
    $email_to = get_post_meta($post->ID, 'Author Email', true);
    $_status = "Y";
    ....
    $instance = new wp_subscribe_reloaded();
    $instance->add_subscription($email_to, $_status, $post->ID);

    Now happily adding a new row to the subscribe_reloaded table! Also wrapped all my code in an IF statement to ensure a new notification message doesn’t keep getting sent if a post is then republished/updated again – that would annoy submitters!

    Anyway, thanks for your assistance/comments! Seems to be fine now…

    Awesome ?? A vote for my plugin would be a nice way to thank me ??

    Camu

    Thread Starter mrarrow

    (@mrarrow)

    I have voted! Thanks man!

    Really appreciated!

    Camu

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: Subscribe To Comments Reloaded] Automatically subscribe from custom field’ is closed to new replies.