CSS page class by membership

3 years 9 months ago - 3 years 9 months ago #318933 by hayesjames
CSS page class by membership was created by hayesjames
Morning again !

Is it possible to add an automatic page class by subscription. So if a premium logged in member is visiting any page the class is there and small bits of content can be styled accordingly, or even some hidden and others shown?

Many thanks

J
Further thoughts. If I can use:
<?php
$cbUser = CBuser::getMyInstance();
$name = $cbUser->getField( 'name', null, 'raw', 'none', 'list' );
?>

Then where I want to personalise the page I add <?php echo $name;?> I assume I could do a similar thing to get the subscription plan alias and place in the <body> as a class. But how would get get that to pull through?
Cheers

Please Log in to join the conversation.

3 years 9 months ago #318950 by krileon
Replied by krileon on topic CSS page class by membership

Is it possible to add an automatic page class by subscription. So if a premium logged in member is visiting any page the class is there and small bits of content can be styled accordingly, or even some hidden and others shown?

Probably the easiest solution is to use CB Content Module to insert CSS then protect the module using your plans so it's only accessible to those with a subscription and thus loads your custom CSS only if they're subscribed.

Then where I want to personalise the page I add <?php echo $name;?> I assume I could do a similar thing to get the subscription plan alias and place in the <body> as a class. But how would get get that to pull through?

I don't really recommend doing that. You'd need to put that into your Joomla template index.php file and would mean you'd be loading CB on every page and calling that code on every page. The above module approach is probably a safer and more future-proof solution.


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.
The following user(s) said Thank You: hayesjames

Please Log in to join the conversation.

3 years 9 months ago #318956 by hayesjames
Replied by hayesjames on topic CSS page class by membership

Probably the easiest solution is to use CB Content Module to insert CSS then protect the module using your plans so it's only accessible to those with a subscription and thus loads your custom CSS only if they're subscribed.


Excellent solution. And you're right I didn't want to load CB on every page, knew there must be something better.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.145 seconds

Facebook Twitter LinkedIn