WordPress.org

Ready to get started?Download WordPress

Forums

Subscribe2
[resolved] Allowing Editors to see the Subscriber list? (28 posts)

  1. RustyWood
    Member
    Posted 9 months ago #

    Hi I was trying to let an Editor be to see the list of subscribers, as at the moment only Your Subscriptions and Send Email are available to them, is there a way for them to have the Subscribers List?

    Thanks

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

  2. mattyrob
    Member
    Plugin Contributor

    Posted 9 months ago #

    @RustyWood,

    There is a way and it's covered in the FAQs

  3. RustyWood
    Member
    Posted 9 months ago #

    @mattyrob

    Thanks .. yep, found it !!!

  4. gphx
    Member
    Posted 8 months ago #

    Hi - how can I show the Subscribers List to an Author? I have read the FAQ but am completely new to WordPress capabilities. What is the exact code?

    Thanks!

  5. mattyrob
    Member
    Plugin Contributor

    Posted 8 months ago #

    @gphx,

    See the example code for the 's2_capability' hook here:
    http://subscribe2.wordpress.com/support/api/

  6. gphx
    Member
    Posted 8 months ago #

    Hi, thanks for the super fast reply. Would it work if I add the following to my child theme's functions.php:

    function s2_admin_changes( $capability, $menu ) {
    // $capability is the core WordPress capability to allow admin pag
    // $menu is the title of the page:
    // 'user' for access to personal subscription settings
    // 'manage' to allow access to the user management screen
    // 'settings' to allow access to the plugin settings
    // 'send' for access to the Send Email page
    // identify the menu you are changing capability for first
    // then return a new capability
    if ( $menu == 'manage' ) {
    return 'read';
    }
    return $edit;
    }
    add_filter('s2_read', 's2_admin_changes', 10, 2);

  7. mattyrob
    Member
    Plugin Contributor

    Posted 8 months ago #

    @gphx,

    The code will work in that file but from what you have pasted above there is an issue - you are returning $edit for all menus other than 'manage' and yet the $edit variable is not defined.

  8. gphx
    Member
    Posted 8 months ago #

    How about this:

    return $edit_posts;

  9. gphx
    Member
    Posted 8 months ago #

    Done! Thanks @mattyrob!

    Here is the code I pasted into my child theme's functions.php

    function s2_admin_changes( $capability, $menu ) {
    // $capability is the core WordPress capability to allow admin pag
    // $menu is the title of the page:
    // 'user' for access to personal subscription settings
    // 'manage' to allow access to the user management screen
    // 'settings' to allow access to the plugin settings
    // 'send' for access to the Send Email page
    // identify the menu you are changing capability for first
    // then return a new capability
    if ( $menu == 's2_manage' ) {
    return 'read';
    }
    return $edit_posts;
    }
    add_filter('s2_manage_options', 's2_admin_changes', 10, 2);
  10. mattyrob
    Member
    Plugin Contributor

    Posted 8 months ago #

    @gphx,

    I don't think that's going to work for you. In the if statement you are looking for 's2_manage' and it should be 'manage'. Also, you are still passing back an undefined variable in $edit_posts, I think it would work better if that was left as $capability.

    At least you are giving it a go though and hopefully learning a little as you go.

  11. gphx
    Member
    Posted 8 months ago #

    Hi @mattyrob,

    The above code seemed to work fine but I tweaked it according to your feedback to avoid any potential errors. It now looks like this:

    function s2_admin_changes( $capability, $menu ) {
    // $capability is the core WordPress capability to allow admin pag
    // $menu is the title of the page:
    // 'user' for access to personal subscription settings
    // 'manage' to allow access to the user management screen
    // 'settings' to allow access to the plugin settings
    // 'send' for access to the Send Email page
    // identify the menu you are changing capability for first
    // then return a new capability
    if ( $menu == 'manage' ) {
    return 'read';
    }
    return $capability;
    }
    add_filter('s2_manage_options', 's2_admin_changes', 10, 2);

    Great support like yours is ideal for those of us learning to adjust to WordPress :) Thank you!

  12. karlcw
    Member
    Posted 7 months ago #

    Hi there,
    I copied the above code into the functions.php file and nothing changed.
    What am I missing?
    Thanks?
    Karl

  13. mattyrob
    Member
    Plugin Contributor

    Posted 7 months ago #

    @Karl,

    You may well not see a change as this code would allow all user levels below administrator to access the Subscribe2->Subscribers page where previously it would not have been available to them.

    It you are an administrator you will already have access to that page so won't see any difference.

  14. karlcw
    Member
    Posted 7 months ago #

    Hi Mattyrob,
    I know I can see the menu as admin but I also have an editor login and can see no difference there.
    As an editor I still can't see the subscriber list.

  15. mattyrob
    Member
    Plugin Contributor

    Posted 7 months ago #

    @Karl,

    Did you paste the code above into your functions.php file before the closing ?> at the end of the file or after it?

  16. karlcw
    Member
    Posted 7 months ago #

    There doesn't seem to be a closing ?> at the end of the file.

    But I've put the code into the functions.php of the child theme and wrapped them in the <> php wrappers anyway.

  17. mattyrob
    Member
    Plugin Contributor

    Posted 7 months ago #

    @Karl,

    If there was no closing PHP tag you may have created a corrupt file by adding in another opening tag, try removing both of the PHP tags you added and see if that works.

    If not please can you post the entire file on PasteBin or similar.

  18. karlcw
    Member
    Posted 7 months ago #

    I'm using the twenty twelve theme with child theme and I've not amended the core functions file at all.
    Having looked at other 2012 installs, none of them seem to have a closing php tag either.

    Here's the code: http://pastebin.com/82CytPsW

  19. mattyrob
    Member
    Plugin Contributor

    Posted 7 months ago #

    @Karl,

    The file you have added to the pastebin is the core functions.php file from the TwentyTwelve theme but it does not contain the code snippet from the comments above. Is this the file from your site?

  20. karlcw
    Member
    Posted 7 months ago #

    That's right, the code in my child theme functions file is here : http://pastebin.com/E2sdEqbh

  21. mattyrob
    Member
    Plugin Contributor

    Posted 7 months ago #

    @Karl,

    Does it work if you move the code from the child theme functions.php file to the main theme functions.php file?

  22. karlcw
    Member
    Posted 7 months ago #

    Nope, copied the above code into the parent functions file and an editor login still can't see and manage subscribers.

  23. mattyrob
    Member
    Plugin Contributor

    Posted 7 months ago #

    @Karl,

    Face palm!! Can't believe I missed this for so long! The hook name in the above code is wrong so it's never going to work. I was thrown off as the OP had it working. The code you need for the child theme functions.php file is this:

    <?php
    function s2_admin_changes( $capability, $menu ) {
    	if ( $menu == 'manage' ) {
    		return 'edit_posts';
    	}
    	return $capability;
    }
    add_filter('s2_capability', 's2_admin_changes', 10, 2);
    ?>

    I've fixed the hook name and also used 'edit_posts' so the menu will only show to Editors and above - not Subscribers and above.

  24. karlcw
    Member
    Posted 7 months ago #

    Huge thanks Matt, your tenacity is much appreciated and it now works just fine.

    I've just made a small donation to your cause. Hopefully it's enough to buy you a big coffee (or beer, as the case may be).

  25. mattyrob
    Member
    Plugin Contributor

    Posted 7 months ago #

    @Karl,

    Thank you very much indeed for your donation, your gesture is very much appreciated. It might be a beer celebrating cracking this one as I was really scratching my head! :)

  26. karlcw
    Member
    Posted 1 month ago #

    Sorry to bring this one up again but now i need to add the code to the core functions file but when I do it makes a mess of the site.

    Can you help?

    cheers
    Karl

  27. mattyrob
    Member
    Plugin Contributor

    Posted 1 month ago #

    @Karl,

    I'm not sure what you mean by "add the code to the core functions file", can you be a little more specific? Do you mean you need to add this to the parent functions.php file of your theme rather than the child theme?

    It may be a case of looking whether you need the opening (<?php) and closing (?>) PHP tags, they may not be needed now.

  28. karlcw
    Member
    Posted 1 month ago #

    No worries on this, worked around it.

    thanks again
    Karl

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.