latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Member Details on External page

Home Forums Community Forum Member Details on External page

This topic contains 5 replies, has 3 voices. Last updated by  Raam Dev 4 years, 10 months ago.

Topic Author Topic
Posted: Saturday Feb 18th, 2012 at 10:46 pm #5634

Hello,

Previously, on an external page, I was using the following code to utilize S2Member Information on an external page. This code is no longer working properly and I think it has something to do with a WordPress change in the way they handle get_currentuserinfo(); However, I’m unsure what to do about it. The data is no longer being passed to this external page, so members are not able to access the information they previously had access to.

[?php
require_once '/home/evaluate/public_html/members-blog/wp-config.php';
	global $current_user;
	get_currentuserinfo();
	$level = $current_user->user_level;
   echo '';
   echo $level;

?]

[?php $wp_user_access_level = S2MEMBER_CURRENT_USER_ACCESS_LEVEL;?]

[?php $wp_user_login = S2MEMBER_CURRENT_USER_LOGIN; ?]

[?php $wp_user_id = S2MEMBER_CURRENT_USER_ID; ?]

How do I fix this?

List Of Topic Replies

Viewing 5 replies - 1 through 5 (of 5 total)
Author Replies
Author Replies
Posted: Monday Feb 20th, 2012 at 4:55 pm #5727

I really could use some assistance with this. I spent an entire day trying to research a solution and could not find one that solved the issue.

Posted: Monday Feb 20th, 2012 at 10:08 pm #5785
Staff Member

This should do the trick for you.

<?php
	include_once "/path/to/wp-load.php";
	$user_level = S2MEMBER_CURRENT_USER_ACCESS_LEVEL;
	$user_login = S2MEMBER_CURRENT_USER_LOGIN;
	$user_id = S2MEMBER_CURRENT_USER_ID;
?>
Posted: Tuesday Feb 21st, 2012 at 7:27 am #5847

Ok,

Maybe a clarification. The S2Member “tags” must be doing something (and must have been before), because it’s giving me a current_user_access_level of -1, even though the individual loading this external php page is already logged in to WordPress. They are actually registered as a level 5 member (and INTERNAL WordPress pages recognize this).

As I indicated (at least I think I did), this page/code was working previously, and the file had not changed. Somehow, it would appear that the login cookie that is being set is not being recognized by the external page.

Upon further inspection, even though I have “root cookie” plugin installed and activated, my cookie is being set for the blog subdirectory, and not for the whole domain. How do I change that?

Posted: Tuesday Feb 21st, 2012 at 10:16 am #5868

ok, so, thanks for the assistance. In the end, it turned out that my wp-config file had somehow been edited and the definition setting the cookie path to root instead of my blog directory had been removed. Thus, the page that sat outside of my wp directory could not see/access the cookie.

All is now well. Again, thanks for your assistance.

Posted: Wednesday Feb 22nd, 2012 at 2:41 pm #5992
Raam Dev
Username: Raam
Staff Member

Thank you for the update.

Glad to hear everything is working now. :)

Viewing 5 replies - 1 through 5 (of 5 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.