I just found this option: s2member_access_cap_times
so now I can do this:
$accessCaps = get_user_option('s2member_access_cap_times', $user_id);
and get the last cap like this:
$lastCap= end($accessCaps);
This will output the last cap up until level9, however beyond level 9 it the end() ffunction no longer works because…
when I output the entire array for a user that was at level 11 and was demoted to level 0 here’s what it looks like
foreach($accessCaps as $key => $value) { echo "$key is at $value<br>"; }
1473520578.0001 is at -level1
1473520578.0002 is at -level10
1473520578.0003 is at -level11
1473520578.0004 is at -level2
1473520578.0005 is at -level3
1473520578.0006 is at -level4
1473520578.0007 is at -level5
1473520578.0008 is at -level6
1473520578.0009 is at -level7
1473520578.0010 is at -level8
1473520578.0011 is at -level9
echo end($accessCaps);
this will echo ’ -level9 ’ because it put level 10 and 11 next to level one sequentially.
So, it doesn’t look like there is any way to actually get the last member level with this function.
Is there another way to get the last role that a user had before they were demoted or changed?