Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
plugins-topic
Email follow-up: changing attachment button text
Avatar
Roman Mica
Member
Free Members
sp_UserOfflineSmall Offline
Feb 2, 2016 - 3:48 pm

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?
Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 2, 2016 - 3:57 pm

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'.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Roman Mica
Member
Free Members
sp_UserOfflineSmall Offline
Feb 2, 2016 - 4:14 pm

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?

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 2, 2016 - 4:57 pm

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()

andy-signature.png
YELLOW
SWORDFISH
Avatar
Roman Mica
Member
Free Members
sp_UserOfflineSmall Offline
Feb 4, 2016 - 5:50 pm

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!

Avatar
Ike
Sawtry, UK
Member
Free Members
sp_UserOfflineSmall Offline
Feb 4, 2016 - 6:20 pm

Good stuff! Thanks for letting us know.

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17366
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626