Skip to Content Skip to Menu

Photo Gallery Last Updated Datetime

  • highonryan
  • highonryan
  • OFFLINE
  • Posts: 60
  • Thanks: 14
  • Karma: 2
7 years 4 months ago #294897 by highonryan
Photo Gallery Last Updated Datetime was created by highonryan
I have a list that shows users who have a photo gallery.

They need to opt in using a single select box, and when they do, they see the gallery tab and can upload photos.

I created the select box so I could 1) create the list of users who opt into the gallery and 2) have a link to their gallery in the forum side profile.

In the list I include a link to the gallery (Custom HTML Field), the user's name and I want to include the last time they uploaded a album.

I'm drawing a blank on how to accomplish this.

Basically I need to pull the last date from the last image or album they uploaded.

Solutions?

Thanks in advance,
Melvins138

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48438
  • Thanks: 8275
  • Karma: 1443
7 years 4 months ago #294908 by krileon
Replied by krileon on topic Photo Gallery Last Updated Datetime
You'd need to query for that using CB Query Field. Media is stored in the _comprofiler_plugin_gallery_item table. Albums are stored in _comprofiler_plugin_gallery_folders. Both tables provide datetime of when the media was created so you can use that to query for the most recent media entry and return the date as a result. Example as follows.

Code:
SELECT `date` FROM `#__comprofiler_plugin_gallery_items` WHERE `user_id` = '[user_id]' ORDER BY `date` DESC LIMIT 1

That'd return the date of the most recently uploaded media from a user. It does not have asset specified so it'll check from every gallery. You'll need to specify asset in the WHERE statement if you need it to be more specific. You can format the date using SQL functions as needed as it won't be formatted like regular date fields on output (will be SQL 0000-00-00 00:00:00 format).


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.

Moderators: beatnantkrileon
Powered by Kunena Forum