WP-Members™ 2.2.2 code improvement release

With the launch of WP-Members™ 2.2, there were some significant changes from the 2.0/2.1 releases.  Most notably was the return of the admin panel.  This is due to adding some customization settings that weren’t there before.  But when you add things like an admin panel, that can make a plugin that previously was efficient in a single file become a bloated mess.

So, steps were taken to clean up some of the new code I created for 2.2.  This involves breaking out the admin functions to a separate file, as well as the install functions.  Plugin developers take note: it is more efficient for the plugin in general to separate these process into their own files that only load when needed.  The admin file is not loaded unless the user can edit options and the install file is only loaded if the install activation hook is, well… hooked.

Also, since we are now playing with the WP database, we don’t want to leave any nasty traces behind if the user were to uninstall the plugin; not that anyone would want to delete such a fantastic plugin ;-)  I added the WP required uninstall.php file to cleanup the database as the plugin is deleted.  This also gives you the ability to do a clean install without directly touching your database, if that becomes necessary.

Another big improvement, I was able to eliminate about 200 lines of code by rewriting some of the primary functions to reduce redundancy and/or be more efficient.

All of these changes are code cleanup type changes and really have no effect on the end-user views or functionality (either by the site admin or the site user); that is unless you’ve tweaked the code of your install.  (Note: the install process does not touch your customized settings so anything you have set in the database should remain untouched.  But if you made code changes to anything that does output, you are going to overwrite these changes by upgrading – but that’s no different that any other plugin, really.)

An undocumented change at this point is the addition of some <div> tags for CSS.  The messages given for form validation and the like have always had a <div class=”wpmem_msg”> for users to define in their theme’s CSS.  This release adds <div class=”wpmem_login”> and <div class=”wpmem_reg”> around the login form (also used for password change and reset) and the registration form.  I opted not to define this as an ID since a user may possibly have at some point more than one instance on a page, so rather these are classes.  Also, these are presently undocumented changes as I’m not sure if they will stay exactly as they are.  So here is the caveat – if you need more style control over the plugin’s output for login form and registration form, the CSS classes are there for you, but their specification may possibly change in future versions so you may need to make fresh updates down the road.

That’s all for now.  I am now only working on the 2.3 release which will include the following features:

  • Notify admin of new user registration
  • Hold new user registrations for moderation/approval
  • Time-based user expirations (tentative – may be pushed back to future release)
  • Trial period (tentative – may be pushed back to future release)
  • Turn off registration (for admins that manage users elsewhere and only want the inline login process)
  • Toggle to show excerpts on pages/posts if not logged in (helpful for SEO/Social Media)

Comments

  1. Therese says

    Hi,
    I have installed wp-members on ths site, and like it so far.

    But, have a problem – new users are not being sent their passwords!

    How do I fix this?

    T

    Please answer via my email.

    • Chad says

      I should probably add a response to this question to the FAQ in the readme file as this is not the first time it has been asked ;-)

      WP-Members uses the native WP function wp_mail to email passwords. This is the same function the WP uses if you are using the WP registration process. If it’s not configured properly or for some other reason not working, neither will WP-Members’ registration process.

      You can test this process by creating a new user via the WP admin panel. Go to Users > Add New in the menu and create a new user. Make sure when you do this “Send this password to the new user by email” is checked. If you do not get an email, then wp_mail is not working.

      If that is the case, you are probably going to have to do some troubleshooting to fix it. Try the WP support forums for this: http://wordpress.org/tags/wp_mail

  2. Patrick says

    Hi Chad. You mentioned that you’re working on holding new user registrations for moderation/approval in the next update. This must be one of the most valued features, as selectively blocking content from non-members is really defeated if one can easily subscribe to membership.

    Any idea when this will be launched?

    In the meantime, is there any way to disable the wp-members login and use WP’s native login, while making use of the rest of the content blocking features of wp-members?

    Thanks!
    Patrick

    • Chad says

      Actually, I am way ahead of where I thought I would be with the version 2.3 project list. In order to move things along, I may hold off on time-based expiration and trials in order to move forward with the update. If I do that, I’m almost ready to move into beta testing as those are the only things left on the project list that are incomplete. But there is some testing to do, mostly with the install/upgrade process as the more options that are added, the more greater number of upgrade scenarios that need to be tested.

      As far as disabling the login and relying on WP’s native login, that certainly could be done, but it wouldn’t be a simple process.

      Hope that helps.

  3. Kevin says

    I loaded the WP Members and am excited about it.
    I have a couple of problems I am hoping you can help me with.
    When I activate the plug it removes all but 3 of my page tabs and places them in a stack in the header.
    Also it puts 3 registration sections at the top of the page.

    Any help would be wonderful,
    Thanks
    Kev

    • Chad says

      Kevin,

      There are some themes and plugins that utilize multiple instances of the WP Loop. Due to the nature of how WP-Members blocks content and replaces it with a login/registration process, this creates an incompatibility.

      To see if this is your theme or another plugin, switch to the default theme and deactivate all plugins except WP-Members, then reactivate one-by-one and retest (logout to retest, since if you are logged in to the admin, the front end will view you as logged in and you would reproduce the issue). If you don’t reproduce with a plugin, then switch back to your theme and see if that’s it.

  4. Yu-Li says

    Thanks for this wonderful plugin! I noticed, however, that the login failed function does not seem to be working. It does not seem to be working on your demo page either. Instead, when a false login and password are provided, it simply refreshes the page with no error message.

  5. Chris Rosenthal says

    This is great and seems to work quite well but, I was wondering where the users information is stored? I am a bit worried to employ this without knowing that information. Could you please clarify?

  6. Grace says

    Hi Chad,
    Fantastic plugin.

    Just wondering how I might remove the registration form from the ‘Members Area’?
    I only want the login, and maybe I’ll add a link to the registration page.

    If you could even just point me to which file is generating the members area, and on which lines the registration form lies and I might be able to figure it out.

    Cheers

    • Chad says

      Reworking the comments areas, I don’t think that this ever was appropriately answered. However, in the more recent versions of the plugin, the registration form can be toggled on/off if you do not want it to show. This is covered more in depth in the Users Guide.

  7. Linda says

    Hi Chad,
    Trying out your plugin for the first time and it’s looking good! Like Grace, I need to remove the registration form. Would you send me what you sent Grace?
    Is it possible to make text changes, ie., change the text from ‘Members Area’ to something else or postcode instead of zip?
    Many thanks!

  8. Linda says

    Apologies, just found out that I only needed to use Members Area as the title if I’m using WP default permalinks – duh! Need to read your quick start guide properly!

    • Chad says

      I can’t tell if this is a legitimate question or spam. I guess I always thought I had designed this to be simple and intuitive, although I probably should add specific uninstall instructions to the Users Guide.

      To turn off the plugin, simply deactivate it using the plugin administration panel.

      To remove it completely, once deactivated, select delete from the plugin administration panel. WP-Members has its own uninstall process following WP plugin standards that, once the delete option is selected will delete all of the plugin’s files and remove any plugin specific database entries (it only removes the plugin’s database entries, it will not remove any users).

      Lastly, if you created any pages specific to the plugin that you will no longer user (i.e. members area/settings, register), you can delete those, too.

      More information on deactivating and removing plugins is available in the WordPress Codex.

  9. moneygrows says

    Yes, it was a legitimate question. Thanks for answering. The reason i asked is because i can’t find the plugin on my plugin administrative panel. My bad, coz i didn’t realize i have 2 page for my plugin! Anyway, since you’re around now, can i ask another question.

    I wanted to do a “member’s only” download area. Can it be done with this plugin? If so, how? Will it protect the download links too.

    Thanking you in advance :)

    • Chad says

      I have to laugh, because I’ve done the same thing thinking where is such-and-such a plugin and it was on a second page. Maybe I should have named it AAA-WP-Members so it would be right at the top, like in the phonebook.

      The plugin is really written with blog content protection in mind. You can protect the area that contains the links, but at this point, you can’t really protect the actual link. That is to say, if someone knows the link location, they could access it directly. For example, you have a PDF download that can be accessed from a “download here” link that is part of some protected content. UserA is a registered user and has legitimate access to the link. He therefore can discover that the link is http://mydomain.com/mypdf.pdf. He shares that information with UserB. UserB can download the pdf, because knows the direct location.

      I have thought about something like that, though as others have asked as well. I was thinking of an add-on that would mask the link and require access to it be from a restricted page. That way, even if someone tried to access the download link directly, they would be denied and required to login. So using the scenario outlined above, the link is actually http://mydomain.com/mylinkmask and that must be accessed directly from http://mydomain.com/mypage. UserB is given http://mydomain.com/mylinkmask as the link to the PDF, but when they try to access it, they are presented with http://mydomain.com/mypage to login.

      So that’s how I intend to build it. I just don’t have a timeframe on that kind of project.

  10. moneygrows says

    Again, thanks for the respond. Do you have a newsletter i can sign up or something? Wouldn’t wanna be left out when you launch that project.

    • Chad says

      I expect to launch a newsletter before summer is over. Until then, you can follow me on twitter (@butlerblog) as I usually announce updates and projects there.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>