• Resolved nthnlsmmrs

    (@nthnlsmmrs)


    I’m still trying to figure out the database queries and structures and what not. I want to know, how would I go about displaying a simple list of websites that each user has. Essentially it would be shown as the persons display name with a link to their website. But it would need to do this for every member.

    Any help would be greatly appreciated.
    Thanks,
    ~Nathaniel

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter nthnlsmmrs

    (@nthnlsmmrs)

    This is the code I came up with… but of course it’s not working. It throws an error just trying to get stuff from the database. Yes I am using extra feilds, that’s what I really want to look up.

    <?php
    global $wpdb;
    $allusers = $wpdb->get_col(SELECT ID FROM $wpdb->users ORDER BY ID");
    
    reset($allsuers);
    while (list($key, $val) = each($allsuers)) {
    $url = get_cimyFieldValue($val, EWURL);
        echo "<a href='$url'>Display Name</a><br />";
    }
    ?>

    If anyone could please help me, that would be greatly appreciated. I’m the kind of person who needs to see the code in action. Once I get something working and can fiddle with it, I should be fine.

    Thanks

    Thread Starter nthnlsmmrs

    (@nthnlsmmrs)

    I’m probably also messing up the part where the link is supposed to be displayed. I never did understand how to mix that stuff up when it included quotation marks.

    Oh, and the link to the site: https://www.commentexchange.org/
    So you can see what’s going on.

    Thread Starter nthnlsmmrs

    (@nthnlsmmrs)

    Ok, so the code was jacked. It was missing a quotation mark.

    Now my problem is that it returns the errors:

    Warning: reset(): Passed variable is not an array or object in /home/content/n/t/h/nthnlsmmrs/html/ce/wp-content/themes/snoods-10/ewurls.php on line 5

    Warning: Variable passed to each() is not an array or object in /home/content/n/t/h/nthnlsmmrs/html/ce/wp-content/themes/snoods-10/ewurls.php on line 6

    The new code is:

    <?php
    global $wpdb;
    $allusers = $wpdb->get_col("SELECT ID FROM $wpdb->users ORDER BY ID",0);
    
    reset($allsuers);
    while (list($key, $val) = each($allsuers)) {
    $url = get_cimyFieldValue($val, EWURL);
        echo "<a href='$url'>Display Name</a><br />";
    }
    ?>

    I guess the problem now is that it’s not really returning an array of all the users. Why not?

    Thread Starter nthnlsmmrs

    (@nthnlsmmrs)

    Never mind, resolved it all on my own. LOL

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘User Links’ is closed to new replies.