WordPress.org

Support

Support » Plugins and Hacks » Hacks » [Resolved] Variable Not Working Inside is_author() Array

[Resolved] Variable Not Working Inside is_author() Array

  • I’m using a plugin (User Groups) to separate out users into, well, groups, and I need to figure out a way to create a conditional to check if an author is in a certain group. So, using get_term_by and get_objects_in_term, I was able to build a string of author IDs. See below:

    $taxonomy = 'user-group';
    $taxonomy_group_name = 'author-group';
    $taxonomy_group_id = get_term_by('slug' , $taxonomy_group_name, $taxonomy, 'OBJECT');
    $taxonomy_group_ids = get_objects_in_term($taxonomy_group_id->term_id, $taxonomy);
    $taxonomy_id_list = implode(',', $taxonomy_group_ids);

    So, I can take the list stored in $taxonomy_id_list and echo it out and get a string that looks like the below:

    1,2,3,4,5,6,7

    For the conditional, I should then be able to say:

    if(is_author(array($taxonomy_id_list))) { }

    But that doesn’t work. If I paste the raw list into the array, it works as it should, but if I try to use the variable inside the array, the conditional does not work.

    What am I missing? Why wouldn’t that variable work?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Variable Not Working Inside is_author() Array’ is closed to new replies.
Skip to toolbar