Add extra custom fields to user profiles based on user view
-
I got some code created by a third party developer to grab author_meta from the database and display it on a page when a certain code was entered. What was not done, was the adding of the same custom fields to all user profiles so these details can be adjusted from the backend in user profiles.
@ https://wpengineer.com/2173/custom-fields-wordpress-user-profile/ I found a relatively easy way to add a custom field and store it. Now I need to add the author meta added in the profile view page to all pages. Here is the profile view viewprofile.php file as created by dev:<?php if(empty($_REQUEST['enterCodeId'])){ echo "<script> location.replace('".$_SERVER['HTTP_REFERER']."'); </script>"; }else{ $getId=substr($_REQUEST['enterCodeId'], 4, 10); $querystr ="SELECT ID FROM wp_7d8ftw_users WHERE ID='".$getId."'"; $querystrChecking = mysql_query($querystr); if(mysql_num_rows($querystrChecking)<=0){ echo "<script> location.replace('".$_SERVER['HTTP_REFERER']."'); </script>"; } $uploads = wp_upload_dir(); // } ?> <?php get_header(); ?> <div id="wrapper2nd" class="inner"> <div class="content" id="inner"> <h1>PROFILE</h1> <div id="profileView"> <div class="alignLeft"> <strong> Name:</strong> <?php the_author_meta( 'first_name', $getId ); ?> <?php the_author_meta( 'last_name', $getId); ?><br /> <strong> Nick Name:</strong> <?php the_author_meta( 'nickname', $getId ); ?><br /> <strong>Age:</strong><?php echo date("Y")-date("Y",get_the_author_meta( 'dateofbirth', $getId ));?><br /> <strong>Birthday: </strong> <?=date("D M Y",get_the_author_meta( 'dateofbirth', $getId ));?><br /> <strong>Birthplace:</strong> <?=get_the_author_meta( 'birthplace', $getId );?><br /> <strong>Current City:</strong> <?=get_the_author_meta( 'currentcity', $getId );?> <br /> <strong>Favourite Colour:</strong> <?=get_the_author_meta( 'favouritecolour', $getId );?> <br /> <strong>Favourite Book:</strong> <?=get_the_author_meta( 'favouritebook', $getId );?><br /> <strong>Favourite Film:</strong> <?=get_the_author_meta( 'favouritefilm', $getId );?><br /> <strong>Favourite Restaurant: </strong> <?=get_the_author_meta( 'favouriterestaurant', $getId );?><br /> <strong>Favourite Quote:</strong> <?=get_the_author_meta( 'favouritequote', $getId );?><br /> <strong>Favourite Quality in Women: </strong> <?=get_the_author_meta( 'favouritequalityinwomen', $getId );?> <br /> <strong>My Favourite TV programs: </strong><br /> <?=get_the_author_meta( 'myfavouritetvprograms', $getId );?><br /> <strong>My Favourite Groups:</strong><br /> <?=get_the_author_meta( 'myfavouritegroups', $getId );?><br /> <strong>My Favourite Links:</strong><br /> <?=get_the_author_meta( 'myfavouritelinks', $getId );?> </div> <div class="alignRight"> <div class="left"><i>About Me:</i> <p> <?=the_author_meta( 'description', $getId); ?></p> </div> <div class="right"> <?php if(get_the_author_meta( 'userphoto_thumb_file', $getId )!=""){?> <img src="<?=$uploads['baseurl'];?>/thumbs/<?=get_the_author_meta( 'userphoto_thumb_file', $getId );?>" /> <?php }?> <a href="#" class="allpic">see all pictures</a> </div> <div class="clr"></div> <div class="contact"><strong>Contact information:</strong> [email protected]</div> </div> <div class="clr"></div> </div> </div> </div> <?php if ( is_active_sidebar('inner')): ?> <div id="wrapper3rd"> <div id="innerSidebarContent"> <?php dynamic_sidebar( 'inner' ); ?> </div> </div> <?php endif; // end sidebar widget area ?> <?php get_footer(); ?>
A visitor that enters the correct code will see this profile
Can anyone tell me how I can add the same author_meta in profile_view as custom fields to all profile pages so they can be adjusted from the Dashboard under user profiles?
- The topic ‘Add extra custom fields to user profiles based on user view’ is closed to new replies.