multisite display user profile fields on a page..

multisite display user profile fields on a page..
Multisite - marketpress - Gridmarket..

Need to add user profile fields to a page on each store.(subsite)
So their own profile fields to their own "ABOUT ME" page per site.

Users will not access this page but fields to be taken from admin profile for each site.

How..

  • Vinod Dalvi
    • WP Unicorn

    Hi @be,

    Greetings and thanks for posting on the forums.

    Need to add user profile fields to a page on each store.(subsite)
    So their own profile fields to their own "ABOUT ME" page per site.

    Users will not access this page but fields to be taken from admin profile for each site.

    Can you just explain it a bit more in details, i don't understand exactly what you want to achieve?

    Best Regards,
    Vinod Dalvi

  • be
    • WP Core Meltdown

    "Admin profile" fields.. Biography Avatar and some custom..fields we have added.

    Display on an "about me" page in each store.
    Store admin does not have access to these pages and all info to be displayed from profile.

    Was hoping to use Members directory as a shortcode for each site..but no response to any of those threads and need to move on this..

  • Vinod Dalvi
    • WP Unicorn

    Hi @be,

    We just need to display the profile data from their admin on their own site only on a page..

    You can display user profile data on a page by adding following custom code in page.php or custom page template file of your theme.

    <?php
        $current_user = wp_get_current_user();
        if ( 0 != $current_user->ID ) {
        echo 'Username: ' . $current_user->user_login . '<br />';
        echo 'User email: ' . $current_user->user_email . '<br />';
        echo 'User first name: ' . $current_user->user_firstname . '<br />';
        echo 'User last name: ' . $current_user->user_lastname . '<br />';
        echo 'User display name: ' . $current_user->display_name . '<br />';
        echo 'User ID: ' . $current_user->ID . '<br />';
     }
    ?>

    You can use any of the following WordPress functions which best suits your requirements to display user profile data.

    http://codex.wordpress.org/Function_Reference/wp_get_current_user
    http://codex.wordpress.org/Function_Reference/get_user_meta
    http://codex.wordpress.org/Function_Reference/get_currentuserinfo
    http://codex.wordpress.org/Function_Reference/get_userdata
    http://codex.wordpress.org/Function_Reference/get_user_by

    Regards,
    Vinod Dalvi

  • Vinod Dalvi
    • WP Unicorn

    Hi @be,

    Remove the "leave a reply" comment box.. from the page..

    Just deselect "Allow Comments." check box from Discussion meta box of the page as displayed in attached screenshot.

    Is there a place to find the actual naming conventions of profile fields..
    ie Avatar
    Biography etc..?

    I don't know exactly what you are trying to achieve but if you want to change profile fields label then you can do so by adding code as following in functions.php file of your child theme.

    add_action('admin_head-user-edit.php', 'setup_user_edit');
    
    function setup_user_edit() {
    
        add_filter('gettext', 'change_profile_labels');
    }
    
    function change_profile_labels($input) {
    
        if ('Nickname' == $input)
            return 'Nickname replacement';
    
        if ('Biographical Info' == $input)
            return 'Biographical Info replacement';
    
        return $input;
    }

    Regards,

  • be
    • WP Core Meltdown

    As above..
    Gridmarket theme - has no page option to turn off comments..

    using = page template for this "ABOUT ME" purpose only ie for this page on every site..using a custom page php

    Want to..
    1 - Remove - comment /leave a reply (via the page php)
    add avatar
    and biography info..

    2 So what is
    echo 'User display name: ' . $current_user->display_name
    thjs name for
    Biography and Avatar..

    3 and is there a list for the return values for profile fields..
    ie what each field is called so we can return them??

    thanks again

  • be
    • WP Core Meltdown

    Found them now last issue for this page..

    Custom page (one page only - ABOUT ME)

    In this page I want one line to be displayed in different text..
    What CSS do I need to add where for the custom php page.?

    ie: custom profile field $current_user->Tspec
    text to display on the custom page as

    italic and H3

  • be
    • WP Core Meltdown

    Custom page php template

    Can you see what I have put in the wrong place..
    and
    How can I make the line..containing
    Tsaying
    return as bold and italic.

    <?php get_header(); ?>
    
    <div id="content">
    	<?php if($bp_existed == 'true') : ?>
    	<?php do_action( 'bp_before_blog_page' ) ?>
    	<?php endif; ?>
    	<?php get_template_part( 'content', 'page' );?>
    	<div class="clear"></div>
    <?php
        $current_user = wp_get_current_user();
        if ( 0 != $current_user->ID ) {
    
    echo '    ' . $current_user->Tsaying  . '<br /><br />';
    
    echo get_avatar( get_the_author_meta); 
    
     echo 'Meet: ' . $current_user->display_name . '<br />';
    echo '    ' . $current_user->user_firstname . '<br />';
    echo 'Field of dedication: ' . $current_user->Tspec . '<br />';
    echo 'Currently teaching:    ' . $current_user->Tlevel . '<br />';
    echo 'Years in Education:    ' . $current_user->Tyears . '<br />';
    echo 'A little about me:    ' . $current_user->description  . '<br />';
     }
    ?>
    
    	<?php if($bp_existed == 'true') : ?>
    	<?php do_action( 'bp_after_blog_page' ) ?>
    	<?php endif; ?>
    
    </div>
    	<?php get_sidebar(); ?>
    <?php get_footer(); ?>
  • Vinod Dalvi
    • WP Unicorn

    Hi @be,

    In this page I want one line to be displayed in different text..
    What CSS do I need to add where for the custom php page.?

    ie: custom profile field $current_user->Tspec
    text to display on the custom page as

    italic and H3

    In the above code just replace the following code
    echo ' ' . $current_user->Tsaying . '<br /><br />';with this code
    echo ' <h3 class="custom-user-tsaying"> ' . $current_user->Tsaying . '</h3><br /><br />';
    And add the following CSS code in stylesheet file of your theme.

    #content .custom-user-tsaying{
    font-style: italic;
    }

    Kind Regards,

  • be
    • WP Core Meltdown

    ok I believe it is this that I have wrong..

    I need to display the Admin details of this site.. (one site on the custom page template - so the admin for each site)

    $current_user = wp_get_current_user();
        if ( 0 != $current_user->ID ) {

    Currently it is displaying the "current user"
    Please advise what it should get..

  • be
    • WP Core Meltdown

    Anyone on that can see the problem with the php..
    It is to display the blog owner or admin details on a custom page theme..
    However what it does is display the current logged in users details.
    So the get function is incorrect..
    Anyone know how to get "multisite - per blog owner/admin only details

    <?php get_header(); ?>
    <div id="content">
    <?php if($bp_existed == 'true') : ?>
    	<?php do_action( 'bp_before_blog_page' ) ?>
    	<?php endif; ?>
    <?php get_template_part( 'content', 'page' );?>
     <div class="clear"></div>
    	<?php
     $current_user = wp_get_current_user();
        if ( 0 != $current_user->ID )  { 
    
     echo '   <h3 class="custom-user-tsaying"> ' . $current_user->Tsaying  . '</h3><br />';
        echo get_avatar( get_the_author_meta); 
    
    echo 'Meet:    .' . $current_user->display_name . '<br />';
    echo '<b class="custom-user-tsaying" label for="user_firstname">' . __('Hi my name is:') . '</label></b>';
    echo ' ' . $current_user->user_firstname  . '<br />';
    
    echo '<b class="custom-user-tsaying" label for="Tlevel">' . __('I currently teach:') . '</label></b>';
    echo ' ' . $current_user->Tlevel . '<br />';
    
    echo '<b class="custom-user-tsaying" label for="Tyears">' . __('I have enjoyed the education field for:') . '</label></b>';
    echo ' ' . $current_user->Tyears . '<br />';
    
    echo '<b class="custom-user-tsaying" label for="Tspec">' . __('Mostly in the area of:') . '</label></b>';
    echo ' ' . $current_user->Tspec . '<br />';
    
    echo '<b class="custom-user-tsaying" label for="description">' . __('A little bit about me:') . '</label></b><br />';
    echo ' ' . $current_user->description . '<br />';
    
     }
    ?>
    
    <?php if($bp_existed == 'true') : ?>
    <?php do_action( 'bp_after_blog_page' ) ?>
    
    	<?php endif; ?>
    
    </div>
    	<?php get_sidebar(); ?>
    <?php get_footer(); ?>
  • be
    • WP Core Meltdown

    thanks however that returns a page of newsletter subscription and every other admin info on the page and returns no profile data for the echo statments

    deleted] => 0 ) [ID] => 1 [caps] => Array ( [administrator] => 1 ) [cap_key] => wpSA_26_capabilities [roles] => Array ( [0] => administrator ) [allcaps] => Array ( [activate_plugins] => 1 [add_members_group] => 1 [add_newsletter_member] => 1 [add_users] => 1 [change_new

  • Vinod Dalvi
    • WP Unicorn

    Hi @be,

    I am getting the following user profile data using the above code.

    WP_User Object
    (
        [data] => stdClass Object
            (
                [ID] => 1
                [user_login] => admin
                [user_pass] => $P$B7UsPSDDGDFGHJGH.
                [user_nicename] => xgfhgjhgjhg
                [user_email] => mozillavvd@gmail.com
                [user_url] =>
                [user_registered] => 2013-10-09 05:03:53
                [user_activation_key] =>
                [user_status] => 0
                [display_name] => Vinod Dalvi
                [spam] => 0
                [deleted] => 0
            )
    
        [ID] => 1
    .......

    Check the return values of get_userdata() function.

    You can also use the get_the_author_meta() function to get desired meta data for a user as displayed in the following code.

    <?php
    $admin_user = get_admin_users_for_domain();
    if( !empty($admin_user) ){
    	$admin_userdata = get_userdata( $admin_user[0]['ID'] );
    	print_r($admin_userdata);
    	$user_nicename = get_the_author_meta( 'user_nicename', $admin_user[0]['ID'] );
    	echo 'user_nicename '.$user_nicename;
    }
    ?>

    Regards,

  • be
    • WP Core Meltdown

    hi @Vinod Dalvi
    I am not sure we are on the same page here..

    We want only.

    The ADMIN profile fields (some are custom) returned for display on a custom page template for each site owner..on their own site..

    what I am achieving is getting the details of logged in users to display on each site aboutme page.. which is not the desired outcome..

    I cannot find the correct hook for the admin of the sub site for each multisite blog..

  • be
    • WP Core Meltdown

    Hi - as above - tested with varying "get functions
    None of which return the actual blog owner details as yet....
    This returns the last screen capture above info on the page
    and no avatar when there is one..

    <?php get_header(); ?>
    <div id="content">
    <?php if($bp_existed == 'true') : ?>
    	<?php do_action( 'bp_before_blog_page' ) ?>
    	<?php endif; ?>
    <?php get_template_part( 'content', 'page' );?>
     <div class="clear"></div>
    
    <?php
    $admin_user = get_admin_users_for_domain();
    if( !empty($admin_user) ){
    	$admin_userdata = get_userdata( $admin_user[0]['ID'] );
    	print_r($admin_userdata);
    	$user_nicename = get_the_author_meta( 'user_nicename', $admin_user[0]['ID'] );
    	echo 'user_nicename '.$user_nicename;
    
    	 echo '   <h3 class="custom-user-tsaying"> ' . $current_user->Tsaying  . '</h3>';
        echo get_avatar( get_the_author_meta); 
    
    echo 'Meet:    .' . $current_user->display_name . '';
    echo '<b class="custom-user-tsaying" label for="user_firstname">' . __('Hi my name is:') . '</label></b>';
    echo ' ' . $current_user->user_firstname  . '';
    
    echo '<b class="custom-user-tsaying" label for="Tlevel">' . __('I currently teach:') . '</label></b>';
    echo ' ' . $current_user->Tlevel . '';
    
    echo '<b class="custom-user-tsaying" label for="Tyears">' . __('I have enjoyed the education field for:') . '</label></b>';
    echo ' ' . $current_user->Tyears . '';
    
    echo '<b class="custom-user-tsaying" label for="Tspec">' . __('Mostly in the area of:') . '</label></b>';
    echo ' ' . $current_user->Tspec . '';
    
    echo '<b class="custom-user-tsaying" label for="description">' . __('A little bit about me:') . '</label></b>';
    echo ' ' . $current_user->description . '';
    
     }
    ?>
    
    <?php if($bp_existed == 'true') : ?>
    <?php do_action( 'bp_after_blog_page' ) ?>
    
    	<?php endif; ?>
    
    </div>
    	<?php get_sidebar(); ?>

    <?php get_footer(); ?>`

  • Vinod Dalvi
    • WP Unicorn

    Hi @be,

    From the code it seems you are still using old code and not new one.

    Instead of using $current_user->user_firstname you should use the code as following get_the_author_meta( 'user_firstname', $admin_user[0]['ID'] )

    Also make the same changes for all other fields.

    Regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.