Recently while I was working on a member’s area based upon WordPress and aMember Pro, the aMember script crashed with an internal script error. I also encountered a strange redirect problem. I believe that it was two distinct errors that were not directly related but the redirection error might have somehow caused the aMember script to crash.
I decided to write this article to help anyone that comes across the same problems and describe how I solved the issues and got aMember running again without losing any data. There isn't a lot of information online pertaining to aMember and many of the forum posts I found in the aMember forums just say to contact support. I hope that this article will help someone.
The first problem started with strange redirects in WordPress. Pages were being redirected to very long, random character URL’s. There were infinite loop redirects and page not found errors. I later discovered that the cause of this problem probably was but the aMember script error occurred before I found out how to solve the problem and I had to deal with that problem first. I will mention later in the article what is likely the solution to that problem. I didn’t test that solution on its own so I’m not 100% certain about it but after I got aMember working again I still had that issue and what I did solved the problem. You should test it on your own, it may work for you and it may not.
The error that I received in aMember is that an internal script error occurred. The error was in a red colored box. The error causes the entire aMember system to crash and it’s impossible to get access to the system or login as admin. I wasn’t making any changes at the time so I’m not sure why the crash occurred and I had no idea where to begin looking to solve the problem.
After scratching my head for a while I began my search online and in the aMember forums to see if I could find how to fix the problem. Unfortunately I wasn’t able to find much helpful information. One forum post suggested that it might be a rights issue. Since nothing had changed with the server rights since when the installation was working and when the error occurred, it wasn’t likely to be the problem. I tried changing the rights anyway but it did not solve the issue. Another suggestion I found was to check the .htaccess files. Unfortunately in my case this wasn’t the problem.
After some thought and testing this is the solution that I came up with for the aMember installation. Here are the steps:
- Do a MySQL dump of your old aMember database
- Reinstall aMember in a new directory
- After installation is complete drop all the tables in the new database and then import the MySQL dump of the old database
If you don’t drop all the tables you will get a bunch of duplicate entry errors. Dropping all the tables so the database is empty prevents this. This step is very important.
- Next update your root URL to the new installation of aMember in CP > Configuration > Setup/Configuration > Global. Click the change link next to “Root URL and License Keys” and update the root URL in that screen.
At this point you should now have a new, working installation of aMember with all of your original products, forms and everything else.
- Now we need to reintegrate WordPress with aMember again.
- First disable the aMember WordPress plug-in and then delete it.
For the next step, completely removing the aMember plug-in, I used a WordPress plug-in called Clean Options. It says the plug-in hasn’t been updated in over two years but the plug-in still works okay and has helped me on a couple of different occasions. If you don’t completely remove the aMember plug-in then information remains in the WordPress options table and when you re-install the aMember plug-in it will take the old settings, which you do not want. You may also receive an error if you try to enable protection because the integration is still pointing to the old aMember installation.
After installing the Clean Options plug-in and enabling it run a scan. Under the tools menu in your WordPress installation choose CleanOptions from the menu. Make sure you leave the option “Don’t show the Known WorPress Core options for this Find” selected and then click the “Find Orphaned Options” button.
The entries that you should completely remove start with “am4”. One entry is callced “am4options”. There might also be another entry, there was in my case but I don’t remember the exact name. Use Clean Options to completely remove these entries.
You can also do this step manually by accessing your wp-options table directly in MySQL but it’s quite a bit more dangerous so I wouldn’t really suggest that. Also, be careful with this plug-in. If you delete something you shouldn’t from the table you will likely cause a big problem. Use at your own risk. You have been warned!
As I previously mentioned, it is this step that may have resolved the redirect issue, if I had done it first, but the aMember script crashed before I found the solution. After reinstalling aMember the redirect problem still existed, so I then knew that the problem was with WordPress Next:
- Re-install the aMember WordPress plug-in.
- Re-integrate your WordPress installation with aMember under aMember > Settings in WordPress. The screen should be completely blank with no information if you correctly removed all the previous table information in the last step.
- Re-enable protection if you are using the “protect whole blog” option
After deleting the aMember WordPress entries in the options table and redoing the integration with WordPress, the redirect problem was solved. I believe that the entries in the wp-options table somehow got corrupted and that’s what caused the redirect problems. If you are experiencing redirect issue with aMember I suggest you try removing the aMember plug-in, deleting the information in the wp-options table, re-installing the aMember plug-in, and re-integrating aMember first and see if it resolves the issue.
If you encounter the internal script error with aMember Pro this should also solve the issue without you losing all the data for your site and having to recreate your entire member’s area from scratch. The process should work independent of the redirect issue.