The name on activity (added X media) is a ID an not nickname


#1

see the screen on a activity post: The name of the user that post the activity are not the normal nikname.
The user “@luccafan33” is the user login identificator, then “LuccaFan” is the nickname that the person whant see on your profile.

I understand that already uses the BuddyPress nikname login to the site to associate public messages (eg luccafan33), but consider this approach definitely wrong “audience.” In fact, if you think about it, it’s like half show password to hackers; already knowing id to access the site, it lacks only find the password!

Please, I think this detail is really important for safety. Modify it as soon as possible.
Obviously hoping that solves BuddyPress by his side the publication of public messages.
thanks for your attention

Attachment Link(s):

http://rtcamp.com/wp-content/uploads/rtMedia/topics/64699/2014/04/rtmedia-name-problem.jpg


Function to Display Friendly Name
Translation issues
#2

Yes, but to change the name it will require database migration process.
There is a filter rtmedia_buddypress_action_text_fitler available in rtMedia to accomplish this.

Using this filter you can change user name in BuddyPress activity.


#3

Sorry my ignorance in the use of filters,
Should I include in my function.php a function like this?

function rtmedia_change_nameuser_with_nickname() {  
    apply_filters('rtmedia_buddypress_action_text_fitler',$action,$username,$count,$user->user_nicename,$media->media_type);  
}      
add_filter('rtmedia_buddypress_action_text_fitler', 'rtmedia_change_nameuser_with_nickname', 10, 2);

this does not work, and I do not know how to fill the filter.
Sorry again.


#4

No this way it never gonna work.

function rtmedia_change_nameuser_with_nickname( $action, $username, $count, $user_nicename, $media_type ) {  
    // your code here for BuddyPress action  
    return $action;  
}      
add_filter('rtmedia_buddypress_action_text_fitler', 'rtmedia_change_nameuser_with_nickname', 10, 5);

#5

Sorry. I tried to insert different functions, but it seems I did not change anything …
I do not know compile this code … it’s beyond my competence: (


#6

What you mean by you tried different functions??
You just need to put the code in your theme and just need to write your code as per your requirement.
$action will be stored in database like “admin added 1 photo”. So here you can change name “admin” by whatever you want.

For more details check this out -> https://github.com/rtCamp/rtMedia/blob/master/app/main/controllers/upload/RTMediaUploadEndpoint.php#L99


#7

It 'my fault
I do not have the appropriate expertise to compile this code.
essentially do not know what to put into the bowels.

I tried to insert ourselves inside the function you gave me, this code; but nothing changes.
$username = bp_core_get_username();

Forgive me, unfortunately I have that, I can not program to more complex levels.


#8

Add following code in your theme’s functions.php file.

In here you can see that I had used $user->user_firstname. You can change that and can set whatever you want.

function rtmedia_change_nameuser_with_nickname( $action, $username, $count, $user_nicename, $media_type ) {  
    $user     = get_userdata( get_current_user_id() );  
    $username = '' . $user->user_firstname . '';  
    $action   = sprintf( __( '%s added %d %s', 'rtmedia' ), $username, $count, RTMEDIA_MEDIA_SLUG );  
    return $action;  
}      
add_filter('rtmedia_buddypress_action_text_fitler', 'rtmedia_change_nameuser_with_nickname', 10, 5);

#9

Thank you, I did.
I used $user->display_name instead $user->user_firstname , and the result is the same name that appears in other activities.

On this page there is a list of topics that you may invoke.
https://codex.wordpress.org/Function_Reference/wp_get_current_user

Also I could not see the changes because I did not realize that it was not a structural change in the template, but a code saved on the db.
And then control the change I had to load a new image each time.

Thanks again for helping me


#10

I don’t get your last paragraph. Can you please elaborate?


#11

Sorry.

I change $user->user_firstname with $user->display_name
I find the code (display_name) in this wp code page : https://codex.wordpress.org/Function_Reference/wp_get_current_user

Then,
I did not understand that to display the new name($user->display_name), I had to upload a new image with the plugin.
That’s because I’m used to modify a code in the theme and see the results immediately changed.

Attachment Link(s):

http://rtcamp.com/wp-content/uploads/rtMedia/topics/64985/2014/05/rtmedia-nomeuguale.jpg


#12
function rtmedia_change_nameuser_with_nickname( $action, $username, $count, $user_nicename, $media_type ) {  
      $user     = get_userdata( get_current_user_id() );  
      $username = '' . $user->display_name . '';     
    $action   = sprintf( __( '%s added %d %s', 'rtmedia' ), $username, $count, RTMEDIA_MEDIA_SLUG );  
    return $action;  
}      
add_filter('rtmedia_buddypress_action_text_fitler', 'rtmedia_change_nameuser_with_nickname', 10, 5); 

#13

It is because BuddyPress stores all the markup in Database and that’s why it won’t update old updates.


#14

Hello,

Referencing Yukikokawa’s function code to return $user->display_name - is there a way to make the Display Name also a link to the user’s profile, just as the plugin activity updates work prior to making this modification?

Thank you.


#15

Hi @jgwolfensberger,

I have replied you here -> Function to Display Friendly Name


#16