• Hi everyone! Im developing a basic theme for a multisite installation. The most important feature, it’s that I want to show the user data, depending on the site that has activated such theme. More details:

    – I’m working on a base path multisite installation.
    – I don’t want to use child themes, I want to develop the theme from scratch.
    – Every subfolder (path) will be mapping to a different domain, and every domain will have just ONE user (the one I’m trying to get the info!).
    – I want to deliver the same theme, for all the sites and all the user to use.
    – All the user will update their WordPress profile/user section, I want to retreive the information from there.
    – I will use between 13 to 15 different fields, some default wordpress fields, some others custom fields.
    – Once done, I want to develop more themes. So, all the users will have more than one theme to choose from, and all the themes will show only their contact data.

    My goal it’s to get every site to show the user info respectively. Here’s a basic example of what I have done:

    * functions.php:
    I have added some custom fields to the user profile:

    add_filter(‘user_contactmethods’, ‘add_fields’ );
    function add_fields($fields){
    $fields[ ‘facebook’ ] = __( ‘Facebook’ );
    $fields[ ‘twitter’ ] = __( ‘Twitter’ );
    return $fields;
    }

    * index.php:
    Showing some fields:

    <?php $user_id = get_current_user_id(); ?>
    <span>Nickname:<?php echo the_author_meta(“nickname”, $user_id); ?></span>
    <span>Facebook:<?php echo the_author_meta(“facebook”, $user_id); ?></span>

    The problem with this code is that I only get data if the user is logged in. I’ve been trying differents wordpress functions related to users ids, but I’m having troubles to develop one multipurpose code. I don’t want to pass differents ids everytime. The theme should “somehow” filter the user by site and role, get the info and show it.
    I know may be it’s a complicated feature, but I hope it would be a few functions and can`t find yet. Basically I need some orientation, either it’s an “easy” theme feature, or I may start thinking on a plugin and a database.

    I will very appreciate you share your wisdom guys! Thank you.

  • The topic ‘Building one multisite theme, to show different user info’ is closed to new replies.