dashed-slug.net › Forums › Tip the Author extension support › Change Button Text › Reply To: Change Button Text
Hello,
1. Try this:
function get_user_html( $user_name, $user_url, $class = 'tipper' ) {
if ( $user_url ) {
return sprintf(
'<a href="%s" class="user %s" target="_blank">%s</a>',
$user_url,
$class,
$user_name
);
}
return sprintf(
'<span class="user %s">%s</span>',
$class,
$user_name
);
}
add_filter(
'wallets_tips_ui_message',
function( $message, $author_userdata ) {
return sprintf(
'Send a tip to %s?',
get_user_html(
$author_userdata->display_name ? $author_userdata->display_name : $author_userdata->user_nicename,
$author_userdata->user_url
)
);
},
20,
2
);
2. The mechanism that lets you override templates only applies to templates, i.e. files under the templates
directory. You can’t arbitrarily override any sourcecode file. This way of doing things is pretty standard and common among various well-known plugins.
While I can’t teach you PHP and WordPress here, the short story is this: You shouldn’t be editing plugin files directly, because when these get updated, your changes are lost. This is why you should be doing your changes in template overrides, if the changes are about the UI, or use the existing filter/action hooks to modify plugin behavior. Furthermore, to avoid the same problem with your theme, it’s best if you create a child theme for your theme, and do all your custom coding there. All of this is explained in detail in the codex.
If you feel that a filter or action is missing from the plugin, let me know, and I will consider adding it, if it makes sense.
with regards