Activity: How to make it so that the most "attractive" activity is on top

5 years 10 months ago #304919 by timstohr
Hi Kyle,
Just tried out the Auto Action and it does work... somewhat. It is true that it changes the date and effectively bumps the post so it is working great in that regard.

The main problem I have is that it deletes the original date of the activity (See image below). It would be great if the sorting of CB Activity went by another column in each activity, with onAfterCreateStreamActivity updating both columns and then onAfterCreateStreamComment updating only the "sorting" column.

Attachments:

Please Log in to join the conversation.

5 years 10 months ago #304930 by krileon
You can store additional information in the params column that's strictly for display purposes only and is how the modify date is already stored when an activity entry is edited by a user. You would likely need to store the original date there, but you will need to utilize PHP to do that as with the previous auto action suggestion. The below should extend the PHP I've already provided to store the current date as the modify date. You can also store it as whatever you want and implement your own custom display parsing for it.

$variables['var2']->params()->set( 'modified', '[var2_date]' );
$variables['var2']->set( 'params', $variables['var2']->params()->asJson() );
$variables['var2']->set( 'date', '[var3_date]' );
$variables['var2']->store();

That should set the current activity date as the modified date then update the activity date to the comments date. The modified date just shows as an icon next to the activity date though so if you want more customized display of that you'll need to implement it or store it to a different parameter like 'original_date' then add the display code for that in the activity_container.php template file.

Will review extending the Overrides parameters with a 'defaults.date' parameter to override the date display. The overrides can be found under the Parameters tab of an activity entry. Then you'd just store the original date there so it displays the original date, but sorts by latest comment.

forge.joomlapolis.com/issues/7173


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 to join the conversation.

5 years 10 months ago #304932 by krileon
Ok, implemented a parameter to override the displayed date and implemented a system action in CB Auto Actions to bump the activity entry to the top and maintain its original activity date for display. Both implementations will be available with their Bootstrap 4 releases.


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 to join the conversation.

5 years 10 months ago - 5 years 10 months ago #304934 by timstohr
Ahhh that sounds very good :)

Btw I have a "push notification" for our app that gets sent out every 24 hours that counts how many posts have been made in the last 24 hours that have a certain asset. With the changes you have just made, how can we let the program count the number of new activities in the last 24 hours since the date will be representative of the order inside CB Activity? Preferably without having to add another column in the MySQL...

Please Log in to join the conversation.

5 years 10 months ago #304946 by krileon
The displayed date will be the old date, but the date of the activity it self will still be updated. So they'd get a new post notification based off your criteria. Don't know what to tell you in regards to your notification beyond improving it to account for the defaults.date override in the params. I am not going to add another database column, sorry. If you want to you're free to do so, but it will likely hurt the optimization and storage size of each row.


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 to join the conversation.

5 years 10 months ago #305150 by timstohr
Hi Kyle,
Is the new activity Bumping functionality already out? I have not seen a new version of cb activity.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.237 seconds

Facebook Twitter LinkedIn