Add custom user_row_actions Website, Facebook, Twitter

Adding this snippet to the functions.php of your wordpress theme will display new links beside the edit button in the users panel when you mouse over. If you have already added new contact methods Facebook, Twitter, etc. you can ignore the extra fields snippet and just use the second snippet.

 

 

function add_contactmethods( $contactmethods ) {
$contactmethods['twitter'] = 'Twitter';
$contactmethods['facebook'] = 'Facebook';
return $contactmethods;
}
add_filter('user_contactmethods','add_contactmethods',10,1);

 

function profile_links( $actions, $user_object ) {
$actions['website'] = '<a href="'.$user_object->user_url.'" target="_blank">WS</a>';
$actions['facebook'] = '<a href="'.$user_object->facebook.'" target="_blank">FB</a>';
$actions['twitter'] = '<a href="'.$user_object->twitter.'" target="_blank">TW</a>';
return $actions;
}
add_filter( 'user_row_actions', 'profile_links', 10, 2 );

Be Sociable, Share!

Leave a comment