Forum Replies Created

Viewing 15 replies - 1 through 15 (of 72 total)
  • Until the author can fix how permissions work, I have a solution for those who do not mind manually adding some code.

    Copy the following code into main > frontend > forms > classes > permissions.php

    Paste it right after public function conditions_logic( $settings, $type = 'form' ) { pretty close to the beginning of the file.


    // Early check for specific roles (Administrator, Editor, Author, Subscriber)
    $active_user = wp_get_current_user();
    $allowed_roles = ['administrator', 'editor', 'author', 'subscriber'];

    if ( array_intersect( $allowed_roles, (array) $active_user->roles ) ) {
    // Allow Administrators and Editors without additional conditions
    if ( in_array( 'administrator', $active_user->roles ) || in_array( 'editor', $active_user->roles ) ) {
    $settings['display'] = true;
    return $settings;
    }

    // Author and Subscriber-specific condition
    if ( in_array( 'author', $active_user->roles ) || in_array( 'subscriber', $active_user->roles ) ) {
    // Check if
    post_id exists in the URL
    if ( isset( $_GET['post_id'] ) && is_numeric( $_GET['post_id'] ) ) {
    $post_id = intval( $_GET['post_id'] );

    // Verify if the current user is the post's author
    $post = get_post( $post_id );
    if ( $post && $post->post_author == $active_user->ID ) {
    $settings['display'] = true;
    return $settings;
    }
    }
    }
    }

    // Original logic follows if the role check fails

    Any permission settings for your form(s) will no longer work. This is a harsh override which says: If admin, editor, or author/subscriber who created the post, show the form. The original logic stays as-is after that which just isn’t working right now.

    Thread Starter wilcosky

    (@wilcosky)

    I apologize, it turned out to be another plugin.

    Thread Starter wilcosky

    (@wilcosky)

    Take your time. I could be the only person with the problem. And, at least I have a solution for now (the cache purge on profile update code). This plugin speeds up my site so much that it’s still worth it even if I have to have a permanent hack.

    To reproduce, ensure you have a frontend profile. Edit the bio/description in the profile. Save. Go and view the frontend profile. Try with your plugin and without.

    Thread Starter wilcosky

    (@wilcosky)

    I have my caching plugin ignoring profile pages. The problem ended up being that my object cache which is a separate, special type that saves data to SQLite because I can’t use other types of object cache (hosting limitation), is caching profile data. That plugin doesn’t currently have a way to ignore certain things.

    So, nothing to do with this User Manager plugin, I just wasn’t 100% sure when I originally posted. But, maybe this thread will help someone in the future. Remember everyone, review your object cache if using one, not just any “normal” cache. ??

    Thread Starter wilcosky

    (@wilcosky)

    This might be resolved. I added a function to my site that flushes this other plugin’s cache when profile fields update.

    function flush_cache_on_user_change( $user_id ) {
        wp_cache_flush();
    }
    
    // Flush on user profile update.
    add_action( 'profile_update', 'flush_cache_on_user_change', 10, 1 );
    
    // Flush on new user registration.
    add_action( 'user_register', 'flush_cache_on_user_change', 10, 1 );
    
    // Flush on user deletion.
    add_action( 'delete_user', 'flush_cache_on_user_change', 10, 1 );
    Thread Starter wilcosky

    (@wilcosky)

    For now, even though it’s hacky, I’m going with this so I can still use your plugin and all profile fields update. Maybe only profile_update is needed. But, what’s a couple other flushes at this point. ???♂?

    function flush_cache_on_user_change( $user_id ) {
        wp_cache_flush();
    }
    
    // Flush on user profile update.
    add_action( 'profile_update', 'flush_cache_on_user_change', 10, 1 );
    
    // Flush on new user registration.
    add_action( 'user_register', 'flush_cache_on_user_change', 10, 1 );
    
    // Flush on user deletion.
    add_action( 'delete_user', 'flush_cache_on_user_change', 10, 1 );
    
    Thread Starter wilcosky

    (@wilcosky)

    Thank you for taking the time to provide a solution. I don’t think this solution is working for me. I tried:

    function add_non_persistent_groups() {
        wp_cache_add_non_persistent_groups(array('wpum_field_meta', 'user_meta'));
    }
    
    add_action('init', 'add_non_persistent_groups');
    

    (Added the two groups I could see that involve user fields and that SQLite Object Cache is caching.)

    You may be right. It could be a plugin bug. It’s WP User Manager. I can ask that plugin author what they think.

    This might defeat the purpose of using this plugin, but, could I add a function that completely clears the SQLite Object Cache every so many hours? I know this is likely possible, I’m just wondering if you instantly know how to do this to save me some time, to be honest.

    Because in the end, bug or not, flushing the SQLite Object Cache fixes it. Until the next profile edit. Hmm ?? … I just thought that it would be interesting if the user meta group cache was cleared on profile save.

    Thread Starter wilcosky

    (@wilcosky)

    Here’s an update in case anyone reads this one day and wonders if I figured out what broke my comments. I never figured it out. I reverted to a backup of my site and comments came back. Then I restored the most recent version of the site, and the comments stayed. Same plugins, same theme, same functions. Blame it on the ghosts of WordPress and caching, maybe. Or just the ghosts.

    Thread Starter wilcosky

    (@wilcosky)

    Thank you for confirming! At least I’ve eliminated plugins and parent theme as the issue. Time to go down the rabbit hole. ???

    Forum: Plugins
    In reply to: [WP Bottom Menu] Search
    Thread Starter wilcosky

    (@wilcosky)

    In case it helps anyone I ended up hacking it up. I added logic so that if it’s a single page, this JS is added. Forcing the slide-out effect since on my site it was being ignored on single pages only. This is very close to the default effect. Close enough. This mixed with a couple of CSS changes.

    <script>
    jQuery(document).ready(function() {
        jQuery('.wp-bottom-menu-search-form-trigger').click(function() {
            if (jQuery('.wp-bottom-menu-search-form-wrapper').hasClass('sf-active')) {
                jQuery('.wp-bottom-menu-search-form-wrapper').animate({bottom: "-100%"}, 300, function() {
                    jQuery(this).removeClass('sf-active').attr('style', '');
                }).css('z-index', '-1');
            } else {
                jQuery('.wp-bottom-menu-search-form-wrapper').addClass('sf-active').css({
                    'z-index': '99999',
                    'bottom': '86px'
                });
            }
        });
    });
    </script>
    Forum: Plugins
    In reply to: [WP Bottom Menu] Search
    Thread Starter wilcosky

    (@wilcosky)

    @j4cob do you have time to look into this?

    Thread Starter wilcosky

    (@wilcosky)

    @paulmist I never figured it out. I ended up building something from scratch. That part of the plugin is either fully broken, or doesn’t work with certain themes.

    Plugin Author wilcosky

    (@wilcosky)

    Hello,

    Here’s a user guide. Let me know if you have any other questions.

    Guide

    Thanks,
    Billy

    Thread Starter wilcosky

    (@wilcosky)

    It seems no matter what numbers I input, there are no changes. I wonder if that part of the plugin was accidentally broken during an update? Or something changed in WP core? No worries though, it’s not a big deal for me personally.

    Thread Starter wilcosky

    (@wilcosky)

    Ok, I don’t understand what the settings are for then. The ones where the recommended settings are 3, 1, and 3. I was thinking those settings let you control the number of page links. What do those do?

    • This reply was modified 11 months ago by wilcosky. Reason: Adding screenshot
Viewing 15 replies - 1 through 15 (of 72 total)