• Resolved rick111

    (@rick111)


    Can I disallow the profile change option for non-admins after they log in? The reason is that although I hide the toolbar from non admins using the following hook as a plugin

    function my_function_admin_bar($content) {
    return ( current_user_can( ‘administrator’ ) ) ? $content : false;
    }
    add_filter( ‘show_admin_bar’ , ‘my_function_admin_bar’);

    But logged in users can still change their profile from Subscribe2 profile change option.

    Thanks

    https://wordpress.org/plugins/subscribe2/

Viewing 11 replies - 1 through 11 (of 11 total)
  • @rick111,

    Yes, you can disable access to that menu using the ‘s2_capability‘ hook in Subscribe2. It is documented in the API documentation I have written.

    Thread Starter rick111

    (@rick111)

    Thank you but with all respect due not all the users of your plugin are developers. I know how to make a new plugin with a hook but more specific instructions would be appreciated. I just want to disable completely from all registered subscribers,other than administrators, the widget option that allows profile changes, i.e. remove completely that message and its link to profile. I think this should be a regular option in the plugin. Why does the plugin link to WP profile? This should be an option the administrator should set.

    @rick111,

    What you are asking for is to essentially completely change the way the plugin is designed to work.

    Subscribe2 supports 2 types of Subscriber, public – who have simply supplied their email and have only the option to subscribe or unsubscribe. And Registered users who have registered with the blog in the core WordPress code and then get greater control over the email format and the categories they get emails for – that is why the need access to the Subscribe2->Your Subscriptions screen and get access to their own profile where that can add further details and change their password.

    Changing this functionality would be a lot of work and would also run the risk of annoying users that find this current workflow suits their needs well.

    Thread Starter rick111

    (@rick111)

    You see your plugin interferes with my simple hook to disallow toolbar access for my users because I offer custom profile pages. You insist that it is not easy to remove the option to access the WP profile. I am not asking you to change the plugin. I am asking you if I can remove that. and It appears like you do not know how to do that. Are you the plugin author? Anyway, I will scrap it if I cannot remove the option to access the profile. If you are really the author plugin, it should not be hard to provide precise directions. I am not asking you for a change of the plugin but for a hack of the code to fit it to my requirements. Do you know how to do it or not? Thank you in advance.

    @rick111,

    I am the plugin author and I am here to try and help you but I can’t write code to fix your problem when I don’t know exactly what you want – and I don’t yet understand what you are after.

    If we disable the display of the linked text that say “You may manage your subscription options from your profile” then your registered users cannot access their Your Subscriptions page to unsubscribe – that’s not a good idea as it annoys your readers and creates work for you unsubscribing them but if that’s what you want I can tell you how to do it.

    If you want to remove the Users->Your Profile menu from the admin page they access that is part of the WordPress core but I think I can find a solution something like this (tested and works for me):

    function kill_profile_menu() {
    	remove_submenu_page('users.php', 'profle.php');
    }
    add_action('admin_init', 'kill_profile_menu');

    Thread Starter rick111

    (@rick111)

    @mattyrob,

    Thank you. I see your point but I have only a few registered users and (a) I have control over their subscriptions and (b) public users can unsubscribe from the S2 button if they wish. Therefore, I would greatly appreciate the help to remove the linked text that say “You may manage your subscription options from your profile”. Actually, can I replace with linked test of my choice, for example “To unsubscribe please contact support” ?

    @rick111,

    Okay, it’s your site – so long as you are sure 😉

    Look in the classes/class-s2-frontend.php file of the Subscribe2 plugin and find the following code around line 125:

    get_currentuserinfo();
    if ( $user_ID ) {
    	$this->s2form = $this->profile;
    }

    Then remove the ‘$this->profile’ and place whatever text you want to use instead in there wrapped in quote marks. Save the changes and check it on your site.

    Note, you will need to make this change every time you update the plugin.

    Thread Starter rick111

    (@rick111)

    @mattyrob,

    I appreciate your help. It worked well. Anyway, please note that I use the Remove Dashboard Access plugin for users and this would not allow access to profile from the Subscribe2 link and thus the text was redundant. This cannot be made to a filter, right? Thanks again for your great help.

    @rick111,

    There is a way to change the text using translation files rather than making the change on each version release. (Even if you are running the blog in English), this would also be preserved between updates if you place the translation file in /wp-content/languages/.

    If you want to try this approach let me know and we can figure it out.

    Thread Starter rick111

    (@rick111)

    Thanks. If there is way to make a new plugin with pluginception to take care of this instead of doing it in the code that will be great. I already use a plugin to remove the text “Enter your email”.

    @rick111,

    There isn’t a way in the current code to do this via a plugin (or pluginception) as there is no filter available on the displayed messages. I’ll have a look if I can make that a possibility.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Disallow profile change for non admins’ is closed to new replies.