• Resolved Geoff

    (@geoffrsmith)


    Hi,
    I have ‘CUSTOM_USER_TABLE’ and ‘CUSTOM_USER_META_TABLE’ constants defined, which is causing get_user_meta_keys() in class-wprus-settings.php to return empty.
    Is there any reason why {$wpdb->usermeta} could not be used in place of {$wpdb->prefix}usermeta in the sql query?
    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Alexandre Froger

    (@frogerme)

    Hi @geoffrsmith
    If you are speaking about line 820 of class-wprus-settings.php (FROM {$wpdb->prefix}usermeta m), it is using {$wpdb->prefix} in the sql query.

    This is because it is best practice, and mandatory to make sure prefixes set in wp-config gets taken into account.
    See this post on WordPress Stackexchange.

    Thread Starter Geoff

    (@geoffrsmith)

    Hi,
    Thanks for taking the time to respond, and yes that was the specific code that I was referring to.

    I believe that the final section of the linked stackexchange post is pertinent in my case:

    However, multisite uses only one user table, since all users are network users. So if the query involves the wp_users or wp_usermeta tables, you must use $wpdb->users or $wpdb->usermeta respectively

    I have ‘CUSTOM_USER_TABLE’ and ‘CUSTOM_USER_META_TABLE’ defined in wp-config for subdomain sites sharing the same database as the main site, and need to link sign-in on any one of these site to another site using a separate database.

    As the main database only has a single user and usermeta table for all connected site, $wpdb->prefix only works correctly for those specific tables on the main domain.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘metakeys SQL query’ is closed to new replies.