uddeIM and message per user limit with CB Subs

3 years 6 months ago #290590 by Digigreg
Hello to all.

I have a website where the users can subscribe free, then if they want, they can buy the annual premoim subscription.
I use CB and CB Subs for subscriptions, then uddeIM for PM.

I'm trying to achieve the result where a free user can send (for example) just 10 messages per day, instead a premium user can send unlimited messages to other users.

Anybody, please, have ideas to how to "melt" the functions of CB Subs to limit uddeIM messages?

A best thanks to all,
greetings from Italy.

Please Log in to join the conversation.

2 years 6 months ago #300876 by theflyer
Replied by theflyer on topic uddeIM and message per user limit with CB Subs
Hello have a similar problem. Have you already found a solution?

Please Log in to join the conversation.

2 years 6 months ago #300878 by Digigreg
Replied by Digigreg on topic uddeIM and message per user limit with CB Subs
Hello.

As I haven't found nothing ready online, I have written that function directly by code, but I had to override one file of uddeIM; I haven't found a cleaner way.

In the code I read one column of CB database. This parameter is changed automatically by CB when an user buy the premium subscription on the website. Then, by reading this parameter, I have set the limit of messages for free users.

Would be really nice to see this feature integrated in the next release of uddeIM.

Kind regards

Please Log in to join the conversation.

2 months 4 weeks ago #318291 by RobJob
Ciao Greg,

I am currently looking to implement the exact same solution, I was wondering how your work-around worked out? Did it work successfully? Which file did you write the function in? any advice you can offer would be greatly appreciated.

Many thanks.

Rob.

Please Log in to join the conversation.

2 months 4 weeks ago #318299 by Digigreg
Replied by Digigreg on topic uddeIM and message per user limit with CB Subs
Ciao Rob,
I've did that in 2016, I don't remember nowadays the exact code.
Besides the patched file was "includes.php", close to the end, where the send button is generated.
I have created a custom field in CB with the max number of messages allowed; this field is changed from CB Subscriptions plans, after payment. Then, in that file, I've retrieved the value of that field for the current user and I've managed to print or not the send button in uddeIM.

That's everything what I have in mind at the moment. It would be nice to create a plugin or a "file patcher" for that purpose, but the requests are not so many and the creation is not so easy without the modification of that file (I don't like to modify core files, but I like to create overrides).

Hope that could help you, somehow.
Kind regards,
Gregorio

Please Log in to join the conversation.

2 months 4 weeks ago #318300 by RobJob
Hi Greg,

Many thanks for the quick response, I was thinking of having a reference table mapped to Joomla user Groups, as the subscriptions change the user groups, I can then use the JFactory getuser function and map the user to the group to get the message allowance then do a count(*) of messages sent for that user ID for that day and include an if count >= allowance to hide the send mail button and echo a "message limit reached" string.

In theory this should work but I'm not a developer so am now learning some PHP.. thanks for your advice, wish me luck. :-).

Rob.

Please Log in to join the conversation.

Moderators: beatnantslabbikrileon
Time to create page: 0.401 seconds

Facebook Twitter LinkedIn