Skip to content

Instantly share code, notes, and snippets.

@Pross
Last active August 16, 2018 12:53
Show Gist options
  • Save Pross/92e20d3e42da67adb57a44f7102543e2 to your computer and use it in GitHub Desktop.
Save Pross/92e20d3e42da67adb57a44f7102543e2 to your computer and use it in GitHub Desktop.
Adds a dropdown to WordPress.org post reply with scripted replies.
// ==UserScript==
// @name WordPress.org Scripted Replies
// @description Scripted Replies
// @grant none
// @updateURL https://gist.github.com/Pross/92e20d3e42da67adb57a44f7102543e2/raw/user.js
// @downloadURL https://gist.github.com/Pross/92e20d3e42da67adb57a44f7102543e2/raw/user.js
// @include https://*.wordpress.org/support/topic/*
// @include https://*.wordpress.org/support/view/*
// @include https://wordpress.org/support/topic/*
// @include https://wordpress.org/support/view/*
// @require https://code.jquery.com/jquery-1.11.0.min.js
// @version 0.0.2
// ==/UserScript==
$(document).on('ready', function() {
var opt = '<br /><br /><select class="scripted-reply" ><option value="" >Select Reply</option>';
var replies = {
'dashboard_access': {
'name': 'Cannot Access Dashboard',
'text': ['Try <a href="https://codex.wordpress.org/FAQ_Troubleshooting#How_to_deactivate_all_plugins_when_not_able_to_access_the_administrative_menus.3F">manually resetting your plugins</a> (no Dashboard access required). If that resolves the issue, reactivate each one individually until you find the cause.',
'If that does not resolve the issue, access your server via <a href="https://codex.wordpress.org/FTP_Clients">SFTP or FTP</a>, or a file manager in your hosting account\'s control panel, navigate to `/wp-content/themes/` and rename the directory of your currently active theme. This will force the default theme to activate and hopefully rule-out a theme-specific issue (theme functions can interfere like plugins).'
]
},
'theme_plugin_error': {
'name': 'Error Related to Plugin or Theme Conflict',
'text': ['This may be a plugin or theme conflict. Please attempt to disable all plugins, and use one of the default (Twenty*) themes. If the problem goes away, enable them one by one to identify the source of your troubles.',
'If you can install plugins, install "Health Check": https://wordpress.org/plugins/health-check/ On the troubleshooting tab, you can click the button to disable all plugins and change the theme for you, while you\'re still logged in, <strong>without affecting normal visitors to your site</strong>.']
},
'damaged_core_files': {
'name': 'Error Related to Missing or Damaged Core Files',
'text': ['Try <a href="https://wordpress.org/download/">downloading WordPress</a> again, access your server via <a href="https://codex.wordpress.org/FTP_Clients">SFTP or FTP</a>, or a file manager in your hosting account\'s control panel, and delete then replace your copies of everything except the `wp-config.php` file and the `/wp-content/` directory with fresh copies from the download. This will effectively replace all of your core files without damaging your content and settings.',
'Some uploaders tend to be unreliable when overwriting files, so don\'t forget to delete the original files before replacing them.']
},
'out_of_memory': {
'name': 'Out Of Memory',
'text': ['If you\'re seeing this error either suddenly (no specific task was done to cause the error) or frequently, try deactivating all plugins to rule-out a plugin-specific issue and try switching themes to rule-out a theme-specific issue.',
'Otherwise, here are three ways to increase PHP\'s memory allocation:',
'1. If you can edit or override the system `php.ini` file, increase the memory limit. For example, `memory_limit = 128M`',
'2. If you cannot edit or override the system `php.ini` file, add `php_value memory_limit 128M` to your `.htaccess` file.',
'3. If neither of these work, it\'s time to ask your hosting provider to temporarily increase PHP\'s memory allocation on your account.',
'(in the above examples, the limit is set to 128MB)'
]
},
'500_error': {
'name': 'Error 500: Internal Server Error',
'text': ['Internal server errors (error 500) are often caused by plugin or theme function conflicts, so if you have access to your admin panel, try deactivating all plugins. If you don\'t have access to your admin panel, try <a href="https://codex.wordpress.org/FAQ_Troubleshooting#How_to_deactivate_all_plugins_when_not_able_to_access_the_administrative_menus.3F">manually resetting your plugins</a> (no Dashboard access required). If that resolves the issue, reactivate each one individually until you find the cause.',
'If that does not resolve the issue, try switching to the default theme for your version of WordPress to rule-out a theme-specific issue. If you don\'t have access to your admin panel, access your server via <a href="https://codex.wordpress.org/FTP_Clients">SFTP or FTP</a>, or a file manager in your hosting account\'s control panel, navigate to `/wp-content/themes/` and rename the directory of your currently active theme. This will force the default theme to activate and hopefully rule-out a theme-specific issue.',
'If that does not resolve the issue, it\'s possible that a `.htaccess` rule could be the source of the problem. To check for this, access your server via SFTP or FTP, or a file manager in your hosting account\'s control panel, and rename the `.htaccess` file. If you can\'t find a `.htaccess` file, make sure that you have set your SFTP or FTP client to view invisible files.',
'If you weren\’t able to resolve the issue by either resetting your plugins and theme or renaming your .htaccess file, we may be able to help, but we\'ll need a more detailed error message. Internal server errors are usually described in more detail in the server error log. If you have access to your server error log, generate the error again, note the date and time, then immediately check your server error log for any errors that occurred during that time period. If you don\’t have access to your server error log, ask your hosting provider to look for you.'
]
},
'hacked': {
'name': 'Hacked?',
'text': ['Remain calm and carefully follow <a href="https://codex.wordpress.org/FAQ_My_site_was_hacked">this guide</a>. When you\'re done, you may want to implement some (if not all) of <a href="https://codex.wordpress.org/Hardening_WordPress">the recommended security measures</a>.'
]
},
'file_upload_limit': {
'name': 'File Upload Limit',
'text': ['The maximum upload size is controlled at the server-level, not by WordPress. Here are three ways you can increase the upload limit:',
'1. If you can edit or override the system `php.ini` file, increase the maximum file and post sizes. For example, `upload_max_filesize = 100M ;` and `post_max_size = 100M ;`',
'2. If you cannot edit or override the system `php.ini` file, add `php_value upload_max_filesize 100M` and `php_value post_max_size = 100M` to your `.htaccess` file.',
'3. If neither of these work, it\'s time to ask your hosting provider to increase the maximum file and post sizes on your account. Keep in mind that most decent hosting providers allow this, and If your hosting provider won\'t accommodate you, perhaps it\'s time to find a new hosting provider.',
'4. There are some plugins in the plugin directory that can help you get around this limit, for instance, helping you "chunk" your uploads, breaking them into smaller parts. Try searching "increase file upload limit".',
'(in the above examples, the limit is set to 100MB)'
]
},
'downgrading': {
'name': 'Downgrading',
'text': ['Unless you have a backup that you can restore from, downgrading is a dangerous process, which is why backing up before upgrading is strongly recommended both in the upgrade instructions and automatic upgrade interface.',
'It would be better to solve your current problem. Would you please describe what is wrong?'
]
},
'com_blog': {
'name': 'WordPress.com Blog',
'text': ['Due to the differences between the free hosted blogs offered at wordpress.com and the self-hosted and self-installed version of WordPress supported here, you should probably ask <a href="https://en.support.wordpress.com/contact/">WordPress.com Support</a> instead.'
]
},
'support_wrong_forum': {
'name': 'Plugin/Theme Support not in Specific Plugin/Theme Forum',
'text': ['I recommend asking at [plugin/theme support forum URL] so the plugin\'s/theme\'s developers and support community can help you with this.'
]
},
'commercial_support': {
'name': 'Requesting Support for a Commercial Product',
'text': ['If you use a commercial theme or plugin and need support, please go to their official support channel. In order to be good stewards of the WordPress community, and encourage innovation and progress, we feel it\'s important to direct people to those official locations.',
'[product support URL, if easily found]',
'Forum volunteers are also not given access to commercial products, so they would not know why your commercial theme or plugin is not working properly. This is one other reason why volunteers forward you to the commercial product\'s vendors. The vendors are responsible for supporting their commercial product.'
]
},
'non_english': {
'name': 'Non-English Support Request (After 1 day)',
'text': ['I\'m sorry, that didn\'t translate well, and it looks like no one has replied so far. I recommend trying at [forum from <a href="https://make.wordpress.org/support/handbook/contributing-to-the-wordpress-forums/support-forums-in-your-language/">the official list</a>] instead.'
]
},
'free_hosting': {
'name': 'Free Hosting Provider',
'text': ['We typically don\'t recommend free hosting providers around here, as they often offer crippled servers that prevent WordPress from functioning properly.',
'If you want a free blog, try <a href="https://wordpress.com/">WordPress.com</a> instead. If you don\'t mind paying, the WordPress team has provided <a href="https://wordpress.org/hosting/">a list of recommended hosting providers</a>.'
]
},
'hosting_recommendations': {
'name': 'Hosting Provider Recommendations (modlook to close)',
'text': ['Per the <a href="https://make.wordpress.org/support/handbook/forum-welcome/#closing-posts">Forum welcome</a>, topics like this are closed due to the amount of spam they attract.',
'The WordPress team has provided <a href="https://wordpress.org/hosting/">a list of recommended hosting providers</a>. For more details and other recommendations, please search via your preferred search engine.'
]
},
'pay_hire': {
'name': 'Offering to Pay/Hire (modlook to close)',
'text': ['Please try http://jobs.wordpress.net/ or https://jetpack.pro/ and do not accept any hire offers posted to these forums.',
'This topic will be closed as per the <a href="https://make.wordpress.org/support/handbook/forum-welcome/#do-not-offer-to-pay-for-help">Forum Rules</a>.'
]
},
'free_support': {
'name': 'Reaching the Limits of Free Support',
'text': ['At this point, we\'ve reached the limits of what most in the community here are willing to offer in their spare time (everyone here is a volunteer). You should consider hiring someone so that you can give them direct access to the site for a far more efficient fix than we can provide here.',
'Please try http://jobs.wordpress.net/ or https://jetpack.pro/ and do not accept any hire offers posted to these forums.',
'We will keep this thread open, unless it veers too far off course, in case someone from the community is willing to provide further help here for free.'
]
},
'admin_access': {
'name': 'Asking for Admin Access',
'text': ['Please don\'t do that: when you offer to get admin access and/or FTP access then you\'re really going too far and that\'s not cool.',
'https://make.wordpress.org/support/handbook/forum-welcome/#the-bad-stuff',
'If you are given admin credentials, you are potentially liable for any potential damage that maybe caused, not only by yourself but anyone accessing the system. Even if you do not provide warranty with your own product.',
'Unless you\'re willing to take responsibility for that user\'s installation from now on (and they should NOT let you do that) then please do not ask or suggest that someone provide you those admin or FTP details.',
'You can provide assistance here, ask for log data, you can make recommendations and even suggest changes. But do not seek admin or FTP access. That\'s just going too far.'
]
},
'site_feedback': {
'name': 'Site Feedback Request (modlook to close)',
'text': ['These forums are for supporting those experiencing problems with their WordPress websites. Please request feedback from friends and family so that the volunteers here can spend their time helping those who are experiencing difficulties.',
'This thread will be closed per <a href="https://make.wordpress.org/support/handbook/forum-welcome/#the-bad-stuff">forum rules</a>, and if you do need help with anything specific, we encourage you to open a new thread here.'
]
},
'gpl_argue': {
'name': 'GPL Argument (modlook to close)',
'text': ['The argument about whether or not WordPress and its themes and plugins are GPL is not something we\'re qualified to debate here. Certainly WordPress is licensed under <a href="https://wordpress.org/about/gpl/">GPLv2</a>, and all themes and plugins hosted on WordPress.org are required to be GPLv2 compatible in their entirety, so you are free to edit and redistribute as you see fit. If code is not licensed as GPLv2 (or later) compatible, we ask that you not bring it up here for discussion.'
]
},
'non_gpl': {
'name': 'Non-GPL Support Request (modlook to close)',
'text': ['Sorry, but your chosen theme is not released under GPL. Non GPL products are not welcome in the WordPress community. Official WordPress policy states that all plugins and themes that are publicly released are required to adhere to https://wordpress.org/about/gpl/ Any support requests for non-GPL products are usually ignored, in the interests of supporting the community and its freedoms.',
''
]
},
'wp_hosting': {
'name': 'When people complain that ‘WordPress is hosting a site.’ (modlook)',
'text': ['WordPress.org does not provide hosting for sites, it provides the software for other people to use their own sites on their own hosts. The WordPress <a href="https://wordpress.org/about/philosophy/">philosophy</a> and bill of rights permit people to use WordPress software for any reason they want, without any enforcement over legality or illegality. We leave that up to the web hosts. In cases of theft, abuse, harassment, or other such behavior, your best recourse is to contact the web host directly. You can use WHOIS to determine where the site is hosted, as well as resources such as http://www.whoishostingthis.com to find relevant information.'
]
},
'delete_org': {
'name': 'When people want their WordPress.org account to be deleted. (modlook)',
'text': ['At this time, <a href="https://make.wordpress.org/support/handbook/forum-welcome/#deleting-accounts">accounts cannot be deleted</a> at WordPress.org, it is currently a technical impossibility. You can edit your profile to remove all info, and we can even block your account if you want us to, but we cannot delete the account.'
]
},
'edit_theme_directly': {
'name': 'Warn the user not to edit their theme’s stylesheet directly',
'text': ['Don\'t edit the theme files directly, otherwise your changes will be overwritten whenever the theme is updated.',
'A custom CSS editor (usually titled Additional CSS) is included in the Customizer as of WordPress 4.7 specifically for this purpose.',
'As an alternative, especially if you intend to modify more than just CSS, create a <a href="https://developer.wordpress.org/themes/advanced-topics/child-themes/">child theme.</a>'
]
},
'child_theme': {
'name': 'CSS, it’s time for a child theme.',
'text': ['The best way to make changes like this to a theme is to use a <a href="https://developer.wordpress.org/themes/advanced-topics/child-themes/">child theme</a>, so your tweaks won\'t be overwritten when updating the theme.'
]
},
'resolve_own': {
'name': 'When you want a user to resolve their own topics',
'text': ['If your question has been answered, we would love if you would mark this topic as resolved in the left hand sidebar. This helps our volunteers find the topics that still need attention and more people will get helped, possibly like you did.'
]
},
'wpcom_blog': {
'name': 'WordPress.com Blog',
'text': ['That is a WordPress.com blog, which we really can\'t help with here.',
'To clear up any confusion, WordPress.com and WordPress.org are two different entities: https://codex.wordpress.org/WordPress_vs_WordPress.com',
'WordPress.com has complete documentation and support contacts at https://support.wordpress.com/'
]
},
'mu_subsites': {
'name': 'MU Issues creating subsites',
'text': ['To create a subsite in WP multisite, simply go to Sites -- Add New in the Network Admin dashboard. If you are using subdomain type multisite, you do NOT need to create the subdomain in your hosting. Multisite will do this for you using the wildcard domain that you set up in your hosting account.'
]
},
'subsites_identical': {
'name': 'MU I want all my subsites to stay identical in content except for [this one thing]',
'text': ['One thing to understand about multisite is that by default each subsite functions as a completely separate site as far as content. That said, there are some plugins where you can duplicate content between sites. Search the repository for "multisite duplicate content". BUT, you should be aware that Google will penalize you as far as SEO when you duplicate site content in this way.'
]
},
'mu_multi': {
'name': 'MU How to use multisite for a multilingual network',
'text': ['Multisite can be a helpful way to set up multilingual sites. Multisites is more complicated than single site WP however, so you will want to look at the skills required to create and manage a multisite network before diving in. There are <a href="https://codex.wordpress.org/Create_A_Network">step-by-step instructions</a> for setting up multisite in the WP codex, but you might also find <a href="http://wplang.org/wordpress-multisite-multilingual/">this article about setting up a multilingual network</a> helpful.'
]
}
};
/* template
'slug': {
'name': 'Dropdown Title',
'text': ['',
''
]
}
*/
// build dropdown
$.each( replies, function( key, reply ) {
opt += '<option value="' + key + '">' + reply.name + '</option>';
});
opt += '</select>';
$('#qt_bbp_reply_content_close').after(opt);
$('.scripted-reply').css( 'margin', '10px 0 5px' );
$('.scripted-reply').change( function() {
reply = $(this).val();
if( ! reply ) {
return false;
}
text = replies[reply].text.join("\n\n");
current = $('#bbp_reply_content').val();
$('#bbp_reply_content').val(current + text);
});
});
@Pross
Copy link
Author

Pross commented Feb 3, 2018

screen shot 2018-02-03 at 18 53 53

screen shot 2018-02-03 at 18 54 09

screen shot 2018-02-03 at 18 54 23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment