Skip to Content Skip to Menu

Horizontal list of Avatars in a Module

  • aybarra
  • aybarra
  • OFFLINE
  • Posts: 17
  • Thanks: 3
  • Karma: 0
2 years 11 months ago - 2 years 11 months ago #327305 by aybarra
How can I create a module that contains custom html for a filtered list of user avatars?
My goal is to show a scrolling horizontal list of avatars of the users who are following an activity inside the Joomla Article which loads a CB Activity module.

I know how to do the query with something like:
Code:
SELECT #__comprofiler.user_id FROM #__comprofiler_plugin_activity_following INNER JOIN #__comprofiler on #__comprofiler.user_id = #__comprofiler_plugin_activity_following.user_id WHERE #__comprofiler_plugin_activity_following.asset = 'ASSET’;

I’m thinking I can use replacements to show the actual avatars ([cb:userfield field="avatar" user="USER_ID" /]), but I’m not sure how to get all of this into a module.

Any suggestions?
Last edit: 2 years 11 months ago by krileon. Reason: Added [SOLVED] tag to subject

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
2 years 11 months ago #327311 by krileon
Replied by krileon on topic Horizontal list of Avatars in a Module
We don't have anything out of the box that can provide that. You'd need to develop a custom module for that.


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: aybarra

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

  • aybarra
  • aybarra
  • OFFLINE
  • Posts: 17
  • Thanks: 3
  • Karma: 0
2 years 11 months ago - 2 years 11 months ago #327333 by aybarra
Replied by aybarra on topic Horizontal list of Avatars in a Module
I was able to get what I was after.


For anyone who might be interested, the steps are below:
1.Create field of type “Query” which will hold the query and the HTML structure of the data.
2.Use CB Replacement to place the field into the article which also loads the module for the activity.

1. Query Field
Parameters -> Query
The query is simple and no joins are needed as I originally thought:
Code:
SELECT user_id FROM #__comprofiler_plugin_activity_following WHERE asset = "ASSET"

Parameters -> Display
Output
Multiple Rows
Header
<table class="table table-sm table-responsive table-borderless following-list ">
<tbody>
<tr>
Row
<td>
[cb:userfield field="avatar" user="[column_user_id]" reason="list" /]
</td>
Footer
</tr>
</tbody>
</table>

The table is using the Bootstrap class .table-responsive for its horizontal scrolling feature. The Bootstrap classes of .table-sm and .table-borderless are styling choices. The class .following-list is custom CSS
Code:
table.following-list .cbImgAvatar{ max-width:45px;}

2. Article
The field is included in the Article as
Code:
<div class="cb_template">[cb:userfield field="FIELD_NAME" /]</div>

The class .cb_template on the DIV applies, among other things, display:block; to the table.
Last edit: 2 years 11 months ago by aybarra.
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