Jump to content

Bootstrapping PW within aMember


NikNak
 Share

Recommended Posts

Hi there

I am trying to configure aMember  (amember.com) alongside PW for a membership website. The two systems live alongside eachother in the root directory.

Within PW, using aMember's api, I can check whether a member has logged in to the aMember system, so can restrict access etc which is all good.

However, from within the aMember system templates, I want to be able to access the PW api. I have implemented the PW bootsrapping as shown here http://processwire.com/api/include/

Unfortunately this immediately causes an Internal Server Error - with no more details shown or within any logs. I've tested the PW bootstrap within a separate script and it all works fine.

I can't tell where the conflict might be or where to start looking to resolve the issue. I've approached aMember to see if there's anything I can try from there side but I thought I might also see if there's anything I can try from the PW side.

If anyone has any suggestions of where I could start I'd love to hear.

Regards

Nik

Link to comment
Share on other sites

Also, check if your Protection Method is New_Rewrite or Mod_Rewrite, I know the Mod_Rewrite can cause issues with non amember scripts.  Also, if you have either New_Rewrite or htpasswd as your method, you won't get many logs.  I think New does logins and htpasswd logs nothing

Link to comment
Share on other sites

Thanks Mindfull

Thanks - they say in their wiki that your scripts should ideally be put in a certain php file at the top level. However, this file doesn't seem to be called from aMember as far as I can tell. I tried it, and even just put an echo statement in there to see if there was any output - but nothing. 

I've just looked again and found another wiki entry saying you should put your scripts in a completely different file. This time the file is called, but the same error occurs.

The protection method was New_rewrite. I ust accidentally switched it to htpassword and have now been locked out of the site completely. Time to go home I think!! I'll try and find how to get back in tomorrow! :-(

Many thanks for your suggestions.

Nik

Link to comment
Share on other sites

http://manual.amember.com/Protection_Methods At the bottom of the page: 

To enable htpasswd plugin, follow instructions:

  1. Visit aMember CP -> Setup -> Plugins and enable htpasswd in Protection Plugins list.
  2. Click to aMember Cp -> Rebuild Db to build .htpasswd and .htgroup files in amember/data/ folder, else protection will not work until Midnight.

Lol, I don't know how helpful that bit will be if you can't get into the CP.

Link to comment
Share on other sites

BTW,  I saw your thread @ https://processwire.com/talk/topic/5735-membership-subscription-payments-general-pw-support/#entry58940 and I think once you get over this hurdle, things will get easier with integrating PW into aMember since the PW api is so easy to use. If I still used aMember I would try this myself, I think it would work really well.

Link to comment
Share on other sites

Thanks Mindfull

So, I wrote to aMember tech support saying:

- PW has an API that can be bootstrapped from other scripts

- The Server Error wasn't generating any logs

- I don't want to use static html as an alternative

Their response this morning:

- PW is not developed to to be included from external scripts

- Look at your server logs

- You should use static html

!!!!!!!

With help like this - I think getting this to work in tandem with PW is looking very unlikely. 

I think what I can offer my client here may end up half baked and ugly with aMember being more of a standalone bolt-on.

Regards

Nik

Link to comment
Share on other sites

Lol, my experience with most HelpDesk guys (including friends that work in the field) is they know enough to pretend they know it all.  aMember has a script (plugin) for other CMS's including WordPress and Joomla.  If they can do it, so can we, ugh... you!  After all, it's more a matter of mapping database fields then anything else. You would create a script that grabs the aMember data on login, validate the subscription, if all is good, pass it to PW.  Firstly, if you don't mind me asking, what does your include() look like on aMembers side? It should be the absolute path from the server root to PW index.php

Link to comment
Share on other sites

H MindFull

Using the supplied 'lite' api from aMember is fine for getting login details into PW. My main ambition was to be able to get the site html and nav to wrap the aMember output, from the PW site into aMember templates without having to resort to a static html copy.

The 'include' had been called using the absolute server path. I echoed the calculated path to make sure it was calling the right file. I have tried with htaccess disabled (removing the .htaccess and changing the method within aMember). Perhaps I need to try on a real server rather than MAMP. 

TBH at the moment, I think I need to really check whether aMember can do the other things I need.  It doesn't seem to have logic for only offering a certain product to people in a certain group - ie for student discounts. The only logic available is to restrict the product based on a current product the user has. Back to their helpdesk!

Thanks so much for the help and encouragement.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...