WPFront » All Posts https://wpfront.com/support/forum/user-role-editor-pro-2/feed/ Sat, 31 May 2025 11:31:06 +0000 https://bbpress.org/?v=2.6.6 en-US https://wpfront.com/support/topic/programmatically-assign-roles/#post-142861 <![CDATA[Reply To: Programmatically assign roles]]> https://wpfront.com/support/topic/programmatically-assign-roles/#post-142861 Wed, 02 Apr 2025 17:05:48 +0000 Luis Paulo Lohmann To whom might have the same question, I followed Mr. Mohan’s instructions and used the native WP add_role method:

https://developer.wordpress.org/reference/classes/wp_user/add_role/

]]>
https://wpfront.com/support/topic/programmatically-assign-roles/#post-142847 <![CDATA[Programmatically assign roles]]> https://wpfront.com/support/topic/programmatically-assign-roles/#post-142847 Tue, 01 Apr 2025 13:13:07 +0000 Luis Paulo Lohmann I’m importing users from a Windows AD directory and would like to assign secondary roles based on a meta field.

I tried adding a hook in functions.php and seemingly the roles are being added to the database, but not showing up in the editor front-end.

Could you please help me? Here’s the code:

function assign_secondary_role($user_id) {
    // Retrieve the secondary role from user meta
    $secondary_role = get_user_meta($user_id, 'user_depto', true);

    // Map the secondary role to its role key
    $role_mapping = [
        'T.i.' => 'ti',
        'Diretoria Executiva' => 'diretoria_executiva',
        'Marketing' => 'marketing'
    ];

    if (isset($role_mapping[$secondary_role])) {

        // Get existing roles
        $existing_roles = get_user_meta($user_id, 'wpfront_urole_secondary', true);

        if (!is_array($existing_roles)) {
            $existing_roles = [];
        }

        // Add the new secondary role
        $existing_roles[] = $role_mapping[$secondary_role];
        update_user_meta($user_id, 'wpfront_urole_secondary', $existing_roles);

        // Ensure roles are refreshed properly
        delete_user_meta($user_id, '_wpfront_user_role_cache'); // Clear WPFront cache
        clean_user_cache($user_id); // Clear WP cache
        
        // Force WPFront to reapply the role
        do_action('wpfront_user_role_update', $user_id);

        // Manually refresh user roles
        $user = new WP_User($user_id);
        $user->get_role_caps(); // Force reload of capabilities

        error_log("Assigned roles after update: " . print_r(get_user_meta($user_id, 'wpfront_urole_secondary', true), true));
        error_log("Secondary role '{$role_mapping[$secondary_role]}' assigned to user ID {$user_id}.");

    } else {
        error_log("No secondary role found for user ID {$user_id}.");
    }
}

// Hook into user profile update
add_action('profile_update', function($user_id) {
    assign_secondary_role($user_id);
});
]]>
https://wpfront.com/support/topic/product-page-is-messed-up-with-roles/#post-140553 <![CDATA[Product Page is messed up with roles…]]> https://wpfront.com/support/topic/product-page-is-messed-up-with-roles/#post-140553 Tue, 15 Oct 2024 11:00:35 +0000 Ronni Colangelo My product list page we use to update product information has a one character field for roles which makes the page a mess and unusable to my users. How do we fix this or just disable it…

Broken Product List

]]>
https://wpfront.com/support/topic/css-float-button-right-side/#post-140246 <![CDATA[CSS Float Button Right Side]]> https://wpfront.com/support/topic/css-float-button-right-side/#post-140246 Thu, 19 Sep 2024 21:05:45 +0000 Rob Hibbs Hi,

Can you provide the CSS to move the button to the right side?
I tried using the float: right; property but it’s not working.

Link to page.
https://mastersonmethod.com/uk_shop/

]]>
https://wpfront.com/support/topic/notification-bar-is-hovering-above-lightbox-close-button/#post-139930 <![CDATA[Reply To: Notification Bar is hovering above Lightbox Close Button]]> https://wpfront.com/support/topic/notification-bar-is-hovering-above-lightbox-close-button/#post-139930 Thu, 22 Aug 2024 15:15:53 +0000 Syam Mohan Which page do I need to go to see the issue?

Thanks

]]>
https://wpfront.com/support/topic/notification-bar-is-hovering-above-lightbox-close-button/#post-139927 <![CDATA[Reply To: Notification Bar is hovering above Lightbox Close Button]]> https://wpfront.com/support/topic/notification-bar-is-hovering-above-lightbox-close-button/#post-139927 Thu, 22 Aug 2024 11:13:16 +0000 BF Hi there and thanks for your reply!

The URL is https://www.babyforte.de

Thanks so much!

]]>
https://wpfront.com/support/topic/notification-bar-is-hovering-above-lightbox-close-button/#post-139914 <![CDATA[Reply To: Notification Bar is hovering above Lightbox Close Button]]> https://wpfront.com/support/topic/notification-bar-is-hovering-above-lightbox-close-button/#post-139914 Wed, 21 Aug 2024 18:47:23 +0000 Syam Mohan Hi,

Can you share the site URL, so that I can see the issue?

Thanks

]]>
https://wpfront.com/support/topic/notification-bar-is-hovering-above-lightbox-close-button/#post-139910 <![CDATA[Notification Bar is hovering above Lightbox Close Button]]> https://wpfront.com/support/topic/notification-bar-is-hovering-above-lightbox-close-button/#post-139910 Wed, 21 Aug 2024 11:19:20 +0000 BF Hi there!

We are using WPFront Notification Bar Pro and saw, that the Notification bar, which is set on the top of our WordPress Page, is overlaying the lightbox close button when opening the product gallery.

Can you help me with setting the right CSS code or a setting to layer the bar UNDERNEATH the lightbox close button?

Thanks in advance!

]]>
https://wpfront.com/support/topic/change-email-address-on-account/#post-139089 <![CDATA[Reply To: Change email address on account?]]> https://wpfront.com/support/topic/change-email-address-on-account/#post-139089 Tue, 18 Jun 2024 16:12:46 +0000 Syam Mohan Corrected.

Thanks

]]>
https://wpfront.com/support/topic/change-email-address-on-account/#post-139086 <![CDATA[Change email address on account?]]> https://wpfront.com/support/topic/change-email-address-on-account/#post-139086 Tue, 18 Jun 2024 15:28:49 +0000 Webmaster Hi,

Is it possible to do this? The account is associated with a former employee’s email address. I would like to change it to a different address.

]]>