Forum Replies Created

Viewing 15 replies - 16 through 30 (of 64 total)
  • Thread Starter aldemarcalazans

    (@aldemarcalazans)

    Yes, I already warned the DataTable folks, as follows:

    Responsive Javascript file seems to be buggy

    Regards,
    Aldemar

    Hi slimmyweight.
    Take a look here:

    Responsive layout not working properly

    Hi jazmine1. Take a look here:

    Responsive layout not working properly

    Thread Starter aldemarcalazans

    (@aldemarcalazans)

    Do you have any security plugin, like All In One WP Security installed? Try disabling some firewall protections of it, one by one (perhaps one of them are blocking some URLs associated with Hungry Feed).

    If it works, update your plugin and then enable these protections again.

    Forum: Plugins
    In reply to: [Custom Upload Dir] user_ID

    Hi kryvulena. You can achieve that editing the plugin file custom_upload_dir.php as follows:

    ORIGINAL CODE

    
    function cud_generate_path(){	
       global $post, $post_id, $current_user, $cud_file_ext, $cud_file_type, $cud_rpc_id;
    

    MODIFIED CODE

    
    function cud_generate_path(){	
       global $post, $post_id, $current_user, $user_id, $cud_file_ext, $cud_file_type, $cud_rpc_id;  // variable $user_id added to the code
    

    ORIGINAL CODE

    
    $customdir = str_replace('%current_user%', 	cud_get_user_name($user_id),$customdir);
    

    MODIFIED CODE

    
    $customdir = str_replace('%current_user%', 	cud_get_user_name($user_id),$customdir);
    $customdir = str_replace('%current_user_id%', 	$user_id, $customdir);  // this line added to the code
    

    ORIGINAL CODE

    
    'current_user'		=> __('The currently logged in user', 'cud'),
    

    MODIFIED CODE

    
    'current_user'		=> __('The currently logged in user', 'cud'),
    'current_user_id'		=> __('The currently logged in user ID', 'cud'),  // this line added to the code
    
    aldemarcalazans

    (@aldemarcalazans)

    Hi peerv. I guess one of the codes below might help you. They block direct file access to anything (folders or files) inside wp-content/uploads folder, for not logged in users.

    # RETURNS A FORBIDDEN TO A NOT LOGGED IN USER

    
    RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC]
    RewriteCond %{REQUEST_URI} ^(.*/wp-content/uploads/.+)$ [NC]
    RewriteRule ^(.*)$ - [R=403,L]
    

    # REDIRECT A NOT LOGGED IN USER TO THE LOGIN PAGE

    
    RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC]
    RewriteCond %{REQUEST_URI} ^(.*/wp-content/uploads/.+)$ [NC]
    RewriteRule ^(.*)$ wp-login.php [R=temporary,L]
    

    # REDIRECT A NOT LOGGED IN USER TO AN INFORMATION PAGE ON YOUR SITE

    
    RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC]
    RewriteCond %{REQUEST_URI} ^(.*/wp-content/uploads/.+)$ [NC]
    RewriteRule ^(.*)$ your-page-informing-the-need-of-login [R=temporary,L]
    

    These codes were based on the article below:

    https://wpguru.co.uk/2012/01/how-to-prevent-direct-file-access-in-your-wp-content-directory/

    You can add this code to your .htaccess using the feature “Custom Rules” of the plugin. Note that the third code can not be used directly: you must substitute “your-page-informing-the-need-of-login” by a real page of your site.

    Thread Starter aldemarcalazans

    (@aldemarcalazans)

    Hi. I implemented in my edited version of your plugin this feature with success, as follow:

    wp-security-firewall-menu.php
    `$aio_wp_security->configs->set_value(‘aiowps_enable_custom_rules’,isset($_POST[“aiowps_enable_custom_rules”])?’1′:”);
    //add an option to place custom rules at the beginning of .htaccess (1 of to 2)
    // +++++ start of added code +++++ $aio_wp_security->configs->set_value(‘aiowps_place_custom_rules_at_the_beginning’,isset($_POST[“aiowps_place_custom_rules_at_the_beginning”])?’1′:”);
    // +++++ end of added code +++++
    $aio_wp_security->configs->save_config(); //Save the configuration

    (…)

    <!– add an option to place custom rules at the beginnig of .htaccess (2 of 2) and increase columns to 80–>
    <!– +++++ start of added code +++++ –>
    <tr valign=”top”>
    <th scope=”row”><?php _e(‘Put these rules at the beginning’, ‘all-in-one-wp-security-and-firewall’)?>:</th>
    <td>
    <input name=”aiowps_place_custom_rules_at_the_beginning” type=”checkbox”<?php if($aio_wp_security->configs->get_value(‘aiowps_place_custom_rules_at_the_beginning’)==’1′) echo ‘ checked=”checked”‘; ?> value=”1″/>
    <span class=”description”><?php _e(‘Check this if you want these rules placed before all other security rules of the plugin; otherwise they will be placed after all other rules’, ‘all-in-one-wp-security-and-firewall’); ?></span>
    </td>
    </tr>
    <!– +++++ end of added code +++++ –>

    <tr valign=”top”>
    <th scope=”row”><?php _e(‘Enter Custom .htaccess Rules:’, ‘all-in-one-wp-security-and-firewall’)?></th>
    <td>
    <!– ===== start of modified code ===== –>
    <textarea name=”aiowps_custom_rules” rows=”35″ cols=”80″><?php echo htmlspecialchars($aio_wp_security->configs->get_value(‘aiowps_custom_rules’)); ?></textarea>
    <!– ===== end of modified code ===== –>
    <br />
    <span class=”description”><?php _e(‘Enter your custom .htaccess rules/directives.’,’all-in-one-wp-security-and-firewall’);?></span>
    </td>
    </tr>`

    wp-security-configure-settings.php

    //add an option to place custom rules at the beginning of .htaccess (1 of 3)
    // +++++ start of added code +++++	$aio_wp_security->configs->set_value('aiowps_place_custom_rules_at_the_beginning','');//Checkbox
    // +++++ end of added code +++++
    $aio_wp_security->configs->set_value('aiowps_custom_rules','');
    
    (...)
    
    //add an option to place custom rules at the beginning of .htaccess (2 of 3)
    // +++++ start of added code +++++	$aio_wp_security->configs->add_value('aiowps_place_custom_rules_at_the_beginning','');//Checkbox
    // +++++ end of added code +++++
    $aio_wp_security->configs->add_value('aiowps_custom_rules','');
    
    (...)
    
    //add an option to place custom rules at the beginning of .htaccess (3 of 3)
    // +++++ start of added code +++++	$aio_wp_security->configs->set_value('aiowps_place_custom_rules_at_the_beginning','');//Checkbox
    // +++++ end of added code +++++
    $aio_wp_security->configs->set_value('aiowps_custom_rules','');

    wp-security-utility-htaccess.php

    //add an option to place custom rules at the beginning of .htaccess
    $rules = "";
    // ===== start of modified code =====
    global $aio_wp_security;	if($aio_wp_security->configs->get_value('aiowps_place_custom_rules_at_the_beginning')=='1') {
    $rules .= AIOWPSecurity_Utility_Htaccess::getrules_custom_rules();
    }
    $rules .= AIOWPSecurity_Utility_Htaccess::getrules_block_wp_file_access();
    $rules .= AIOWPSecurity_Utility_Htaccess::getrules_basic_htaccess();
    $rules .= AIOWPSecurity_Utility_Htaccess::getrules_pingback_htaccess();
    $rules .= AIOWPSecurity_Utility_Htaccess::getrules_block_debug_log_access_htaccess();
    $rules .= AIOWPSecurity_Utility_Htaccess::getrules_disable_index_views();
    $rules .= AIOWPSecurity_Utility_Htaccess::getrules_blacklist();
    $rules .= AIOWPSecurity_Utility_Htaccess::getrules_disable_trace_and_track();
    $rules .= AIOWPSecurity_Utility_Htaccess::getrules_forbid_proxy_comment_posting();
    $rules .= AIOWPSecurity_Utility_Htaccess::getrules_deny_bad_query_strings();
    $rules .= AIOWPSecurity_Utility_Htaccess::getrules_advanced_character_string_filter();
    $rules .= AIOWPSecurity_Utility_Htaccess::getrules_6g_blacklist();
    $rules .= AIOWPSecurity_Utility_Htaccess::getrules_5g_blacklist();
    $rules .= AIOWPSecurity_Utility_Htaccess::getrules_enable_brute_force_prevention();
    $rules .= AIOWPSecurity_Utility_Htaccess::getrules_block_spambots();
    $rules .= AIOWPSecurity_Utility_Htaccess::getrules_enable_login_whitelist();
    $rules .= AIOWPSecurity_Utility_Htaccess::prevent_image_hotlinks();
    if($aio_wp_security->configs->get_value('aiowps_place_custom_rules_at_the_beginning')=='') {
    $rules .= AIOWPSecurity_Utility_Htaccess::getrules_custom_rules();
    }
    // ===== end modified code =====
    aldemarcalazans

    (@aldemarcalazans)

    I noticed that the WordPress debug file, located in wp-content/debug.log and normally produced when you have the options below in your wp-config.php:

    define('WP_DEBUG', true);
    define('WP_DEBUG_LOG', true);

    simply disappear when you have the “Enable Debug” checkbox unchecked. Is it on purpose? In this case, the users should also be warned about that.

    Thread Starter aldemarcalazans

    (@aldemarcalazans)

    Hi. We discovered that it is a side effect of another plugin in our installation: Yoast SEO, version 3.5. After disabling this plugin, the problem did not happen anymore. We are going to inform the developer of this plugin about the fact.

    Thread Starter aldemarcalazans

    (@aldemarcalazans)

    Allright!

    I sent you an email with some modifications I did in the plugin code. Feel free to use any of them in your new version.

    Regards,
    Aldemar

    Thread Starter aldemarcalazans

    (@aldemarcalazans)

    Another notices: If I click in the menu “Auto Login after Register”, in the admin area, the debug log registers two messages:

    [03-Jun-2016 20:39:25 UTC] PHP Notice: Undefined index: add_opt_submit in D:\Var\www\html\wp-content\plugins\auto-login-after-registration\pages\auto_login_on_register_setting.php on line 8
    [03-Jun-2016 20:39:25 UTC] PHP Notice: Undefined variable: message in D:\Var\www\html\wp-content\plugins\auto-login-after-registration\pages\auto_login_on_register_setting.php on line 29

    The corrections are as follows:

    ORIGINAL CODE:

    $add_opt_submit= sanitize_text_field( $_POST['add_opt_submit'] );
    (etc., etc.,etc.)

    FIXED CODE:

    if(array_key_exists('add_opt_submit', $_POST)) {
      $add_opt_submit= sanitize_text_field( $_POST['add_opt_submit'] );
      (etc., etc.,etc.)
    }

    ORIGINAL CODE:

    if ( $message == 'saved' ) {

    FIXED CODE:

    if ( isset($message) && $message == 'saved' ) {

    Thread Starter aldemarcalazans

    (@aldemarcalazans)

    I also noticed another message in debug log, after submitting the form:

    PHP Notice: wpdb::escape is deprecated since version 3.6! Use wpdb::prepare() or esc_sql() instead. in D:\Var\www\html\wp-includes\functions.php on line 3573

    It happens because I am using a WordPress version higher than 3.5. It can be corrected as follows:

    ORIGINAL CODE:

    $password = $wpdb->escape( sanitize_text_field( $_REQUEST['com_password']));

    FIXED CODE:

    global $wp_version;
    if ( $wp_version < 2.8 ) {
      $password = $wpdb->escape( sanitize_text_field( $_REQUEST['com_password']));
    } else {
      $password = esc_sql( sanitize_text_field( $_REQUEST['com_password']));
    }

    Thread Starter aldemarcalazans

    (@aldemarcalazans)

    Thanks for the tip, chesio. I have not noticed this line, related to the problem.
    About the custom rules, I prefer to use it for very short insertions, which are always changing. I prefer not to use it for permanent modifications and/or insertions of big blocks of code.

    Thread Starter aldemarcalazans

    (@aldemarcalazans)

    I noticed you already have something like that: the Login Whitelist feature (I never used/noticed that, thats why I sent you the code above).

    Anyway, including a checkbox allowing the entire range of private IPs, with the information “If you are accessing your WordPress from a private network…” would be interesting, in terms of easy of use.

    Moreover, the code above block directly the attemptives to access the wp-admin folder (example: https://the.name.of.your.site.com/wp-admin/), without the need of PHP redirection to wp-login page before blocking. This can be useful in terms of performance, in cases where a botnet with hundreds of computers is trying to discover your admin login/password (it happened with me). Also, placing the code in the beginning of the file seems to be better, also for performance reasons.

Viewing 15 replies - 16 through 30 (of 64 total)