Forum Replies Created

Viewing 15 posts - 2,296 through 2,310 (of 2,506 total)
  • Author
    Posts
  • in reply to: Gravity Forms User Registration #1583
    Vladimir
    Keymaster

    Excellent! Thanks for the feedback.

    in reply to: Roles on user creation page #1581
    Vladimir
    Keymaster

    Hi,

    I agree with you. I will try to add secondary roles multiselect list to the new user creation page to the next version of URE.

    in reply to: How to detect custom capabilities #1578
    Vladimir
    Keymaster

    Open “Admin Menu” for the “Administrator” role, as it should have access to the full menu. Check what capability is really used to protect those standard menu items for the custom post types.

    in reply to: Gravity Forms User Registration #1576
    Vladimir
    Keymaster

    Code:

    // prefill roles at User profile editor Gravity Form fields
    add_filter( 'gform_pre_render_10', 'frontend_profile_populate_roles' );
    
    
    function frontend_profile_populate_roles( $form ) {
        
        foreach ( $form['fields'] as &$field ) {
    
            if ( $field->type == 'select' && $field->inputName==='primary_role' ) {
                prepare_primary_role_dropdown($field);
            }
            
            if ( $field->type == 'multiselect' && $field->inputName==='secondary_roles' ) {
                prepare_secondary_roles_multiselect($field);
            }
            
        }   // foreach
        
        return $form;
    }
    
    
    function get_primary_role() {
        global $current_user;
        
        if (!empty($current_user->roles)) {
            $roles = array_values($current_user->roles);
            $primary_role = array_shift($roles);
        } else {
            $primary_role = 'do-not-allow';
        }
        
        return $primary_role;
    }
    
    
    function prepare_primary_role_dropdown( &$field ) {
        global $wp_roles;
        
        $primary_role = get_primary_role();    
        $choices = array();    
        foreach ($wp_roles->role_names as $key=>$value) {
            $is_selected = $primary_role===$key;
            $choices[] = array('text'=>$value, 'value'=>$key, 'isSelected'=>$is_selected, 'price'=>0.00);
        }
        $field->choices = $choices;
        
    }
    
    
    function prepare_secondary_roles_multiselect( &$field ) {
        global $current_user, $wp_roles;
            
        $primary_role = get_primary_role();
        $choices = array();
        foreach ($wp_roles->role_names as $key=>$value) {
            if ($key==$primary_role) {
                continue;
            }
            $is_selected = in_array($key, $current_user->roles);
            $choices[] = array('text'=>$value, 'value'=>$key, 'isSelected'=>$is_selected, 'price'=>0.00);
            
        }
        $field->choices = $choices;
    }
    
    // update user's roles according to the on form selection
    add_action( 'gform_user_updated', 'frontend_profile_change_user_roles', 10, 4);
    
    function frontend_profile_change_user_roles($user_id, $user_config, $entry, $user_pass) {
    
        $user = new WP_User($user_id);
        $user->set_role($entry[6]); // Primary role
        
        // secondary roles
        if (empty($entry[7])) {
            return;
        }
        $roles = explode(',', $entry[7]);
        foreach($roles as $role) {
            $user->add_role($role);
        }
        
    }
    

    10 at the filter name ‘gform_pre_render_10’ is the ID of Gravity Forms form (with user profile fields including roles) linked to the “User Registration” add-on item with ‘update’ action.
    Form ID=10 includes 2 roles related fields:
    1) “Primary role” drop down field with “Allow field to be populated dynamically” flag turned on and “parameter name” value “primary_role”. It corresponds to the entry[6] at the code above.
    2) “Secondary roles” multi select field with “Allow field to be populated dynamically” flag turned on and “parameter name” value “secondary_roles”. It corresponds to the entry[7] at the code above.

    in reply to: Shared Media-Uploads #1572
    Vladimir
    Keymaster

    In general, ‘upload_files’ is enough to see all items of the ‘Media Library’ and may add a new one.
    I deactivated URE at your site temporally and ‘subscriber’ role still did not see Media Library items. This showed that some other plugin or even theme blocks access to the media library items. After some testing I discovered that your site current setup requires at least the ‘manage_options’ capability to be included into the ‘subscriber’ role in order it has access to media library items uploaded by others.
    So I added ‘manage_options’ to the ‘subscriber’ role and blocked all extra menu items with ‘Admin menu’ add-on. Please check.

    in reply to: Shared Media-Uploads #1571
    Vladimir
    Keymaster

    I re-checked with your role copy and got a needed result with full list of Media Library items.
    If that’s possible you may send me admin credentials to check your settings on-line (support [at-sign] role-editor.com).

    in reply to: Shared Media-Uploads #1569
    Vladimir
    Keymaster

    My recommendation above (about adding special filter to the active theme’s functions.php file) works for the development version 4.19.b17 only. You may download it after login from download page. Use “Download” link under “Development version available” title.

    in reply to: Shared Media-Uploads #1567
    Vladimir
    Keymaster

    What version of URE Pro do you use? Is it 4.19.b17?

    in reply to: Shared Media-Uploads #1565
    Vladimir
    Keymaster

    I added special filter to the development version 4.19.b17. Try it. Add this code to the active theme functions.php to set this filter:

    add_filter('ure_attachments_show_full_list', 'show_attachments_full_list', 10, 1);
    
    function show_attachments_full_list($show_full_list) {
        return true;
    }
    

    It allows to show full Media Library items list for the restricted users.

    in reply to: Shared Media-Uploads #1562
    Vladimir
    Keymaster

    This is a default behavior of User Role Editor: user with editing posts/pages restrictions sees only those media library items, which he uploaded himself.

    in reply to: Gravity Forms User Registration #1559
    Vladimir
    Keymaster

    Thanks for the additional information. There is no such feature currently. But I’m interested to realize it: 1st, as a PHP code. Then add it to the User Role Editor Pro.

    Can you send me (support [at-sign] role-editor.com the installation package of “Gravity Forms User Registration” add-on? I will use it for the investigation/testing purpose and at my localhost only.

    Vladimir
    Keymaster

    Manual URE plugin update scenario without losing any data:
    1) Deactivate plugin
    2) Delete old files under plugin folder using FTP
    3) Copy new files into plugin folder
    4) Activate plugin back

    In case your site missed URE license key somehow, starting from version 4.18.5 I removed the feature, when URE license key was deleted automatically in case of site domain, absolute path or database name change. Additionally you may specify URE license key at wp-config.php as the PHP constant. Look at version 4.18.5 changelog.

    Vladimir
    Keymaster

    Hi,

    Thanks. For the additional information and provided code.
    Richard from WP Engine was almost right when wrote: “does look like a plugin conflict between it and the Divi theme made by Elegant Themes.”. It is a conflict between WordPress and the Divi theme. As if you get update error for any other plugin you will get the similar error message replacement from Divi theme.
    I found a reason, why instead of the URE plugin update error we see the error message from the Divi theme in this case.
    There is this function (I have an older version possibly) at the themes/Divi/epanel/custom_functions.php file:

    
    add_filter( 'gettext', 'et_admin_update_theme_message', 20, 3 );
    function et_admin_update_theme_message( $default_translated_text, $original_text, $domain ) {
    	global $themename;
        $theme_page_message = 'There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s details</a>. <em>Automatic update is unavailable for this theme.</em>';
    	$updates_page_message = 'Update package not available.';
    
        if ( is_admin() && $original_text === $theme_page_message ) {
            return __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s details</a>. <em>Before you can update your Elegant Themes, you must first install the <a href="https://www.elegantthemes.com/members-area/documentation.html#updater" target="_blank">Elegant Updater Plugin</a> to authenticate your subscription.</em>', $themename );
        }
    
    	if ( is_admin() && $original_text === $updates_page_message ){
    		return __( 'Before you can update your Elegant Themes, you must first install the <a href="https://www.elegantthemes.com/members-area/documentation.html#updater" target="_blank">Elegant Updater Plugin</a> to authenticate your subscription.', $themename );
    	}
    
        return $default_translated_text;
    }
    

    This function does not check a $domain value. I’m sure it should. If we add

    
     if ($domain!='Divi') {
         return $default_translated_text;
     }
    

    to the begin of the function above, we will see the correct error message:

    
    An error occurred while updating User Role Editor Pro: Update package not available.
    

    which in other cases is replaced by the message from the Divi theme code, as this function makes replacement not for the ‘Divi’ text domain only, but and for the default one too.
    Contact Elegant Themes support to fix this issue.

    in reply to: Does restricted posts show up in RSS feed? #1550
    Vladimir
    Keymaster

    Hi,

    Yes, Content View Restriction is applied to to the feeds. If a post is allowed for the role, visitor without that role will not see such post as at the ordinal posts list and at the feed.

    Upcoming version of URE Pro includes ‘No role for this site’ option at the roles list for the “Content View Restriction” section. It will be useful for your purpose to show separate posts list for the not logged-in users.
    Development version is available for download after login from the same
    download page:
    https://www.role-editor.com/download-plugin/

    They should see the complete RSS-feed. Even when they are not logged in…

    I’m afraid that it’s difficult to differentiate who from not logged in visitors have permission to see a post, and who does not have such permission. User should login to your site to get needed content.

    Vladimir
    Keymaster

    Did you check the URE’s license key at ‘Settings->URE->General’ tab? May be URE’s update error took place but WordPress got the wrong error message…

    Is it possible to get a copy of ‘Elegant themes’ plugin to try the update of URE with ET activated (even without API key)? Send installation package to the support [at-sign] role-editor.com then.

Viewing 15 posts - 2,296 through 2,310 (of 2,506 total)