Ok, does anybody know were the activity stream editor is located? Is it activity/activity-loop.php? I’m having trouble finding the correct php line to edit.
Take a look at the bp_insert_activity_meta() function – you’ll need to work with the filters in there to modify the date output.
It’s called indirectly from entry.php in your activity folder, and is responsible for formatting the date.
It would be a lot easier if was formatted in the template files, but unfortunately it is hard coded in this core function – so working with the filters is your best option.
Thanks so much for responding. I’m having trouble locating this “bp_insert_activity_meta()” function . I can’t find it in entry.php or activity/index.php or anywhere else.
Or is this a hidden file that I can only access from the server?
If you could tell me which php file its hiding in it would be much help.
Thanks!
I think I found it, Its in bp-activity > bp-activity-template.php > starts line 1187 > bp_activity_time_since’
Thanks @rogercoathup for bp_insert_activity_meta() function hint
*Update*
bp_core_time_since( $activities_template->activity->date_recorded ) date_recorded would be the post date
so it looks like I need to make a new function that uses the regular PHP time function to display the time style
Hi mgkoller
if you’ve solved, you can tell me how?
Thanks!
Don’t change the function.. As I said originally, use the filters it provides to modify the display.
If you are not familiar with WordPress filters and actions have a Google in the WP docs
I haven’t solved the problem yet, Here’s were I’m looking https://codex.wordpress.org/Function_Reference/add_filter
Here’s were I think the filter needs to be added?
`
* @uses bp_insert_activity_meta()
* @uses apply_filters_ref_array() To call the ‘bp_get_activity_action’ hook
*
* @return string The activity action
*/
function bp_get_activity_action() {
global $activities_template;
$action = $activities_template->activity->action;
$action = apply_filters_ref_array( ‘bp_get_activity_action_pre_meta’, array( $action, &$activities_template->activity ) );
if ( !empty( $action ) )
$action = bp_insert_activity_meta( $action );
return apply_filters_ref_array( ‘bp_get_activity_action’, array( $action, &$activities_template->activity ) );
}
`
You add the filter (and associated hook) in your functions.php file. You don’t modify any of the core files.
‘hook’ the filter onto one of those hooks that bp_insert_activity_meta provides – e.g. add_filter( ‘bp_activity_time_since’, ‘my-function’, … );
Getting back to this issue
`
You add the filter (and associated hook) in your functions.php file
`
I’m using the Frisco theme so here is the functions.php
Github – https://github.com/davidtcarson/frisco/blob/master/functions.php
Pastebin – http://pastebin.com/2gyXjCnK
So I need to ‘hook’ the filter onto one of those hooks that bp_insert_activity_meta provides .
I’m currently trying to find out were to insert this hook in the Frisco functions.php file
Here’s the custom hook
`
add_filter( ‘bp_activity_time_since’, strftime ($time,’l jS of F Y h:i:s A’,);
`
Obviously this function isn’t going to work but I’m trying to get the bigger idea,
I’m doing this on my Localhost using Mamp so I can just work by trial and error.