Skip to main content
added 18 characters in body
Source Link
mha
  • 305
  • 2
  • 15

I have added these code to my theme function.php for my custom taxonomy "series".

add_filter('edited_terms', 'mysite_edited_terms'); function mysite_edited_terms($term_id) { if($_POST['taxonomy'] == 'series'): { $user = wp_get_current_user(); if ($user->ID) { $terms = get_user_meta($user->ID,'users_terms_for_series'); $terms = (empty($terms) ? $term_id : "{$terms},{$term_id}"); update_user_meta($user->ID,'users_terms_for_series',$terms); } } }

add_filter('edited_terms', 'mysite_edited_terms');
function mysite_edited_terms($term_id) {
  if($_POST['taxonomy'] == 'series'): {
    $user = wp_get_current_user();
    if ($user->ID) {
      $terms = get_user_meta($user->ID,'users_terms_for_series');
      $terms = (empty($terms) ? $term_id : "{$terms},{$term_id}");
      update_user_meta($user->ID,'users_terms_for_series',$terms);
    }
  }
}
add_filter('list_terms_exclusions', 'my_list_terms_exclusions', 10, 2); function my_list_terms_exclusions( $exclusions, $args ) { global $pagenow; if (current_user_can('can_manage_all_terms') && $pagenow=='edit-tags.php?taxonomy=series') { $terms = get_user_meta($user->ID,'users_terms_for_series'); $exclusions = " {$exclusions} AND t.ID NOT IN ({$terms})"; } return $exclusions; }

add_filter('list_terms_exclusions', 'my_list_terms_exclusions', 10, 2);
function my_list_terms_exclusions( $exclusions, $args ) {
  global $pagenow;
  if (current_user_can('can_manage_all_terms') && 
    $pagenow=='edit-tags.php?taxonomy=series') {
    $terms = get_user_meta($user->ID,'users_terms_for_series');
    $exclusions = " {$exclusions} AND t.ID NOT IN ({$terms})";
  }
  return $exclusions;
}

but nothing happened. This code is based on @MikeSchinkel. I think @Jan Fabry is right that the edit-tags.php doesn't listen to any arguments. But I dont no how to do that.

Any help will be greatly appreciated. Thanks.

I have added these code to my theme function.php for my custom taxonomy "series".

add_filter('edited_terms', 'mysite_edited_terms'); function mysite_edited_terms($term_id) { if($_POST['taxonomy'] == 'series'): { $user = wp_get_current_user(); if ($user->ID) { $terms = get_user_meta($user->ID,'users_terms_for_series'); $terms = (empty($terms) ? $term_id : "{$terms},{$term_id}"); update_user_meta($user->ID,'users_terms_for_series',$terms); } } } add_filter('list_terms_exclusions', 'my_list_terms_exclusions', 10, 2); function my_list_terms_exclusions( $exclusions, $args ) { global $pagenow; if (current_user_can('can_manage_all_terms') && $pagenow=='edit-tags.php?taxonomy=series') { $terms = get_user_meta($user->ID,'users_terms_for_series'); $exclusions = " {$exclusions} AND t.ID NOT IN ({$terms})"; } return $exclusions; }

but nothing happened. This code is based on @MikeSchinkel. I think @Jan Fabry is right that the edit-tags.php doesn't listen to any arguments. But I dont no how to do that.

Any help will be greatly appreciated. Thanks.

I have added these code to my theme function.php for my custom taxonomy "series".


add_filter('edited_terms', 'mysite_edited_terms');
function mysite_edited_terms($term_id) {
  if($_POST['taxonomy'] == 'series'): {
    $user = wp_get_current_user();
    if ($user->ID) {
      $terms = get_user_meta($user->ID,'users_terms_for_series');
      $terms = (empty($terms) ? $term_id : "{$terms},{$term_id}");
      update_user_meta($user->ID,'users_terms_for_series',$terms);
    }
  }
}

add_filter('list_terms_exclusions', 'my_list_terms_exclusions', 10, 2);
function my_list_terms_exclusions( $exclusions, $args ) {
  global $pagenow;
  if (current_user_can('can_manage_all_terms') && 
    $pagenow=='edit-tags.php?taxonomy=series') {
    $terms = get_user_meta($user->ID,'users_terms_for_series');
    $exclusions = " {$exclusions} AND t.ID NOT IN ({$terms})";
  }
  return $exclusions;
}

but nothing happened. This code is based on @MikeSchinkel. I think @Jan Fabry is right that the edit-tags.php doesn't listen to any arguments. But I dont no how to do that.

Any help will be greatly appreciated. Thanks.

Source Link
mha
  • 305
  • 2
  • 15

I have added these code to my theme function.php for my custom taxonomy "series".

add_filter('edited_terms', 'mysite_edited_terms'); function mysite_edited_terms($term_id) { if($_POST['taxonomy'] == 'series'): { $user = wp_get_current_user(); if ($user->ID) { $terms = get_user_meta($user->ID,'users_terms_for_series'); $terms = (empty($terms) ? $term_id : "{$terms},{$term_id}"); update_user_meta($user->ID,'users_terms_for_series',$terms); } } } add_filter('list_terms_exclusions', 'my_list_terms_exclusions', 10, 2); function my_list_terms_exclusions( $exclusions, $args ) { global $pagenow; if (current_user_can('can_manage_all_terms') && $pagenow=='edit-tags.php?taxonomy=series') { $terms = get_user_meta($user->ID,'users_terms_for_series'); $exclusions = " {$exclusions} AND t.ID NOT IN ({$terms})"; } return $exclusions; }

but nothing happened. This code is based on @MikeSchinkel. I think @Jan Fabry is right that the edit-tags.php doesn't listen to any arguments. But I dont no how to do that.

Any help will be greatly appreciated. Thanks.