Amember sidebar plugin/widget for Wordpress

Discussion in 'Integration' started by skippybosco, Mar 19, 2008.

  1. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    I just updated one of my sites to Wordpress 2.5 and as a result had to make a couple of changes to my Amember sidebar widget.

    I didn't like the idea of hacking my template to get Amember functionality. It occurred to me that it may save others the time/trouble so I'm providing it here for free. Also available on WordPress.org at:

    http://wordpress.org/extend/plugins/amember-sidebar-widget/

    Features:
    • Configurable Title (Default: Members)
    • Configurable Active Membership Title (Default: Active Membership)
    • Configurable Amember Directory (Default: amember)
    • Listing of members subscribed products (hyperlinked where applicable)
    • Skinnable via CSS (input#amembersubmit for submit button)
    • Full XHTML compliancy
    • Works under Wordpress 2.3.x and 2.5

    Future plans:
    • Remember me checkbox
    • Ajax based invalid userid/password checking
    • Ajax based "Forgot Password"
    • Configurable "Logged in" links (check boxes in adbmin to select which links you want to show to members)
    • Ajax based lightbox based version to bypass redirect to login page

    Installation:

    1. Upload wpamember.php to your \wp-content\plugins directory
    2. Active "wpAmember" via your WordPress Admin console
    3. Add the widget to your sidebar via your WordPress Admin console
    4. Optionally configure Widget Title and Amember path via your WordPress Admin console

    I'll edit this post to include better instructions, screen shots, etc. if necessary.

    Message me or post here if you have any questions or feedback.

    note: This is NOT a replacement for a full Amember->Wordpress plugin, this simply adds the necessary Amember login box and member status links to your Wordpress sidebar.

    If you just protect files, and not Wordpress based content, then this should be all you will need. If you need to protect content, this can be uses in conjunction with the Amember->Wordpress plugin.
  2. deafdavid

    deafdavid Member

    Joined:
    Aug 28, 2006
    Messages:
    153
    I think this is an excellent information (will need to try it when I upgrade WP 2.5). This thread should be part of Sticky. Anyoneknow how to set this thread to Sticky?
  3. miso

    miso aMember Pro Customer

    Joined:
    Aug 22, 2006
    Messages:
    543
    do you have a version of this plugin for wordpress 2.3.x instead?

    or can I use the one you posted here as well?

    I am not planning on upgrading to 2.5 just yet, that's why...

    thanks!
  4. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    miso/deafdavid,

    Sorry for the confusion. This plugin widget will work for both 2.3.x and 2.5 versions of Wordpress. Should work on 2.2 versions as well, but I have not personally tested it.

    I never much liked hacking the template to get the Amember functionality so this makes it a much cleaner integration.
  5. travisperkins

    travisperkins New Member

    Joined:
    Aug 22, 2006
    Messages:
    3
    How did you get wp 2.5 working?

    You are a saint.

    I just spent all day crying because the amember wordpress plugin does not work with 2.5

    How did you get wordpress 2.5 working with the amember wordpress plugin.

    I can do something in retunr for you for the info.

    Thanks.

    Paul
  6. travisperkins

    travisperkins New Member

    Joined:
    Aug 22, 2006
    Messages:
    3
    Widget Amember

    Your widget worls perfectly for logging into amember. But it does not log them into wordpress. This not a problem with your widget. But I was just wondering: have you managed to get the wordpress amember plugin actually working so amember users get logged into wordpress, either using your widget or using the amember log in screen?

    And if so, what is the secret.

    Did you have to change anything in the wordpress config.php?

    My amember users are being added to the wordpress database, and they can log in. But amember is not logging them automatically. Wordpress 2.3 is fine. But 2.5 is a problem.

    Is this something to do with the way 2.5 handles cookies?

    Thanks
  7. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    Paul/Travis,

    I do not use the Amember plugin as I only protect files/folders, not content..

    There is a change to the cookie in 2.5

    This is probably what is impacting the plugin and I'm guessing will need to be updated by Alex and team.

    Hope that helps.
  8. schmitt

    schmitt New Member

    Joined:
    Oct 26, 2007
    Messages:
    28
    This is very useful - you should host it on the wordpress plugin site.
  9. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    Thanks. It has been submitted.. awaiting approval..

    I've got a few things listed in my todo: list, but let me know if there are other things you would like to see it do.
  10. humantorpedo

    humantorpedo New Member

    Joined:
    Jan 15, 2007
    Messages:
    23
    Great plugin and info. I just upgraded to 2.5 and was despairing of getting things working based on comments I've seen here and elsewhere, but I got the idea from your post to no longer use the single login function, instead to protect the folders for each protected file.

    Also, since I created my own theme and this one is not widgetized and don't want it to be, I used the meat from your plugin and created some code to use for a non-widetized sidebar. It's:

    PHP:
    <h2>Member Info</h2> 
    <ul>
    <?php
    $user 
    $_SESSION['_amember_user'];
    if (
    $user['member_id'] > 0){
        print 
    "Hello $user[name_f] $user[name_l]\n";
    } else {
        print 
    "You are not logged in.";
    }
    ?>
    <?php  
    if ($au=$_SESSION['_amember_user']){ // user is logged-in
                
    print "$au[login] <a href='(URL-TO-AMEMBER-FOLDER)/logout.php'>(logout)</a><br />";
                print 
    "<a href='(URL-TO-AMEMBER-FOLDER)/member.php'>Account Details</a> | <a href='(URL-TO-AMEMBER-FOLDER)/profile.php'>Edit Profile<br />";
                print 
    "</a>";
            } else { 
    // user is not logged-in
                
    print "<form action = '(URL-TO-AMEMBER-FOLDER)/login.php' method = 'post' />
                Username: <input type = 'text' name = 'amember_login' />
                Password: <input type = 'password' name = 'amember_pass' />
                <input type = 'submit' id = 'amembersubmit' value = 'Login' />"
    ;
            };
    ?>
    </ul>
    The parts that say "(URL-TO-AMEMBER-FOLDER)" have to be replaced with the URL to the Amember folder.

    Thanks again for the great post, I'll be looking forward to the upgraded wordpress plugin but not feeling like it's urgent at this point.
  11. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    humantorpedo,

    Integrating into non-widgetized themes is something I hadn't considered. Perhaps I can register something like <amember-login> tag someone can place in their template to eliminate the need to hardcode.
  12. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    I have made some changes, updating the above attachment to ver .2. Changes correct a couple of edge case scenarios with session handling and the logout link as well as validation of compatibility with WordPress 2.3.x and WordPress 2.5.

    This project is also being tracked on WordPress.org now as an official plugin:

    http://wordpress.org/extend/plugins/amember-sidebar-widget/

    Please let me know if you have any suggestions / feedback / questions.
  13. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    In addition to a change to the structure of the code and session handing, I've also added Member Subscription links (title configurable via Widget Control)

    I've gotten a couple of emails on how to style the controls

    = How do I style the controls? =

    Here are example stylings for the controls. Place this in your existing .css file and modify as you wish.

    input#a_login { background:#F3F3F3; border:2px solid #B4CBDF; color:#333; font-size:15px; width: 95%;}
    input#a_password { background:#F3F3F3; border:2px solid #B4CBDF; color:#333; font-size:15px; width: 95%; }
  14. johanhorak

    johanhorak New Member

    Joined:
    Mar 10, 2007
    Messages:
    4
    Redirect To Current Page

    Hi Thanks for this plugin. I have two problems that you may be able to help with.

    I am using a plugin to lock my content that opens up when someone log in to wordpress if they are an amember subscriber.

    1) Is it possible get the person to login and keep the person at the current page.

    2) Even if I cannot get that right I am not sure how to use the directory setting in the widget because I don't need it.

    Regards

    Johan
  15. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    1) Redirect is not controlled by the widget. Here is a suggestion from an older thread

    Code:
    function html_redirect($url, $print_header=0, $title='', $text=''){
    global $t;
    if (!$t) $t = &new_smarty();
    $t->assign('title', $title);
    $t->assign('text', $text);
    $t->assign('url', $url);
    $t->display('redirect.html');
    } 
    to

    Code:
    function html_redirect($url, $print_header=0, $title='', $text=''){
    header("Location: $url");
    }
    
    2) The directory option defines where your Amember installation path is for links and buttons and such.
  16. gmedia

    gmedia New Member

    Joined:
    Apr 6, 2008
    Messages:
    12
    Hi, just got amember and planning on using these plugin (but humantorpedo's hard coded version)

    Thanks a bunch mate :) feel free to get in touch for a free membership hehe

    G Media
  17. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    I'm getting quite a few emails on folks that don't want to use widgets.. as a result I'm considering a few options for the next release:

    1) use of wordpress tags to do things anywhere in a post, page or theme like):

    <- Amember Login Box -> (display login box)
    <- Amember Username -> (display amember user name)
    <- Amember Subscribed Products -> (display subscribed products)

    2) Amember WordPress Admin control panel

    Basically bring in Amember Admin CP features into WordPress admin (so you have one place to go).. Not sure if I will IFrame or port individual features over..

    Feedback welcome.. no idea on timing as I'm knee deep in a conversion project at the moment..
  18. gmedia

    gmedia New Member

    Joined:
    Apr 6, 2008
    Messages:
    12
    well other than I had to add session_start() to my template header (I'd just assumed WP would already have that but oh well...) and sticking the form into a neat table for layout (couldn't be bothered to open the sylesheet lol) it took about 2 mins to copy/paste in.

    I'd say add the quick tags if you can be bothered but, low priority IMO. Maybe just add in the plugin settings a box with the sidebar code needed?

    BTW my site now up and running (lacking content though) -> http://www.fightnightlive.co.uk
  19. gmedia

    gmedia New Member

    Joined:
    Apr 6, 2008
    Messages:
    12
    hmm well I had the plugin from alex working at first, (i.e. when user logged into amember they also logged into wordpress) but seems to have stopped working now... annoying
  20. anrob

    anrob New Member

    Joined:
    Apr 21, 2008
    Messages:
    2
    Cookie Problem wordpress 2.5

    I have set everything up using the new plugin above.

    But is still doesnot log me into wordpress

    I can log into both separately

    What am i missing?

Share This Page