Support Forum

Email follow-up: changing attachment button text

RM Roman Mica
Roman Mica
Member

I need a little bit of help with this. I followed these instructions:

locate the file wp-content/sp-resources/forum-plugins//plupload/sp-plupload-plugin.php
find in that file the function – sp_plupload_pm_editor_button($out, $a)
change the singe line after the ‘else’ to these two lines:
 
$buttonText = apply_filters(‘sph_editor_toolbar_attachment_button’, __(‘Attachments’, ‘sp-plup’));
$out.= “<input type=’button’ class=’spSubmit spLeft’ title='”.__(‘Open/Close to Upload Attachments’, ‘sp-plup’).”‘ id=’spUploadsButton’ value='”.$buttonText.”‘ onclick=’spjOpenEditorBox(“spUploadsBox”);’ />”;
 
This needs to be exact of course.
 
Create a new file in the wp-content folder called – sp-user-functions.php
Add the following code to it:
 
<?php
add_filter(‘sph_editor_toolbar_attachment_button’, ‘sp_change_attachment_text’);
function sp_change_attachment_text($text) {
return ‘your button text’;
}
?>
 
Is this the correct folder to add the new file, sp-user-functions.php, or does it belong with the rest of the plugin files? Also, where would the option be to change the name?

5 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

Yes- that is the correct place to create the new file.This is a special custom code file that will never be removed by an SP update – unlike all other files in the plugin.

You put your preferred button text in that function – where it currently reads: ‘your button text’.

RM Roman Mica
Roman Mica
Member

It’s not working. The text on the button still says “Attachments.” Do you have to include that file explicitly somewhere so that it knows to use the new function?

YS Yellow Swordfish
Yellow Swordfish
Member

No – it works exactly as I wrote it up – and it DOES work – it was fully tested before I copied and pasted the code. I think I said look for the function 

sp_plupload_pm_editor_button()

and it should have been

sp_plupload_editor_button()

RM Roman Mica
Roman Mica
Member

That did it! I have it working on my test site and I’ll implement it on the live site soon. Thanks for your help on this!