WordPress.org

Ready to get started?Download WordPress

Forums

Subscribe2
[resolved] Limit to Plain Text - Excerpt? (21 posts)

  1. thinkwired
    Member
    Posted 1 year ago #

    Is there anyway to limit the types of emails members can receive? I'd rather not make all of the options available.

    http://wordpress.org/extend/plugins/subscribe2/

  2. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @thinkwired,

    Plain Text - Excerpt is the only email option available to Public Subscribers in the free version. One way to limit the different emails available is to not allow people to Register on your blog as it's only Regsitered Users who have the option to change the email type.

  3. thinkwired
    Member
    Posted 1 year ago #

    The problem is, I only want to send emails to registered users.

    I guess I can default the choice to plain text and then remove the options from the profile page. I just didn't want to have to hack the plugin every time you update it.

    Awesome plugin, keep up the good work.

  4. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @thinkwired,

    If you only want Registered Subscribers then hacking is the only way around this. Subscribe2 is designed to encourage people to sign up to your blog by offering more email subscription options. You are wanting the opposite of this so changing the code is the only way.

  5. thinkwired
    Member
    Posted 1 year ago #

    Its not that I want the opposite, its that I run a members only website.

    I think it would be awesome if the plugin allowed you to specify what role level was able to receive email notifications. Do you think the ability to set a minimum role, excluded role, or explicit role is something that makes sense for your plugin in general? I'm open to the most flexible/usable solution for everyone and would be happy to donate or upgrade to a pro version.

    Here is my specific situation... maybe it lends itself to a more generally usable enhancement... I have people who pay to be members and I want these members to receive emails but, when they cancel their membership they are demoted to the "subscribers" role. Since we do not allow public registrations/subscriptions, our members with a custom role are the only people who can receive email alerts but, when they cancel and become subscribers, they continue to get email alerts even though they are no longer members because the "subscriber" role allows them continued access to your plugin.

    If we could specify a role to receive updates or exclude roles from receiving updates, that would be awesome.

    I know my situation is limited to those with members only websites but, this would likely be useful for people who want to allow varying options for varying role levels. For example, giving contributors/authors the added perk of receiving updates for multi author websites.

    Sorry, I know that's a lot to read but, I'd love to help create an elegant solution.

  6. thinkwired
    Member
    Posted 1 year ago #

    Has anyone EVER requested anything like this? I have been reading old posts in the forums for about an hour now.

  7. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @thinkwired,

    You could limit access to the "Your Subscriptions" page to registered users with a role above that of Subscriber by applying a filter in Subscribe2 (that means writing some code). You'd then have to remember to unsubscribe members when they are demoted.

    I cannot recall anyone else ever having asked for this sort of feature.

  8. dikkevandale
    Member
    Posted 1 year ago #

    I'm looking for the same solution (I'm not gonna use html, full content, and all those others). Disabling those would be perfect.

    @thinkwired: Did you find a solution or another plugin?

  9. thinkwired
    Member
    Posted 1 year ago #

    @matty

    That manual unsubscribing is what I am trying to avoid. At some point it is going to be too much to handle manually. We are growing.

    @dikkevandale

    I simply removed those options from the user interface. Setting the default to excerpt and then removing the option for users to change it is fairly simply to do.

    I have not found another plugin but I am open to suggestions if anyone has one.

  10. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @thinkwired,

    Your suggestion interested me enough to take a look, sadly it's not an easy fix directly in the code to provide a fix and functionality for the future but...

    There is a filer in Subscribe2 that applies to the collection of Registered Users email addresses called ''s2_registered_subscribers''.

    It would be possible to apply a filter that would cycle through these email addresses dropping those with a 'Subscriber' level role in WordPress. I'll try to post some code if I get time.

  11. thinkwired
    Member
    Posted 1 year ago #

    That would be greatly appreciated. Thank you for your time either way.

  12. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @thinkwired,

    I think the following code will work but I've only run very brief tests. It basically filters the users collected by Subscribe2 that appear to be subscribed to notifications for the email and then removes any Registered Users with a 'Subscriber' role from that list.

    You'll need to paste this code into your own mini-plugin file and activate it. It will then be retained on upgrade to the core Subscribe2 code.

    function s2_remove_subscriber_role($subscribers) {
    	$user_query = new WP_User_Query( array( 'role' => 'subscriber', 'fields' => array('user_email') ) );
    	$subscriber_role = $user_query->get_results();
    
    	$exclude = array();
    	foreach ($subscriber_role as $user) {
    		$exclude[] = $user->user_email;
    	}
    
    	return array_diff($subscribers, $exclude);
    }
    
    add_filter('s2_registered_subscribers', 's2_remove_subscriber_role');
  13. thinkwired
    Member
    Posted 1 year ago #

    Thats great, thank you.

    I'm wondering now if the more elegant and useful solution is to simply not send emails to users who are "subscribers." Because a user may possibly change roles, it would be nice to preserve their settings. Also, I think it might be easier to setup a conditional on the send function which checks a users role and ignores "subscribers."

  14. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @thinkwired,

    What you've described is exactly what the code above will do. Perhaps I mis-understood you initially but have happened upon the solution by chance.

  15. thinkwired
    Member
    Posted 1 year ago #

    Sorry about that, it wasn't obvious to me when I first read the code.

    I created a plugin and will be testing today.

    Quick question, what causes this new stand alone plugin to run? Does the order in which it runs matter?

  16. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @thinkwired,

    Just like WordPress makes some hooks available so plugins can add to or alter the behaviour of the core code, Subscribe2 employs the same structure to allow some code and functions to be altered. It's all handled by that add_filter() function.

  17. muratje
    Member
    Posted 1 year ago #

    Hi, great plugin, but I'm also looking for a option or workaround to hide the email content settings on a subscribers profile page. They should be NOT allowed to see this settings.

    I would like to hide all options like HTML - Full HTML - Excerpt Plain Text - Full.

    Only want to use Excerpt Plain.

  18. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @muratje,

    It's a core feature of the plugin, just because it's not something you would want if you wrote the plugin does not mean it's not something the I or other users like.

    Currently the default behaviour cannot be changed easily but since it's open source software you can make any changes to the code you like so feel free to edit the code and remove the bots you don't like or need.

    If I get the time one day I may implement an easier way to disable this part of the code.

  19. thinkwired
    Member
    Posted 1 year ago #

    So far so good. Thank you very much for your time and help.

    Made a small donation (and would have even if you didn't take the time out to help me -- great plugin, cheers).

  20. thinkwired
    Member
    Posted 1 year ago #

    Matty, do you think I have to worry about the mini-plugin you suggested no longer working after future upgrades (or recent upgrades)?

    function s2_remove_subscriber_role($subscribers) {
    	$user_query = new WP_User_Query( array( 'role' => 'subscriber', 'fields' => array('user_email') ) );
    	$subscriber_role = $user_query->get_results();
    
    	$exclude = array();
    	foreach ($subscriber_role as $user) {
    		$exclude[] = $user->user_email;
    	}
    
    	return array_diff($subscribers, $exclude);
    }
    
    add_filter('s2_registered_subscribers', 's2_remove_subscriber_role');
  21. mattyrob
    Member
    Plugin Contributor

    Posted 1 year ago #

    @thinkwired,

    There should be now issues with upgrading provided you put this code into it's own plugin file rather than adding it to an existing plugin.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.