[SOLVED] Allow Photo Gallery module to only show photos of specific users

4 years 5 months ago #315060 by boyjahq
With your assistance I was able to get this working as needed. Thank you!

For the record, this is what I did:

I have 2 different types of users in my system and I wanted the CB Gallery module to display a single random image of a photo from only 1 type of user.

IN Community Builder: Tab Management I created 2 new tabs, naming them according to the type of user to which each tab (in this case, gallery) is to be attributed.

In Community Builder: Field Management I created 2 new fields of type Gallery. In my case the ID for these new fields was 107 and 108. I named the fields according to the type of user to which each gallery is to be attributed and associated them with the appropriate tabs created in step 1 above.

In my case I wanted the CB Gallery module to only show photos associated with gallery field ID 107, so in Extensions -> Modules I created a new module of type CB Gallery. Under the Gallery tab I set Asset to profile.%.field.107

But no photos appeared!

Then I realized that it was necessary to modify the asset column of the table comprofiler_plugin_gallery_items. For those users that I wanted to be associated with gallery field ID 107 I needed to append ".field.107" to the asset data. For example, all photos for user 2257 were listed in the asset field as "profile.2257". But for those photos to be available to my CB Gallery module, the asset field needed to be "profile.2257.field.107"

It was a daunting task but I was finally able to add ".field.107" to all user photo data that I wanted to be associated with CB Gallery ID 107.

This last step is ONLY NECESSARY if you have an existing database of user photos in CB Gallery. All newly added photos once the new galleries have been set and assigned to users will automatically have this ".field.FIELD_ID" information added.
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.149 seconds

Facebook Twitter LinkedIn