• Resolved jonathandsimmons

    (@jonathandsimmons)


    So I’m using get_user to obtain some information.

    the function reference give the following example:
    get_users('blog_id=1&orderby=nicename&role=subscriber');

    I would like to replace blog_id=1 with blog_id=$myvar

    however it doesn’t see to be working? Does any one know the proper method to pass a variable as an argument or know if it even possible?

Viewing 3 replies - 1 through 3 (of 3 total)
  • kreativjustin

    (@kreativjustin)

    Yeah…

    If your wanting to do a $myvar then it would be setup like this

    <?
    get_users'blog_id=' . $myvar . '&orderby=nicename&role=subscriber');
    ?>

    –edit/add–

    Of course your going to have to define $myvar

    Thread Starter jonathandsimmons

    (@jonathandsimmons)

    That did it. Well you forgot the ( after get_users but other wise great.

    for anyone else looking you should have:

    get_users('blog_id=' . $myvar . '&orderby=nicename&role=subscriber');

    Thanks again for the help I had tried a few things but didn’t put the spaces after the periods. So glad that did it!

    kreativjustin

    (@kreativjustin)

    Good deal 🙂 Yep, sorry for the typo

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘use a variable as an argument’ is closed to new replies.