Forums

[resolved] use a variable as an argument (4 posts)

  1. jonathandsimmons
    Member
    Posted 1 year ago #

    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?

  2. kreativjustin
    Member
    Posted 1 year ago #

    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

  3. jonathandsimmons
    Member
    Posted 1 year ago #

    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!

  4. kreativjustin
    Member
    Posted 1 year ago #

    Good deal :) Yep, sorry for the typo

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.