CBSubs plan CSS classes

1 month 2 weeks ago #327329 by activha
CBSubs plan CSS classes was created by activha
Hello

I would like to condition the unsubscribe button to make it available only to mods/admins and tried to set this in CSS class for the template
[cb:if user="#me" usergroup !includes "6"]no_cancel[/cb:if]

But the input field does not let me save all the string

Are substitutions supported in this area ?
If yes can you augment the string length ?

And if no how can I show this button only to mod for unsubscribing ?

Thanks

Please Log in to join the conversation.

1 month 2 weeks ago #327337 by krileon
Replied by krileon on topic CBSubs plan CSS classes

Are substitutions supported in this area ?

What area? Please provide the exact parameter you're trying to set.

And if no how can I show this button only to mod for unsubscribing ?

You can't. There's no functionality for conditioning the unsubscribe button. Even if you do hide its display you wouldn't be blocking its actual functionality server side so anyone could just access it anyway via URL.

There's no way to do this cleanly from CB Auto Actions either. You could use the onCPayBeforeDrawSomething trigger and try removing the HTML using a regexp replace in PHP, but that's probably the only option. The triggers variables are as follows.

$_PLUGINS->trigger( 'onCPayBeforeDrawSomething', array( &$subscriptions[$id], &$childrenRendering, &$controlButtons, $showRenewButtons, $showUnsubscribeButtons, $now, $user ) );

The buttons HTML will be in $controlButtons, which is passed my reference so it can be modified. I cannot help you with this. I've already gone far beyond the scope of support in your other topic with custom coding and don't have the time available to keep doing that. Below will get you started.

Global
Triggers: onCPayBeforeDrawSomething
Type: Code
User: Self
Access: All Non-Moderators
Action
Method: PHP
Code:
MODIFY $variables['var3'] HERE
Parameters
References: Variable 3


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

1 month 2 weeks ago #327349 by activha
Replied by activha on topic CBSubs plan CSS classes

unsubscribe button to make it available only to mods/admins and tried to set this in CSS class for the template


As I wrote in the title, that's in CBsubs plan and it's the setting controlling the CSS class in the first tab.

When plans are more or less controlled by mods because people do not manage them well, it's important for mods to be in control of who can do what.
So for now we apply a no_cancel css class but that would be nice to apply this class to all users except mods

That's not in a hurry but could be a nice feature to add later

Please Log in to join the conversation.

1 month 2 weeks ago #327350 by krileon
Replied by krileon on topic CBSubs plan CSS classes
That parameter does not support substitutions. You might be able to use onCPayBeforeDrawPlan to modify the plan object to do that I guess, but I really don't suggest a CSS only approach. onCPayBeforeDrawPlan trigger variables as follows.

$_PLUGINS->trigger( 'onCPayBeforeDrawPlan', array( &$plans[$id], &$childrenRendering, $reason, $plans[$id]->_drawOnlyAsContainer, $userId ) )

var1 is the plan object sent by reference so you'd be able to modify it from a code action similar to my above example (exempt is var1 instead of var5).


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.167 seconds

Facebook Twitter LinkedIn