Code

Discussion on WooCommerce Role-O-Matic

Discussion on WooCommerce Role-O-Matic

Cart 510 sales

vanquish supports this item

Supported

207 comments found.

Hello, this is me from above through the account that made the purchase.

So, again, “I just need to find where the actual writing of the new roles to the capabilities user meta happens so I can replicate it to the other sites’ capabilities either by hook or hack. I guess that it’s at the update_user_role_by_product_role_rule function at WCRA_Customer.php – can support confirm or deny that?”

Thanks!

Hello,
Thank you for using the proper account and supporting my work thought the purchase.

Yes, you’re right. The user roles are added through the update_user_role_by_product_role_rule () method defined in the classes\com\WCRA_Customer.php file.

Roles are instead removed by invoking the remove_user_roles() and remove_all_roles() methods.

at last, the default role is eventually restored through the set_default_role_if_necessary() mehotd.

Hello, I just purchased WC Role-O-Matic for a customer using their account. It works perfect out of the box but they have a special requirement.

They have a multisite set up with a shop in the main site and a private area in the subsite. A purchase changes the user role correctly at the main site, but they also need it changed at their subsite.

I can sync roles via another plugin, but their site is cluttered already and I would prefer to modify Role-O-Matic if possible. Any advice on where I should start? BTW thanks for your extensively annotated code, a real pleasure to read.

Hell,
I’m really sorry, but the support service doesn’t include any customization service. Furthermore what you ask cannot be eventually suggested using just few lines here in the comment system.

Yeah I KNOW what support includes, I was not asking you to do my job, just for some guidance so I don’t need to go through every single file included.

I just need to find where the actual writing of the new roles to the capabilities user meta happens so I can replicate it to the other sites’ capabilities either by hook or hack. I guess that it’s at the update_user_role_by_product_role_rule function at WCRA_Customer.php – can support confirm or deny that?

I’m sorry, for that kind of information, you need posting the question using an account with a valid purchase and support licenses associated with it.

Hi, I bought the plugin as I have Agents that I need to move from one to level to the next depending on their total purchases.

I want the plugin to calculate for the entire month what the role spent and then move them to a different role only (not after every order).

Also the plugin has a minimum spent and if they spend more than that then it moves up – what if they spend less than that amount ? I need to set it for if they do not spend a certain amount then it moves them.

I want all my rules set up before hand to calculate orders for a month and then move the different roles to other roles accordingly. Can this be done ?

The plugin has a detailed description page where its features are reported. It also has a demo site where its features can be fully tested before purchasing in order to be sure it actually needs as the user needs and expects.

Once purchased, the Envato refund policy won’t grant a refund because the software is not working as it never claimed to or because the user had in mind something different from what was advertised. Otherwise, any user could use such argumentation, get the money back and continue using the software for free.

I understand and did check all of that, bit misleading though as your plugin states amounts calculator (which is what I need), but it does not work the way I thought. It is not however Envato that states the refund policy it is you yourself as I know for a fact that a refund may be granted from the Author.

Please change the way the plugin is presented showing the amounts calculations as that makes it become a bit misleading.

I think in future for anyone using a plugin from they should only look at those who state that they are prepared to give refunds if not happy.

We as normal users do not write these plugins and therefore cannot possibly know the nitty gritty behind them and therefore go on what we think is correct based on your images etc. I did look at the demo, but as I did not have my full month’s sales etc on there it was almost impossible to know that it would not work.

I will give a review shortly – thank you

The plugin works as advertised. Regarding the amount calculator: https://nimb.ws/TgMrRv It assigns one or more roles according to the amount spent, amounts spent that can fall in a selected time period that can be easily configurable via the amounts configurator menu: https://nimb.ws/TgMrRv The recomputation of the roles according to the existing pricing rules places every time the user places an order, when an order is modified via the admin area or when the admin performs a manual role recomputation via the special menu.

The product description page must be carefully read before any purchase. The plugin demo site has been setup precisely to avoid this kind of scenario.
The user, before any purchase, should be using it to create its scenarios and be sure the software actually fits his needs and expectations. The user, eventually, in case of further doubts, can ask presale questions.

Software is not like physical products. Once purchased, they cannot be returned. This is why the user is provided before any purchase, all the info, and tools in order to be sure of what he is purchasing.

That’s it, if the user bought without even caring to read the description or performing any test, the author or Envato cannot be blamed. You must take responsibility.

For authors and Envato, once the software is purchased, it is not possible to determine if the user is stating is true and cannot prevent continuing to use the software in any way. This is why the policy won’t grant this kind of scenario.

Hi First of all thank you for your work, your plugin is exactly what I was looking for, however I encounter some problems. I’m looking to offer memberships to my visitors, so I created three sheets produced in Woocommerce that correspond to different membership plans, each of them corresponds to a different role, so I configured three rules in the plugin in the product configurator. -The first deletes the current role and assigns the “adhérent” role for 12 months when a user purchases the “adhérent” product, and at the end of these 12 months the “adhérent” role is deleted and replaced by the “customer” role . -The second deletes the current role and assigns the “contributeur” role for 12 months when a user purchases the “contributeur” product, and after these 12 months the “contributeur” role is deleted and replaced by the “customer” role . -The third deletes the current role and assigns the “bienfaiteur” role for 12 months when a user purchases the “bienfaiteur” product, and at the end of these 12 months the “bienfaiteur” role is deleted and replaced by the “customer” role . The problem is that only the first rule works, the other two rules are ignored even if I temporarily disable the first and the last, the second does not work and the same for the third, only the first works while the settings are the same! ?

Have you ever been told this kind of problem, can you help me? If needed I can provide you with access to the backend to see for yourself. Here is a video to illustrate my problem (I just changed the period from 12 months to 5 minutes for testing): https://youtu.be/Px5VpubG35o

Thanks in advance

Great! this fixed the problem! Thank you for the speed and efficiency of your help.

yes! very glad to hear that! :)

At last but not least, I would ask you to help me: If you enjoyed my efforts to assist you and/or my plugin please consider leaving the 5 stars…It would help me with sales, I would reeeeeally appreciate it! :)
(to leave a rating: go to your profile page, click on “Downloads” and from there you can rate your purchases. You can also leave the rating through the plugin description page: https://www.dropbox.com/s/v6zaoe0p6cs4x2o/rating.png?dl=0 )

Hi!

Please remember the rating, it would help me a lot ad I would greatly appreciate it! :)

Hello,

I installed the plugin and created the role rules unfortunately when I try to recalculate it does not work.

Thanks,

Alex

Hello,
I’m sorry, but without any further clue, it is quite hard to determine the cause. It could depend on a misconfiguration, a 3rd party interference, and several other causes.

First of all, could you provide a more detailed description of the issue? In order to exclude any interference (3rd party or server issues) please use the following installation: https://codecanyondemo.work/wcra/wp-admin/ (user: admin, pass: admin) to recreate your scenario and report to me if you are still experiencing the issue. If so, please report me a step-by-step guide on how to. Thank you.

Hi Vanquish, I would like to give some comments on the plugin calculation part.

Currently, I found that the role calculation (I tested amount config only) is triggered when:
  1. an order is placed;
  2. the order status is changed to the one not excluded in general option.
But, it not always for the second point. If refund order status is excluded, the calculation is still not triggered when an order is changed to refund (order amount changed to zero). My suggestion is that if the calculation:
  • the trigger: set calculation processes to be triggered whenever there is an order status changed or the order is move to trash or un-removed, so it will calculate the updated user amounts.
  • calculate amounts: allow to set exclusion of the “amount” from specific order status. e.g. When order is refunded, the refunded amount will be deducted from role upgrade amount.
  • user calculation: limited the calculation only on specific users who’s order is placed, status is changed, so that the calculation will not calculation ALL users every time that leads to heavy server loading.

Understood that this is a big part, so I just want to provide some ideas/workflows because I found that the plugin sometimes doesnt perform calculation, especially when an order is placed by Bank transfer, received money that changed to processing and then refund for some reasons. The calculation triggers and calculation logic seem not clear.

Wish your plugin can be more perfect as there’s no such plugin like yours.

Hi,
thank you for your suggestions!

However, actually the calculation is already triggered whenever an order is changed. You can give a look to the WCRA_Order.php file located in the classes\com folder.

As you can see at line 9, the plugin hooks to the woocommerce_order_status_changed action (triggered by WooCommerce when an order changes status). The handler is defined at line 24. It forces the computation of the roles of the users associated to that order. The recomputation considers only the order that match the selected order statuses (set globally: https://nimb.ws/9uVWNj).

Make eventually sure to enable the “Role(s) removal if amount spent doesn’t match” option: https://nimb.ws/LKMZGn

I’ll perform some further tests for the scenario you reported to have more clues for the issue you are experiencing!

Please try updating to the latest 8.8 version, it should fix the issue you experiencing when trashing or refunding an order!

Thanks a lot vanquish for the update of trashing order or refund order!

Hello,

Is it possible to track role changes through a report or log?

Best regards,

Dada staff

Hello,
I’m sorry, the plugin hasn’t such a feature

Can you recommend a plugin that tracks role changes dynamically (last 3 months, last 6 months <- important! , last year)?

I’m really sorry I don’t know any plugin that performs that :(

Hi, I would like to give some advice after using for a couple of periods:

1) About Customer email notification: - Email works fine when member upgraded - While if member is downgraded, there’s no email for it. - It would be highly appreciated if there is an email notification for customer.

2) About Recalculate user roles - Situation 1 (order 1): I found that if an order is dropped into the trash, the customer will still keep the current role. - Also, if there’s an order 2 changes status, the situation 1 remains unchanged too.

Hi Vanquish,

1) I finally had tested the shortcode in email section. However, [removed_roles] and [added_roles] shortcodes will return message: No roles have been removed & No roles have been added in the notification email. Quite strange.

Kind reminder: I can see your changelog on codecanyon, but the documentation or item page doesnt include you updates, like shortcode. It may confuse the new customers. =)

Thank you for reporting! From my tests all seems working fine, I’ll perform further analysis!

No problem =)

What is the current version for WooCommerce Role-O-Matic ? I have Version 4.9 and I’m getting an error.

The latest is 8.4

Hi, I justo bought the plugin, but is not showing at the menu for configurations, can you help me? Thanks

Hi, please make sure you are using a full admin account to access the admin area. Make also sure that there is no 3rd party plugin interfering: try disabling all of them and reperform a test. If you are not experiencing the issue, re-enable one by one until you find the interfering one. Once done, report to its developer in order to fix the interference.

Hello, no, isn´t working… do you have a refund policy?

As you can test in the demo site, in a fully working environment the Plugin works without any issue. So it is quite strange that isn’t working despite the steps I’ve asked you to perform in order to identify the cause.

The Envato refund policy won’t grant a refund due to 3rd party plugin interferences. You should ask for a refund for the plugin that is causing the malfunction. Authors are not held responsible for 3rd party issues.

Hi, can you tell me if this is compatible with the free WCFM plugin? I’m looking to set up franchises, so automatic roles need to be total spent globally – not just at one franchise. Also, products and prices are set only by admin which vendors can sell. Thank you.

Hi,
I’m sorry but the plugin hasn’t any particular support for that plugin.

Is it compatible with any other multi-vendor plugin?

I’m sorry, It hasn’t actaully tested with any muti vendor plugin.

Will roles re-calculator also remove roles from users that already have a role that should be expired?

Yes, the roles will be removed according the “role-per-amount” spent period and according to the “expired” options.

The plugin has a demo site where you can fully tests its features. Give a try to be sure it actually fits your need before any purchase!

Hi,

I created a rule so that roles A and B are assigned when a user purchases a specific product, using “role per product” rules.

The roles are correctly assigned. However, I set the expiration role A to be assigned after the order expires (as I want users to stop having role B), and this is not working at all and creating support tickets constantly. All roles are removed and the expiration role A is not assigned.

These are the settings:

- Roles to assign when purchase: A and B - Expiring date type: relative - time value: 12 months - roles to assign after expiring date: A - remove all roles before assig expiring date role(s): yes

When the 12 months expire, both roles A and B are removed and the user remains with the default wordpress role, not with role A assigned. What should I change to make this work? I need to solve this as soon as possible.

Thanks.

Hi,
If you want to leave the role A, just try setting in the expiration as “Remove all roles before assign expring date role” the “Selected ones” option and then just select the B role.

Hi. Thanks for the reply. I will test this way and see if the issue appears again.

You’re welcome :)

Good Morning,

I just installed your plugin and everything seems to work perfectly. I only have one problem in terms of sending email notification, and that is that the same email is being sent twice. What could it be? Regards!

Hi,
unfortunately, without any further clue, it is quite hard to determine the cause :(

To which email notification are you specifically referring? Could you try disabling all the other 3rd party plugin, reperform a test, and report to me if you are still experiencing the issue?

Hello!

1. Tell me, in the account of the client the Since field: 08/27/2018 – 15:42 shows the current time, but not the start date from which the countdown occurs. (on my system, I use a dynamic period of 2 years, since my goal is to change the user’s role if the client has bought 200,000 in total in the last 2 years from today). Do I understand correctly that it is systematic to show the start date of this program, i.e. date 2 years ago from today’s date is not possible? Is it possible to add a field so that the customer can see how many days they have left before the role change and demotion in order to encourage them to buy faster?

2. Role list title – can you place an image next to it? (in my system, each role is a certain conditions for discounts and it would be nice to assign a visual element to each role in the form of a discount card, for example?) Can you advise something? or php to display an image for each role change?

3. I have a problem with the wc marketplace plugin. It duplicates “Total Spent:” (since the order is executed by me and duplicated by the vendor and for order 1000, Total Spent: is defined as 2000). Is there a way to solve this somehow?

Thank you, great plugin!

It is stange, it seems that the CodeCanyon did not published the update.

I’ve just forced the publishing process, you whould now be able to download the 8.3 version! Please give a try and let me know! :)

Hooray! All is decided 8.3 version! thank!

Glad to hear that! You’re welcome :)

At last but not least, I would ask you to support me: If you enjoyed my efforts to assist you and/or my plugin please consider leaving the 5 stars, I would really appreciate it! :)
(to leave a rating: go to your profile page, click on “Downloads” and from there you can rate to your purchases. You can also leave the rating through the plugin description page: https://www.dropbox.com/s/28dae6pnqvbccmm/rating_area.jpg?dl=0 )

Have a great day! :)

Hi, I have already purchased the plugin. However, I have two issues. 1. After a membership has reached the end date, the progress of the other type of membership are still showing the progress bar. How to remove them?

2. How can we start the membership by the user’s first purchase instead of specifying a fixed date range?

You can skip the role area display using the following code:
if(date("Y-m-d H:i") >= $end_date)
            continue;
can you can define at line 20. it should look like this: https://www.dropbox.com/s/63z69vtlytssnqj/wcra_custom_code.jpg?dl=0

I have tested it. It looks like that it only works for Year-Month-Date, can it include Hour and Minutes?

try the following
if(date("Y-m-d H:i") >= $end_date_obj->format(Y-m-d H:i))
            continue;

Hi,

after the member expired, it will automatically update the role by cron job ?

I’m sorry the plugin hasn’t such a feature.

Hi,thank you for your reply.

What i mean is if a member already expired, how can it return to basic role. By wp_schedule_event ?

Please note that plugin hasn’t any concept of member or membership.

You can eventually create “role per amount spent” or “role per product” rules. For both rule types, you can eventually assign an expiration date. After that period, you can remove the assigned roles and eventually assign new ones.

The expiration is computed every time the user accesses the site or when an order has been placed.

You can eventually configure an automatic recomputation. That process relies on a wp_schedule_event.

When users purchase a specific WC order, role A is assigned for 12 months then it expires and goes back to role B. If I delete all WC orders to keep my database clean, will that interfere with Role-O-Matic assignment of role A?

Example:

User places an order in WooCommerce in June 2020. Role-O-Matic is triggered and applies role A for 12 months, starting June 2020.

In September 2020, admin deletes all WooCommerce orders, including the original order in June 2020.

Does Role-O-Matic keep the 12 month assignement of the role and further expiration? What happens in that scenario?

Thanks.

Hi,
yes it may interfere. In general, if you edit or delete an order, it will trigger the role recomputation for the user associated to that order. So in your case, the amout spent could not match the one set in the “role per amout” rule anymore causing the user to loose the assigned role prematurely.

If you instead delete the order older that the expiration time you set, it won’t affect the role assignement process.

Hi,

The rule is set so that only the purchase of the product (and not the amount) triggers the assignment of the role. Would this still interfere and delete the role assignment?

Also, what do you mean “delete the order older than the expiration time you set”?

Example:

Order is created in August 2020 (it gives role A for 12 months) Order is deleted in September 2021 (user lost role A in August 2021)

In that case, it seems obvious that the assignment would not be affected, and I guess the “after expiration roles” would be kept, correct?

Thanks again.

In case of the “role per product”, deleting the order won’t interfere.

Hi, I have the following questions. 1. Does this plugin support Elementor with Ocean WP Theme?

2. Is it possible to create an icon or image next to the Role name in the My Account page? e.g. Display a “member card” image above the role name in the My Account page

Thank you.

Hi,
  1. The plugin hasn’t any particular support for that plugin features
  2. I’m sorry, the plugin hasn’t such an option

Thank you. If purchase this plugin, is there any money refund guarantee after some days if i find that it is not suitable for my use?

I’m really sorry, but the Envato licese agreement doesn’t include any trial period.

The plugin has a demo site where you can fully test its features before purchasing. Once purcahsed, no refund will be granted for such reasons.

Hi there, the plugin allows you to have an email sent to a user to notify them of a role change however, that email is fired when the role has been changed on purchase and when the time limit is reached and the role is changed again. Can you have the email fire only when the role is reverted back once the expiration for the user role is reached? If not can you make it so that you can send out another email when the role is expired that is different to the email that they get when they are first allocated the role?

Hi,
To request support, you need to renew your support license.

Once renewed, I can suggest which script modify in order to send the email only after the product expiration date and how to avoid to be sent when roles are assigned on purchase.

Hi there, I have renewed my support with you. Can you please assist with my issue?

Hi,
yes. Actually that is not an issue, but a customization. The plugin is not designed to have the feature you are seeking so to achieve that, it has to be customized.

To achieve what you ask do the following:
  1. Edit the WCRA_Customer.php file you find in the classes\com folder and comment line 392 and 293. That will avoid the email send when a role is assigned.
  2. On line 427, add the following:
    $email_texts_per_user_id = array();
    
    It will look like: https://www.dropbox.com/s/qwfv214mo4apr21/wcra_custom_1.jpg?dl=0
  3. On line 440, add the following:
    $email_texts_per_user_id[$user->ID][] = array('subject' => "", 'body' => "");
    
    It will look like: https://www.dropbox.com/s/25xwjse089dt5l4/wcra_custom_2.jpg?dl=0
  4. on line 488 add the following:
    if(!empty($email_texts_per_user_id))
                        $wcra_email_helper->send_role_change_notification_to_user($email_texts_per_user_id);
    
    It will look like: https://www.dropbox.com/s/do2m93rywql6okp/wcra_custom_3.jpg?dl=0
On point 2, you assign to the ‘subject’ and to the “body” the text that have to be used as email subject and its content. For example:
$email_texts_per_user_id[$user->ID][] = array('subject' => "Thi is the subject", 'body' => "This is the email content!");

In this way, the plugin will also send an email every time it will assign a role after the purchased product has expired

by
by
by
by
by
by

Tell us what you think!

We'd like to ask you a few questions to help improve CodeCanyon.

Sure, take me to the survey