Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #2579

    this is moved over from

    Thank you for your reply and again, I am sorry for posting in the public space.

    Would it be possible to modify the user’s meta at run time so that if the user does not have a category set, I can set it to 999999999? Is there a hook for in the vicinity of the functionality that checks this?


    No problem.

    The only custom filter which is currently included to URE’s code related to the edit restrictions items at user level is ‘ure_post_edit_access_authors_list’.

    $value = apply_filters('ure_post_edit_access_authors_list', $value);

    I will add more custom filters with a next version possibly.

    You may use a general WordPress ‘get_user_metadata’ filter from get_meta_data() function:

    $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single );

    $object_id : $current_user->ID,
    $meta_key : $wpdb->prefix .’ure_categories_list’

    In both cases you should check if you set the category for this user or not yourself inside those filters.


    perfect. I will give it a try


    I ended up with

    function filter_users_for_no_community($null,$object_id,$meta_key,$single){
      global $wpdb;
      $theMeta = $wpdb->prefix . 'ure_categories_list';
      if($theMeta === $meta_key){
        remove_filter( 'get_user_metadata', 'filter_users_for_no_community', 10 , 4 );
        $cats = get_user_meta($object_id,$meta_key,$single);
        add_filter( 'get_user_metadata', 'filter_users_for_no_community', 10 , 4 );
          $value = '99999999';	
      return $value;
    add_filter( 'get_user_metadata', 'filter_users_for_no_community', 10 , 4 );

    thanks for your help


    coming back to this after debugging a bit. I would nix the above code if you see a bunch of 502 errors.


    If such filter ends with high server load, another workaround is to use an additional role for no-community users instead of work with every user meta data. If you allow that no-community role with access to unexisted post, like ID 99999999, users with that role will see an empty posts list.

    From my side I will look if I may add to URE own custom filter to change a default behaviour of edit restrictions add-on. So if you set such filter then all users without restrictions will see nothing.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.