Find Jobs
Hire Freelancers

Write some Software

$10-30 USD

已完成
已发布超过 7 年前

$10-30 USD

货到付款
I am working on a site that uses s2member pro. When a users membership expires the user is demoted to user level0. I need to know what level they were at prior to being demoted. s2member has a built in function which keeps track of all the user capabilities/roles which is stored in user_meta as an array: $accessCaps = get_user_option('s2member_access_cap_times', $user_id); The array is composed of a timestamp key and a value which contains the last level a user had prior to being demoted to level 0. The problem is that the value in each key is stored as a natural number so level1 and level10 are sequential. (see output below) Below is an example of the user meta from a user who was demoted to level 0: foreach($accessCaps as $key => $value) { echo "$key is at $value<br>"; } output: (note:The user is created and assigned to level2) 1473730737.0001 is at level0 1473730737.0002 is at level1 1473730737.0003 is at level2 <--note: the user was added at this level and has access/capabilities of all lower levels (note:The user is promoted to level5) 1473730847.0001 is at level3 1473730847.0002 is at level4 1473730847.0003 is at level5 <-- note: the user was promoted to this level and gets all lower levels as well (note:The user is promoted to level11) 1473730986.0001 is at level10 1473730986.0002 is at level11 <-- note: The user was promoted to this level (you can see the sequential problem now because 10,11 are before 6,7,8,9) 1473730986.0003 is at level6 1473730986.0004 is at level7 1473730986.0005 is at level8 1473730986.0006 is at level9 (note:The user is demoted to level1) 1473731072.0001 is at -level1 1473731072.0002 is at -level10 1473731072.0003 is at -level11 <-- note: This is the last highest level, I need to get this value 1473731072.0004 is at -level2 1473731072.0005 is at -level3 1473731072.0006 is at -level4 1473731072.0007 is at -level5 1473731072.0008 is at -level6 1473731072.0009 is at -level7 1473731072.0010 is at -level8 1473731072.0011 is at -level9 What I need to do is this, get the last highest level that the user achieved, here's how I think it could be done: Sort each key/value pair by time (as float point values), find the sub-array with the same integer part like the bigger timestamp in this case: 1473731072. Then sort this new array by values (levels) as natural numbers, to get the biggest level. (L11 in this case). Please ask questions if you need clarification. Thanks.
项目 ID: 11512580

关于此项目

3提案
远程项目
活跃8 年前

想赚点钱吗?

在Freelancer上竞价的好处

设定您的预算和时间范围
为您的工作获得报酬
简要概述您的提案
免费注册和竞标工作
颁发给:
用户头像
Hi. I have read your project description and this seems to be an easy task which can be done in hours. Ready to start. Thanks
$30 USD 在1天之内
0.0 (1条评论)
0.0
0.0
3威客以平均价$52 USD来参与此工作竞价
用户头像
Hello Client, I read your post regarding create logic for regex, I have great experience working with PHP technology it's CMS & Frameworks like YII, Laravel, Codeigniter, CakePHP, OpenCart, WordPress, Prestashop, Sugar CRM & API Integration also having knowledge of Jquery, Node.js, Angular JS. I have experience to deal with big projects like ERP, CRM, HRMS, Payroll Management. Also i have team of qualified web developers and designers, Me & my team is ready to assist you in given assignment. Looking for a positive response from you. Thanks
$30 USD 在1天之内
0.0 (0条评论)
0.0
0.0
用户头像
A proposal has not yet been provided
$25 USD 在1天之内
0.0 (0条评论)
0.0
0.0
用户头像
Before awarding this to someone else contact me i have more than 8 year experience. Thanks
$30 USD 在3天之内
0.0 (0条评论)
0.0
0.0

关于客户

UNITED STATES的国旗
Hotchkiss, United States
5.0
8
付款方式已验证
会员自1月 14, 2015起

客户认证

谢谢!我们已通过电子邮件向您发送了索取免费积分的链接。
发送电子邮件时出现问题。请再试一次。
已注册用户 发布工作总数
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
加载预览
授予地理位置权限。
您的登录会话已过期而且您已经登出,请再次登录。