Page 1 of 1

Just one problem

PostPosted: January 12th, 2011, 12:50 pm
by mrbigstock
Hi.

I have managed to get s2member working on my site but one page (internal profile page) shows an error like this:

Fatal error: Call to undefined method stdClass::has_cap() in /home/content ********etc.

there would normally be an 'update profile' button where this code appears

Any ideas or help would be appreciated.

Thanks

John

Re: Just one problem

PostPosted: January 12th, 2011, 6:52 pm
by idreia
First thing to rule out is another plugin that is interfering. You should turn off all plugins except for s2 and see if the error goes away. Then turn your plugins on one at a time and retest until the error reappears--this will be the plugin that is causing the trouble. Once the offending plugin is found you can either look for an upgrade, contact the author, or find a replacement.

It never hurts to let the folks at s2 know about the incompatibility issue, as they are easily fixed once in awhile.

Re: Just one problem

PostPosted: January 13th, 2011, 5:23 am
by mrbigstock
Hi Thanks for the reply. None of that worked unfortunately.

The full error code is below if you have any other thoughts.

Fatal error: Call to undefined method stdClass::has_cap() in /home/content/59/6763659/html/wholesale_clearance_uk/wp-content/plugins/s2member/includes/functions/user-access-level.inc.php on line 38

Re: Just one problem

PostPosted: January 23rd, 2011, 3:02 pm
by jamesg
:D

Re: Just one problem

PostPosted: February 19th, 2011, 10:04 am
by mignonkm
I'm having this same issue, did you happen to find a solution?

Re: Just one problem

PostPosted: March 18th, 2011, 1:49 pm
by sfraser657
Hey,

It can be fixed by modifying the plugin source. Open the file that has the error and go to the line indicated y the error.
change each occurance of the function as follows:
Code: Select all
$user->has_cap ("access_s2member_level0")

Code: Select all
$user->allcaps["access_s2member_level0"]


You'll have to change it 5 times, one for each access level.

Peace,
Steve

Re: Just one problem

PostPosted: March 18th, 2011, 2:10 pm
by Cristián Lávaque
Is this problem present in the latest version of the plugin?

Re: Just one problem

PostPosted: July 13th, 2011, 11:04 am
by MarketerMatt
Cristián Lávaque wrote:Is this problem present in the latest version of the plugin?


I'm getting the same issue as the above where I'm getting this error where the Update Profile button should be.

Code: Select all
Warning: reset() [function.reset]: Passed variable is not an array or object in /***/wp-content/plugins/s2member/includes/classes/user-access.inc.php on line 51

Fatal error: Call to undefined method stdClass::has_cap() in /home/scepter/***/wp-content/plugins/s2member/includes/classes/user-access.inc.php on line 107


The only thing is, I'm using the new version of the plugin that already has the following by default:

Code: Select all
(user->allcaps ("access_s2member_level" . $n))


Help please.

Re: Just one problem

PostPosted: July 13th, 2011, 6:12 pm
by Cristián Lávaque
Hi Matt. Could you please re-install s2Member v110710 following these instructions? viewtopic.php?f=36&t=247

Re: Just one problem

PostPosted: July 14th, 2011, 1:11 pm
by MarketerMatt
Cristián Lávaque wrote:Hi Matt. Could you please re-install s2Member v110710 following these instructions? viewtopic.php?f=36&t=247


Thanks for the response Cristián, but I'm still getting the same errors... My guess is that there is some conflict with the user membership level.

Any other ideas?

Thanks for the help

Re: Just one problem

PostPosted: July 14th, 2011, 9:24 pm
by Cristián Lávaque
has_cap is a WordPress function, not s2Member's. Try updating your WordPress to the latest version. If that doesn't remove the error, try re-uploading /wp-includes/capabilities.php via FTP .

I hope that helps.

Re: Just one problem

PostPosted: July 25th, 2011, 2:37 pm
by MarketerMatt
Cristián Lávaque wrote:has_cap is a WordPress function, not s2Member's. Try updating your WordPress to the latest version. If that doesn't remove the error, try re-uploading /wp-includes/capabilities.php via FTP .

I hope that helps.


Hey Cristián, I appreciate your help but this still hasn't solved my problem. WP is at the latest version already and I'm still getting the error. The errors that I get from the admin page are concerning the same thing but are from the users-list-in.inc.php page rather than the user-access.inc.php page.

Code: Select all
Warning: Invalid argument supplied for foreach() in C:\wamp\www\mysite\wp-content\plugins\s2member\includes\classes\users-list-in.inc.php on line 145


Code: Select all
Fatal error: Call to undefined method stdClass::has_cap() in C:\wamp\www\mysite\wp-content\plugins\s2member\includes\classes\users-list-in.inc.php on line 163


Like I said, this is where the "Update Profile" button should be on my theme.

Re: Just one problem

PostPosted: July 27th, 2011, 4:42 pm
by Jason Caldwell
Thanks for the heads up on this thread Cristián.
~ and thanks for reporting this important issue.

This sounds like a plugin conflict, or possibly a corrupted wp_users table to me. The error you reported is referring to this section of the code for s2Member, which depends upon the core WP_User property allcaps, which apparently is not present on your installation, for at least one Member. Thus, the error is being generated. This would also explain the error you reported in /user-access.inc.php too.

Code: Select all
foreach ($user->allcaps as $cap => $cap_enabled)
    if (preg_match ("/^access_s2member_ccap_/", $cap))
        $ccaps[] = preg_replace ("/^access_s2member_ccap_/", "", $cap); 
* What other plugins are you running in concert with s2Member please?

Re: Just one problem

PostPosted: July 27th, 2011, 5:04 pm
by MarketerMatt
Thanks for the response,

I think the conflict is actually with my theme rather than with another plugin since I still get the error even when I deactivate all my plugins. I'm using the classipress theme from http://www.appthemes.com/

Let me know if you need any of the files or code to help me get this fixed. Thanks so much for your help!

Re: Just one problem

PostPosted: July 27th, 2011, 5:23 pm
by Cristián Lávaque
Got it. Do you get the error when you switch to the TwentyTen theme?

Re: Just one problem

PostPosted: July 27th, 2011, 5:36 pm
by Jason Caldwell
MarketerMatt wrote:Thanks for the response,

I think the conflict is actually with my theme rather than with another plugin since I still get the error even when I deactivate all my plugins. I'm using the classipress theme from http://www.appthemes.com/

Let me know if you need any of the files or code to help me get this fixed. Thanks so much for your help!
Thanks for the follow-up. Since this is a commercial theme, we don't have access to its source code. I would suggest contacting the developer and refer them to this thread. Maybe they can spot the issue on their end and get this fixed for you. Either that, or if they'd like to send us a copy of their theme for testing, we'll take a look to see if it's something s2Member can work around in some way. They can use this private contact form: http://www.s2member.com/contact/

Re: Just one problem

PostPosted: July 27th, 2011, 5:41 pm
by MarketerMatt
Okay, thanks for the help. I'll do that.

Re: Just one problem

PostPosted: August 7th, 2011, 2:11 pm
by Jason Caldwell
Thanks. I just took a quick look. There's nothing jumping right out at me. However, I do see lots of code in this theme that deals with Users, and it also looks like this theme implements a basic Membership platform, so perhaps this is where the conflict originated. Unfortunately, I don't have time right now to dig through the entire theme and pinpoint the exact conflict that you're having, but I would suggest switching to a different theme and also start with a fresh installation of WordPress, just in case a plugin and/or theme conflict you introduced in the past has caused a corruption in your database.

Re: Just one problem

PostPosted: August 8th, 2011, 7:16 am
by MarketerMatt
I'll start over fresh today since I still haven't heard back from the makers of the theme. I'm not sure that I have the option to use a different theme but I'll let you know how it goes when I get fresh installs of everything done.

Thanks for your help so far.

Re: Just one problem

PostPosted: August 12th, 2011, 10:33 am
by MarketerMatt
I've started over with a fresh installation of wordpress, the theme, and s2member and am still getting a conflict. I still have not received any support from the makers of the theme so if you do get a second to take a closer look, I would appreciate it.

Please let me know if there's anything else I can provide you with, and thanks for the help!