Reassigning action_title in Activity Feed

iamtimbo
@iamtimbo
10 years ago
301 posts
I'd like the Activity Feed to show the image title, rather than the gallery it's from, in the activity feed. Two items can appear to refer to the same thing when in fact they don't (see screengrab).

Looking in the jrAction datastore, I can't quite fathom how action_title is set - and how to reengineer it to show the image title....
actfeed.PNG.png
actfeed.PNG.png  •  6KB


updated by @iamtimbo: 07/07/15 01:17:12PM
paul
@paul
10 years ago
4,335 posts
The image title is likely in the json encoded action_data field which will get expanded for the template.
Put a {debug} at the top of the jrAction item_list.tpl template to see all the variables you have to play with. gallery_image_title will be there somewhere.


--
Paul Asher - JR Developer and System Import Specialist
iamtimbo
@iamtimbo
10 years ago
301 posts
Hi, Paul,

I did a {debug}, but the target variable changes based on what module caused the action - for example, a rating (the first item in the image above) has this in the debug:

action_item => Array (63)
_created => "1433270334"
_updated => "1433270334"
_user_id => "4"
rating_ip => "94.175.19.254"
_profile_id => "10"
rating_index => "1"
rating_title => "Allsorts"
rating_value => "4"
rating_module => "jrGallery"
rating_item_id => "347"
rating_image_size => "141959"
rating_profile_id => "10"
rating_profile_url => "iamtimbo"

where it's using rating_title as my 'target'. In a comment, though, you end up with:

action_item => Array (8)
comment_module => "jrGallery"
comment_item_id => "340"
comment_profile_id => "10"
comment_profile_url => "iamtimbo"
comment_ip => "94.175.19.254"
comment_text => "I took this while I was down at th..."
comment_item_title => "Allsorts"
comment_item_url => "allsorts"
action_shared_by_user => 0
action_shared_by_count => 0

and my 'target' is comment_item_title.

I don't see the image title showing up anywhere in the debug console. Surely there could be lots of different variables that need changing to cover every eventuality?
michael
@michael
10 years ago
7,822 posts
and there in lies the challenge/difficulty. A rating is not going to have an 'image_title' because its not an image. The activity stream has lots of different types of things in it.

What your after is the 'image_title' but when are you after it. That's what you need to create a structure to explain.

You can output anything you like anywhere you like if you can explain what it is you want. (and have a place to start.)

Quote: ....and my 'target' is comment_item_title.
Great, you have a place to start. So from there we need to explain it.

What I think you want is:
* In the action timeline on a users profile, if there was a comment left on an image in a gallery, then instead of showing the user image of the user who wrote the comment, show the gallery image.

The steps to locate that are:
* figure out what template controls the list items for the actions. in this case its:
/modules/jrActivity/templates/item_list.tpl
* locate where you want to output whatever.
-- type STUFF, OTHER STUFF, ELEPHANTS, A DIFFERENNT MARKER and refresh the page until you see one of the markers your after that goes where you want it to go. In this case its:
LINE 115 ish that currently reads:
    {jrCore_module_function function="jrImage_display" module="jrUser" type="user_image" item_id=$item._user_id size="icon" crop="auto" alt=$item.user_name class="action_item_user_img img_shadow img_scale"}

use the debug here to figure out what variables would give you what your actually after, in this case its:
{if $item.action_item.comment_module == "jrGallery"}
    {jrCore_module_function function="jrImage_display" module="jrGallery" type="gallery_image" item_id=$item.action_item.comment_item_id size="icon" crop="auto" alt=$item.action_item.comment_text  class="action_item_user_img img_shadow img_scale"}{else}
    {jrCore_module_function function="jrImage_display" module="jrUser" type="user_image" item_id=$item._user_id size="icon" crop="auto" alt=$item.user_name class="action_item_user_img img_shadow img_scale"}{/if}
* and make sure you leave the part that is not related to what you want to change un-effected so other stuff still works normally