I'm using this plugin to allow additional users (subaccounts) to manage subscriptions on my site. In MyAccount I have conditional menus based on the user role, and I'm hoping I can set a specific role based on the subaccount status.
Is this a possibility?
Thanks in advance for your time.
Jared
Follow-up: I just realized that the subscriptions generated by the parent account return an "Invalid Subscription" error when click on in the sub account.
(1) Follow-up: I just realized that the subscriptions generated by the parent account return an "Invalid Subscription" error when click on in the sub account.
I looked into this now on our local test site but I am not able to reproduce the issue. In my tests the subaccount can see subscriptions as well as open them / see details.
I'm thinking there may be some other factor on your site, perhaps an additional plugin that has subscription effects, or something similar.
Is it possible to share a backend login to your site or staging site with us, so we can look into this directly? That would be the best way we can troubleshoot and get this resolved for you as soon as possible.
If so, it would also help if you can also share a screenshot or a quick video with the steps we can take to see the issue, so we can test.
add_action('b2bking_after_subaccount_created', function($user_id){
$user = new WP_User($user_id);
// if role does not exist, add it
if (!wp_roles()->is_role( 'b2bking_role_subaccount' )){
add_role('b2bking_role_subaccount', esc_html__('B2BKing Subaccount','b2bking'), array( 'read' => true));
}
$user->add_role('b2bking_role_subaccount');
}, 10, 1);
It will give subaccounts the "B2BKing Subaccount" role when the subaccount is created (it does not do it for existing subaccounts - for those, you'd need to set it manually).
It gives users multiple roles:
If you want them to have only 1 role, you can change add_role to set_role in the above code.
Regarding (1), that was something on my end, which I've resolved. Thanks for addressing that, and sorry for the trouble.
(2) That PHP snippet was immensely helpful! Thanks!
So now I have subaccounts able to see subscriptions purchased by the parent account, but they are not actually able to utilize the digital products purchased. More specifically, parent accounts purchase a job posting subscription package, and subaccounts can see those subscriptions, but when they attempt to post jobs under the subscription they are treated as if no subscription package has been posted.
Another way of putting this is that the parent account buys a digital subscription, and now the subaccount can see that digital subscription, but cannot do anything with it.
I'm going to keep working on this, and I'll let you know right away if it comes together. Please let me know if you need additional information.
Glad to hear that some of the issues were resolved,
More specifically, parent accounts purchase a job posting subscription package, and subaccounts can see those subscriptions, but when they attempt to post jobs under the subscription they are treated as if no subscription package has been posted.
This is going to be very specific to the plugin / code that handles this job posting feature. Is this a part of a plugin, or part of the theme, custom code etc?
There is a probably a permissions there which we need to filter and make it allow subaccounts as well. Let me know what you're using for that feature please. I can also take a look directly if you can share site access.
I still cannot get subaccounts to have full access to the digital products purchased by the parent account. The sub account can see the subscription purchases, but cannot access anything provided by those subscriptions, specifically:
The ability to post jobs.
The ability to view previously posted jobs.
The ability to access jobs bookmarked by the parent account.
I've attached screenshots showing the above.
My site uses WP Job Manager to sell job posting packages to businesses. The URL is https://edgeofbliss.com/
It seems that a special integration would be needed between B2BKing and the Job Manager plugin in order to get their plugin to give the necessary permissions to subaccounts.
I'd be happy to try and do this integration. I took a look at the code of the free job manager plugin version on wordpress.org and I believe it's feasible based on what I'm seeing (there are permission hooks we can use).
Now I'm struggling with 2 things: It's taking me some time to learn this plugin and get to the same setup you have, and I also don't think I have access to all the features, e.g. I think you have Bookmarks, and WC Paid Listings which are paid add-ons only.
It would be really helpful to me in doing this integration if you were able to share access to a staging clone site with us, so that I could just jump to the development part without having to set everything up. Many hosting companies have a staging feature that can create staging clone sites which are not connected to your real site, perhaps you can check if yours has this.
One more thing that I hope is simple: any chance you have a snippet that would make the Subaccounts section in My Account visible only to those users with the Employer role?
Thank you for sharing the details for staging site access, I am looking into this and trying to get this integration done for you as soon as possible. I will get back to you here with another message once I have this ready.
Hi,
I'm using this plugin to allow additional users (subaccounts) to manage subscriptions on my site. In MyAccount I have conditional menus based on the user role, and I'm hoping I can set a specific role based on the subaccount status.
Is this a possibility?
Thanks in advance for your time.
Jared
Follow-up: I just realized that the subscriptions generated by the parent account return an "Invalid Subscription" error when click on in the sub account.
Please advise. Thank you.
Hi Jared,
Thank you for purchasing our plugin!
(1) Follow-up: I just realized that the subscriptions generated by the parent account return an "Invalid Subscription" error when click on in the sub account.
I looked into this now on our local test site but I am not able to reproduce the issue. In my tests the subaccount can see subscriptions as well as open them / see details.
I'm thinking there may be some other factor on your site, perhaps an additional plugin that has subscription effects, or something similar.
Is it possible to share a backend login to your site or staging site with us, so we can look into this directly? That would be the best way we can troubleshoot and get this resolved for you as soon as possible.
If so, it would also help if you can also share a screenshot or a quick video with the steps we can take to see the issue, so we can test.
(2) Regarding conditional menus:
I wrote this PHP code snippet that you can to your site:
It will give subaccounts the "B2BKing Subaccount" role when the subaccount is created (it does not do it for existing subaccounts - for those, you'd need to set it manually).
It gives users multiple roles:
If you want them to have only 1 role, you can change add_role to set_role in the above code.
Looking forward to your response.
Kind regards,
Stefan
Hi Stefan,
I appreciate your reply.
Regarding (1), that was something on my end, which I've resolved. Thanks for addressing that, and sorry for the trouble.
(2) That PHP snippet was immensely helpful! Thanks!
So now I have subaccounts able to see subscriptions purchased by the parent account, but they are not actually able to utilize the digital products purchased. More specifically, parent accounts purchase a job posting subscription package, and subaccounts can see those subscriptions, but when they attempt to post jobs under the subscription they are treated as if no subscription package has been posted.
Another way of putting this is that the parent account buys a digital subscription, and now the subaccount can see that digital subscription, but cannot do anything with it.
I'm going to keep working on this, and I'll let you know right away if it comes together. Please let me know if you need additional information.
Thanks again!
Jared
Hi Jared,
Glad to hear that some of the issues were resolved,
More specifically, parent accounts purchase a job posting subscription package, and subaccounts can see those subscriptions, but when they attempt to post jobs under the subscription they are treated as if no subscription package has been posted.
This is going to be very specific to the plugin / code that handles this job posting feature. Is this a part of a plugin, or part of the theme, custom code etc?
There is a probably a permissions there which we need to filter and make it allow subaccounts as well. Let me know what you're using for that feature please. I can also take a look directly if you can share site access.
Hi Stefan,
I still cannot get subaccounts to have full access to the digital products purchased by the parent account. The sub account can see the subscription purchases, but cannot access anything provided by those subscriptions, specifically:
I've attached screenshots showing the above.
My site uses WP Job Manager to sell job posting packages to businesses. The URL is https://edgeofbliss.com/
Thanks for your assistance!
Jared
Attached files: 6. Bookmark Not in Subaccount.png
5. Bookmark Placed by Parent Account.png
4. Posted Jobs Not In Subaccount.png
3. Jobs Posted by Parent Account.png
Additional attachments:
Attached files: 2. Jobs Packages Not in Subaccount.png
1. Job Packages in Parent Account.png
Hi Jared,
Thank you for the details,
It seems that a special integration would be needed between B2BKing and the Job Manager plugin in order to get their plugin to give the necessary permissions to subaccounts.
I'd be happy to try and do this integration. I took a look at the code of the free job manager plugin version on wordpress.org and I believe it's feasible based on what I'm seeing (there are permission hooks we can use).
Now I'm struggling with 2 things: It's taking me some time to learn this plugin and get to the same setup you have, and I also don't think I have access to all the features, e.g. I think you have Bookmarks, and WC Paid Listings which are paid add-ons only.
It would be really helpful to me in doing this integration if you were able to share access to a staging clone site with us, so that I could just jump to the development part without having to set everything up. Many hosting companies have a staging feature that can create staging clone sites which are not connected to your real site, perhaps you can check if yours has this.
Kind regards,
Stefan
Stefan, I really appreciate your help with this.
I'm sending the login info for the staging site via a private message.
Thanks again,
Jared
Hey Stefan,
One more thing that I hope is simple: any chance you have a snippet that would make the Subaccounts section in My Account visible only to those users with the Employer role?
Thanks for anything you can do,
Jared
Hi Jared,
I have added a snippet to your site here https://staging2.edgeofbliss.com/wp-admin/admin.php?page=edit-snippet&id=20 that hides subaccounts for users without the employer role
Thank you for sharing the details for staging site access, I am looking into this and trying to get this integration done for you as soon as possible. I will get back to you here with another message once I have this ready.
Thank you!
In the Boolmarks plugin I added:
(1) Lines 502 and 515:
In the Paid Listings plugin I added:
(1) Line 29 here:
(2) Line 109 here:
(if the job manager plugin team can help, they can add a hook here instead).
Thank you!!!