Go Back   aMember Pro Forum > aMember > Integration

Reply
 
Thread Tools Display Modes
  #1  
Old 03-19-2008, 07:00 AM
skippybosco's Avatar
skippybosco skippybosco is offline
CGI-Central Partner
 
Join Date: Aug 2006
Posts: 1,678
Lightbulb Amember sidebar plugin/widget for Wordpress

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/...idebar-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.
Attached Files
File Type: php wpamember.php (3.3 KB, 90 views)

Last edited by skippybosco; 04-08-2008 at 01:35 AM.
Reply With Quote
  #2  
Old 03-19-2008, 10:36 AM
deafdavid deafdavid is offline
Registered User
 
Join Date: Aug 2006
Location: Washington, DC
Posts: 139
Send a message via AIM to deafdavid
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?
Reply With Quote
  #3  
Old 03-19-2008, 12:24 PM
miso miso is offline
CGI-Central Partner
 
Join Date: Aug 2006
Location: Toronto, Canada
Posts: 409
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!
Reply With Quote
  #4  
Old 03-19-2008, 05:30 PM
skippybosco's Avatar
skippybosco skippybosco is offline
CGI-Central Partner
 
Join Date: Aug 2006
Posts: 1,678
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.
Reply With Quote
  #5  
Old 03-20-2008, 11:25 AM
travisperkins travisperkins is offline
 
Join Date: Aug 2006
Posts: 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
Reply With Quote
  #6  
Old 03-20-2008, 01:03 PM
travisperkins travisperkins is offline
 
Join Date: Aug 2006
Posts: 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

Last edited by travisperkins; 03-20-2008 at 01:13 PM.
Reply With Quote
  #7  
Old 03-20-2008, 09:56 PM
skippybosco's Avatar
skippybosco skippybosco is offline
CGI-Central Partner
 
Join Date: Aug 2006
Posts: 1,678
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

Quote:
user name|expiration time|HMAC( user name|expiration time, k)
where k = HMAC(user name|expiration time, sk)
and where sk is a secret key
This is probably what is impacting the plugin and I'm guessing will need to be updated by Alex and team.

Hope that helps.
Reply With Quote
  #8  
Old 03-24-2008, 08:08 AM
schmitt schmitt is offline
Registered User
 
Join Date: Oct 2007
Posts: 28
This is very useful - you should host it on the wordpress plugin site.
Reply With Quote
  #9  
Old 03-24-2008, 08:55 AM
skippybosco's Avatar
skippybosco skippybosco is offline
CGI-Central Partner
 
Join Date: Aug 2006
Posts: 1,678
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.
Reply With Quote
  #10  
Old 03-30-2008, 02:13 PM
humantorpedo humantorpedo is offline
Registered User
 
Join Date: Jan 2007
Posts: 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 Code:
<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.
__________________
Innovative website themes ...
6templates.com
Reply With Quote
  #11  
Old 03-30-2008, 05:44 PM
skippybosco's Avatar
skippybosco skippybosco is offline
CGI-Central Partner
 
Join Date: Aug 2006
Posts: 1,678
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.
Reply With Quote
  #12  
Old 04-02-2008, 09:38 PM
skippybosco's Avatar
skippybosco skippybosco is offline
CGI-Central Partner
 
Join Date: Aug 2006
Posts: 1,678
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/...idebar-widget/

Please let me know if you have any suggestions / feedback / questions.
Reply With Quote
  #13  
Old 04-08-2008, 01:37 AM
skippybosco's Avatar
skippybosco skippybosco is offline
CGI-Central Partner
 
Join Date: Aug 2006
Posts: 1,678
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%; }
Reply With Quote
  #14  
Old 04-17-2008, 11:05 AM
johanhorak johanhorak is offline
Registered User
 
Join Date: Mar 2007
Posts: 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
Reply With Quote
  #15  
Old 04-17-2008, 05:08 PM
skippybosco's Avatar
skippybosco skippybosco is offline
CGI-Central Partner
 
Join Date: Aug 2006
Posts: 1,678
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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
amember and wordpress queries lindaph Pre-Sales Questions 3 01-13-2009 08:14 AM
aMember and Wordpress Single Login? erikcw Integration 15 11-09-2008 03:11 PM
Amember and Wordpress 2.3.2 binbin Integration 0 01-31-2008 05:37 AM
Amember and Wordpress VIDEO binbin Integration 2 01-30-2008 01:44 AM
Using Wordpress with Amember ramiro77 Customization & add-ons 1 06-28-2007 12:31 AM

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.