admin管理员组文章数量:1122846
I have a question in regards to a WordPress plugin (Bookly) that creates a Staff ID for an already created WordPress user, and hopefully, somebody may be able to help me with.
Currently Bookly adds the Staff ID incremental so each new staff ID would say Staff ID:4 then the next 5 then 6 etc, I'm looking for some code that would take the current WordPress user's ID and add that ID as the Staff ID for that user when they are creating a Staff ID for them.
Any help much appreciated.
Thanks Ryan
I have a question in regards to a WordPress plugin (Bookly) that creates a Staff ID for an already created WordPress user, and hopefully, somebody may be able to help me with.
Currently Bookly adds the Staff ID incremental so each new staff ID would say Staff ID:4 then the next 5 then 6 etc, I'm looking for some code that would take the current WordPress user's ID and add that ID as the Staff ID for that user when they are creating a Staff ID for them.
Any help much appreciated.
Thanks Ryan
Share Improve this question edited Oct 9, 2017 at 16:29 rudtek 6,3535 gold badges30 silver badges52 bronze badges asked Oct 9, 2017 at 14:19 Ryan Mc GonagleRyan Mc Gonagle 315 bronze badges 1- did you ever find a solution to this? I have the exact same problem. – M0rty Commented Jun 20, 2019 at 23:55
2 Answers
Reset to default 0Because the database table is set up to auto increment then you can't change the ID to match user ID without redesigning the database tables. This would be fine except you wouldn't be able to update the plugin without remaking the changes each time.
function get_user_by_staff_id($user_ID) {
$results = $wpdb->get_results("SELECT id FROM wp_ab_staff WHERE wp_user_id = '$user_ID' LIMIT 1 ");
$staff_id = $results;
return $staff_id;
}
Add this to your functions.php (not Booklys!!)
Then to use it you can do this:
<?php echo do_shortcode('[bookly-form category_id="1" service_id="4" staff_member_id="'. get_user_by_staff_id(**USER ID HERE**) .'" hide="categories,services,staff_members,week_days"]'); ?>
本文标签: url rewritingWordPress plugin Write Userstaff ID as the same as the WordPress User ID
版权声明:本文标题:url rewriting - WordPress plugin Write Userstaff ID as the same as the WordPress User ID 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736297010a1929921.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论