kseniyasqo
Forum Replies Created
-
Forum: Plugins
In reply to: [File Away] Stop prettifying directory namesuse prettify=off in your shortcode
Forum: Plugins
In reply to: [File Away] Excel upload corruptedIf you have file statistics enabled, that might be an issue. Disabling file stats in File Away settings helped me to repair files.
Forum: Plugins
In reply to: [File Away] MSI files corrupt if downloaded by non-admin usersOk, issue is related to download statistics. After disabling that, files don’t get corrupt anymore.
Forum: Plugins
In reply to: [File Away] Excel upload corruptedI have the same issue with all the files. Strangely enough, when they are downloaded as Admin, files are fine and not corrupted.
But when they are downloaded by regular user, all files are downloaded corrupted.
Did you manage to fix that issue?
I came up with a quick fix for this unwanted behavior. Basically, default role will get overwritten back to the original role assigned from the Dashboard.
function assign_original_role($user_id, $password, $meta) { global $wpdb; $user = get_userdata($user_id); $email = $user->user_email; $query = $wpdb->prepare("SELECT meta from <code>wp_signups</code> where <code>user_email</code> = %s", $email); $raw_meta = $wpdb->get_results($query, ARRAY_A); $signup_meta = unserialize($raw_meta[0]['meta']); if (array_key_exists('new_role', $signup_meta)) { $user->set_role($signup_meta['new_role']); } } add_action('wpmu_activate_user', 'assign_original_role', 99);
Forum: Plugins
In reply to: [XML Sitemap Generator for Google] XML Parsing errorHello, sorry it took me too long to reply. Unfortunately, I cannot give you access to the website. We are using quite a number of plugins but most of them relate to file/user role/access management.
Alright, I was reluctant to modify the plugin’s source code.
So I created a special plugin to solve this problem. Basically, upon user activation, I ran the final check and update the user back to Admin if signup meta had ‘new_role’ key in place.add_action('wpmu_activate_user', 'promote_to_admin', 99); function promote_to_admin($user_id, $password, $meta) { global $wpdb; $user = get_userdata($user_id); $email = $user->user_email; $query = $wpdb->prepare("SELECT meta from wp_signups where user_email = %s", $email); $raw_meta = $wpdb->get_results($query, ARRAY_A); $signup_meta = unserialize($raw_meta[0]['meta']); if (array_key_exists('new_role', $signup_meta)) { $user->set_role($signup_meta['new_role']); } }
Forum: Fixing WordPress
In reply to: Cannot select signup_meta upon multisite user activationI sorted it out, query error is was:
Working code:add_action('wpmu_activate_user', 'promote_to_admin', 99); function promote_to_admin($user_id, $password, $meta) { global $wpdb; $user = get_userdata($user_id); $email = $user->user_email; // you need to prepare query first to avoid sql errors $query = $wpdb->prepare("SELECT meta from wp_signups where user_email = %s", $email); // by default, Object(stdClass) will be returned; tell WordPress to convert it to multidimensional array $raw_meta = $wpdb->get_results($query, ARRAY_A); // after conversion, array will be represented as serialized string - unserialize it $signup_meta = unserialize($raw_meta[0]['meta']); if (array_key_exists('new_role', $signup_meta)) { $user->set_role($signup_meta['new_role']); } }
Forum: Fixing WordPress
In reply to: Cannot select signup_meta upon multisite user activationUpdate:
Scenario is when a new user is added by Admin from Dashboard. My goal is to parse the role that is assigned when new user is created by admin.It’s a bug fixing attempt, since the plugin that I am using to manage custom and default roles, overrides the Administrator role assigned to a new user from the Dashboard. So, when a new user is activated I want to check if he was initially assigned Administrator role and update the default role assigned by the plugin.
Really, it drives me crazy; I can successfully select meta from wp_signups if I run the query directly on the database from phpmyadmin (when user is not yet activated and after he is activated). But programmatically I always get empty array. What the heck?!
Forum: Plugins
In reply to: [Theme My Login] No error message on failed loginUpdate:
After tracking Network, I see that action url is marked as 303 See other and then the page gets reloaded so error messages get lost.This happens only for login page.Forum: Plugins
In reply to: [Theme My Login] multisites registerHello,
There is a hackish solution I use:
In theme-my-login/includes/class-theme-my-login-ms-signup.php, comment out these lines:
if ( ! is_main_site() ) { wp_redirect( network_home_url( 'wp-signup.php' ) ); exit; }
But you have to remember to do this tweak every time you update Theme My Login.
Forum: Plugins
In reply to: [Theme My Login] Additional signup validation filter not working with TMLAlright, I found the error it was in my plugin. Everything is working fine now; Theme My Login picks up updated array of validation errors.
Thanks!
Is it still the case? No multiple roles for a user?
Update: I was trying both with plugin network-activated and enabled only on required subsite. In both cases, it’s impossible to create a new admin user from dashboard.
Forum: Plugins
In reply to: [File Away] File overwriting revisitedNevermind, I found it! overwrite=true in fileup shortcode
Thanks for the plugin!