Forum Replies Created

Viewing 15 posts - 1,201 through 1,215 (of 2,529 total)
  • Author
    Posts
  • Vladimir
    Keymaster

    Hi,

    Edit file edit_mega_menu_walker.php, insert

    
    do_action( 'wp_nav_menu_item_custom_fields', $item_id, $item, $depth, $args );
    

    at the line #467, just after the ‘description’ field paragraph, like this:

    
    <p class="field-move hide-if-no-js description description-wide">
    ...
    </p>
    <?php
      do_action( 'wp_nav_menu_item_custom_fields', $item_id, $item, $depth, $args );
    ?>
    

    I hope it will help. In case of failure, I will need access to a full theme copy, to make own tests.

    in reply to: Default role settings for new sites #4839
    Vladimir
    Keymaster

    Urs,

    “Network Admin->Users->User Role Editor->Update Network” makes exactly this:
    1) replicate roles from main site to all subsites;
    2) replicate selected add-ons data to all subsites.

    in reply to: Default role settings for new sites #4837
    Vladimir
    Keymaster

    Hi Urs,

    Yes, I assume that you will configure this add-on via custom code (functions.php or MU plugin) at this stage. I will add a user interface to this part later.

    Vladimir
    Keymaster

    Yes, code was modified correctly.

    Vladimir
    Keymaster

    That is you should have this code in your functions.php finally:

    
    // User role editor pro - Show all attachments for all roles
    add_filter('ure_attachments_show_full_list', 'show_full_list_of_attachments', 10, 1);
    function show_full_list_of_attachments($show_all) {
       //if (!current_user_can('hetbakenbeheren' or 'jaarboekje' or 'kerkdienstplanning')) {
        $current_user = wp_get_current_user();
        if (!in_array('hetbakenbeheren', $current_user->roles) && !in_array('jaarboekje', $current_user->roles) && 
            !in_array('kerkdienstplanning', $current_user->roles)) {
         return $show_all;
       }
     
       return true;
    }
    
    // ure_restrict_edit_post_type
    add_filter('ure_restrict_edit_post_type', 'exclude_posts_from_edit_restrictions');
    
    function exclude_posts_from_edit_restrictions($post_type) {
        $restrict_it = true;
        $current_user = wp_get_current_user();
        if (in_array($post_type, array('event', 'ctc_event'))) {
            if (in_array('hetbakenbeheren', $current_user->roles) && in_array('kerkdienstplanning', $current_user->roles)) {
                $restrict_it = false;
            }
        } elseif ($post_type=='ctc_sermon') {
            if (in_array('dominee', $current_user->roles)) {
                $restrict_it = false;
            }
        }
            
        return $restrict_it;
    }
    
    
    Vladimir
    Keymaster

    2)
    You have to insert this line of code:

    
    add_filter('ure_restrict_edit_post_type', 'exclude_posts_from_edit_restrictions');
    

    just before

    
    function exclude_posts_from_edit_restrictions($post_type) {
    

    line in order this post types exclusion works. It does not work at all currently.

    Let me know the result.

    Vladimir
    Keymaster

    Got it.
    Check your child theme functions.php file.

    1)
    Line #174 will never work:

    
       if (!current_user_can('hetbakenbeheren' or 'jaarboekje' or 'kerkdienstplanning')) {
    

    as such role this expression “‘hetbakenbeheren’ or ‘jaarboekje’ or ‘kerkdienstplanning'” is evaluated to a boolean result, but current_user_can() function wait that its argument will be a string with a role ID.
    You have to use this code:

    
    function show_full_list_of_attachments($show_all) {
       //if (!current_user_can('hetbakenbeheren' or 'jaarboekje' or 'kerkdienstplanning')) {
        $current_user = wp_get_current_user();
        if (!in_array('hetbakenbeheren', $current_user->roles) && !in_array('jaarboekje', $current_user->roles) && 
            !in_array('kerkdienstplanning', $current_user->roles)) {
         return $show_all;
       }
     
       return true;
    }
    

    In order users with one of those 3 roles see full list of attachments, but any other restricted user will still see just his own attachments in the Media Library.

    Vladimir
    Keymaster

    Hi,

    Try this variant:

    
    /**
     * Redirect to the home page all users except administrator after successful login.
     *
     * @param string $redirect_to URL to redirect to.
     * @param string $request URL the user is coming from.
     * @param object $user Logged user's data.
     * @return string
     */
    
    function my_login_redirect( $redirect_to, $request, $user ) {
        //is there a user to check?
        if (isset($user->roles) && is_array($user->roles)) {
            //check for subscribers
            if (!in_array('administrator', $user->roles)) {
                // redirect them to another URL, in this case, the homepage 
                $redirect_to =  home_url();
            }
        }
    
        return $redirect_to;
    }
    
    add_filter( 'login_redirect', 'my_login_redirect', 10, 3 );
    
    in reply to: Permission issue with single user #4821
    Vladimir
    Keymaster

    Hi,

    I can look on this issue at your site if you send admin credentials and this problematic user name to support [at-sign] role-editor.com

    Vladimir
    Keymaster

    Can you provide me access to this site database and theme+plugins files copy (via DropBox or similar)?
    I will setup a copy of your site at my local development environment and check what is going wrong.

    Or just provide me admin access to your site or its stage/development copy and I will get needed files/data myself (support [at-sign] role-editor.com).

    Vladimir
    Keymaster

    Hi Arie,

    Multiple functions on the same filter returns different results for the same custom post type as filter function does not take a result of a previously called code.

    I recommend to use a single function for this filter with a logic for all you cases. Try this variant:

    
    function exclude_posts_from_edit_restrictions($post_type) {
        $restrict_it = true;
        $current_user = wp_get_current_user();
        if (in_array($post_type, array('event', 'ctc_event'))) {
            if (in_array('hetbakenbeheren', $current_user->roles) && in_array('kerkdienstplanning', $current_user->roles)) {
                $restrict_it = false;
            }
        } elseif ($post_type=='ctc_sermon') {
            if (in_array('dominee', $current_user->roles)) {
                $restrict_it = false;
            }
        }
            
        return $restrict_it;
    }
    

    It does not restrict ‘event’ and ‘ctc_event’ CPT for a user who has both ‘hetbakenbeheren’ and ‘kerkdienstplanning’ roles at the same time.
    It does not restrict ‘ctc_sermon’ CPT if user has ‘dominee’ role.

    in reply to: Rename a role does not cascade to subsites #4809
    Vladimir
    Keymaster

    Hi @wp.network,

    Thanks for this remind and definitely useful suggestions. No these features are still not realized. I confirm that I will work on them this year.

    Vladimir
    Keymaster

    Hi Arie,
    Code for user with 2 roles to exclude from the edit restrictions 2 mentioned custom post types may be similar to:

    
    add_filter('ure_restrict_edit_post_type', 'exclude_posts_from_edit_restrictions');
    function exclude_posts_from_edit_restrictions($post_type) {
      $restrict_it = true;
      $current_user = wp_get_current_user();
      if (!in_array('hetbakenbeheer', $current_user->roles) || !in_array('kerkdienstplanning', $current_user->roles)) {
        return $restrict_it;
      }
      
      $do_not_restrict = array('event', 'ctc-event');    
      if (in_array($post_type, $do_not_restrict)) {
        $restrict_it = false;
      }  
      
      return $restrict_it;
    }
    
    
    in reply to: Error 500 when using Post Edit Access #4802
    Vladimir
    Keymaster

    Arie,

    Thanks for the help with isolating this conflict between 2 plugins.

    in reply to: Error 500 when using Post Edit Access #4800
    Vladimir
    Keymaster

    Can you please test development version 4.45.b2?
    It’s available after login from the same Download” page.

Viewing 15 posts - 1,201 through 1,215 (of 2,529 total)