Skip to Content Skip to Menu

User list in CB Content module

  • uwe2023
  • uwe2023
  • OFFLINE
  • Posts: 111
  • Thanks: 20
  • Karma: 2
1 week 4 days ago #339780 by uwe2023
User list in CB Content module was created by uwe2023
Hi,
what substitution ca I use to get the output of an userlist in the CB Content module?
I tried, e.g. [cb:userlist list="3" /], but that doesn´t work. I searched in the documetation, but didn´t find something.
Best regards Uwe

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48609
  • Thanks: 8300
  • Karma: 1446
1 week 4 days ago #339786 by krileon
Replied by krileon on topic User list in CB Content module
There are no substitutions for displaying userlists outside their page. You'd have to wrap it in an iframe. Since the contents of the iframe is your own site you're able to modify the iframe using JavaScript as well so it's sized properly. The below should work for example.

HTML:
Code:
<iframe class="w-100 m-0 p-0 overflow-hidden cbUserlistModule" src="index.php?option=com_comprofiler&view=userslist&listid=USERLIST_ID_HERE&tmpl=component"></iframe>
JavaScript:
Code:
document.addEventListener( 'DOMContentLoaded', () => { document.querySelector( '.cbUserlistModule' ).addEventListener( 'load', function() { const contents = ( this.contentDocument || this.contentWindow.document ); contents.body.style.padding = 0; contents.body.style.margin = 0; contents.body.style.minHeight = 'auto'; contents.body.style.overflow = 'hidden'; const base = document.createElement( 'base' ); base.target = '_parent'; contents.head.append( base ); this.height = contents.body.scrollHeight; const observer = new MutationObserver( () => { this.height = contents.body.scrollHeight; }); observer.observe( contents.body, { attributes: true, subtree: true, childList: true, }); }); });

Be sure to replace USERLIST_ID_HERE with the ID of your userlist that you want to display. This should auto size the height to fit the userlist contents. It also implements mutation observer to observe for changes. So if the iframe should change its size it will auto resize the height again. It also appends a base to the iframe contents header to force all links to the parent window.

Note you'll be fighting Joomla's WYSIWYG editor here. It applies some auto formatting to iframes that'll prevent this from working properly. So you'll need to adjust the WYSIWYG editor permissions in System > Manage > Plugins to set "Sandbox Iframes" to "Off".

As this is just an example should you need further adjustments you'll need to look into making those yourself. Hope this helps get things started at least.

We'll be releasing a module specifically for rendering userlists in a future release to make this easier though.


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 or Create an account to join the conversation.

  • uwe2023
  • uwe2023
  • OFFLINE
  • Posts: 111
  • Thanks: 20
  • Karma: 2
1 week 4 days ago #339789 by uwe2023
Replied by uwe2023 on topic User list in CB Content module
Hi Kyle,

that works great, thank you! Btw, I'm working with JCE....no problems!

Best regards Uwe
The following user(s) said Thank You: krileon

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum