1

I'm rather new to Wordpress and I've been looking around for an hour and a bit but cannot find what I'm looking for.

I want to add an "edit profile" button to the author page so the user can edit their personal information and I want to add a "blog post" button where the user can write their blog post, both through the front-end.

I appreciate any help with this thanks!

0

You can add a plugin to your site which provides this feature. It is called WP User Frontend.

0

Depending on your skills you should create a theme template for this. You have by far the most controll over what you want your users to edit.
You can use this template for the basics. Hope it helps:

<?php

global $user_ID, $user_identity, $user_level;

if ($user_ID) {

if($_POST) 

{

    $message = "Your profile updated successfully.";

    $first = $wpdb->escape($_POST['first_name']);

    $last = $wpdb->escape($_POST['last_name']);

    $email = $wpdb->escape($_POST['email']);

    $user_url = $wpdb->escape($_POST['website']);

    $description = $wpdb->escape($_POST['desc']);

    $password = $wpdb->escape($_POST['pwd']);

    $confirm_password = $wpdb->escape($_POST['confirm']);



    update_user_meta( $user_ID, 'first_name', $first );

    update_user_meta( $user_ID, 'last_name', $last );

    update_user_meta( $user_ID, 'description', $description );

    wp_update_user( array ('ID' => $user_ID, 'user_url' => $user_url) );



    if(isset($email)) {

        if (preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/", $email)){ 

            wp_update_user( array ('ID' => $user_ID, 'user_email' => $email) ) ;

        }

        else { $message = "<div id='error'>Please enter a valid email id.</div>"; }

    }

    if($password) {

        if (strlen($password) < 5 || strlen($password) > 15) {

            $message = "<div id='error'>Password must be 5 to 15 characters in length.</div>";

            }

        //elseif( $password == $confirm_password ) {

        elseif(isset($password) && $password != $confirm_password) {

            $message = "<div class='error'>Password Mismatch</div>";

        } elseif ( isset($password) && !empty($password) ) {

            $update = wp_set_password( $password, $user_ID );

            $message = "<div id='success'>Your profile updated successfully.</div>";

        }

    }



}

}

/*

Template Name: Your account

*/

if ($user_ID) {

$user_info = get_userdata($user_ID);

get_header();

?>

<div id="user-interact">

 <div class="indent">

  <div id="respond">

   <h1 class="margin">Edit your account</h1>

   <?php if($_POST) { 

    echo "<div id='result'><div class='message'>".$message."</div></div>";

}

?>

        <form action="" method="post">

        <label>First name:</label><br /><input type="text" name="first_name" class="text" value="<?php echo $user_info->first_name; ?>" maxlength="30" /> <br />

            <label>Last name:</label><br /><input type="text" name="last_name" class="text" value="<?php echo $user_info->last_name; ?>" maxlength="30" /> <br />

            <label>Email address:</label><br /><input type="text" name="email" class="text" value="<?php echo $user_info->user_email; ?>" maxlength="30" /><br />

            <label>Website:</label><br /><input type="text" name="website" class="text" value="<?php echo $user_info->user_url; ?>" maxlength="30" /> <br />

            <label>About yourself:</label><br /><textarea name="desc" class="text" rows="5"><?php echo $user_info->description; ?></textarea> <br />

            <label>Change password</label><br /><input type="password" name="pwd" class="text" maxlength="15" /> <br />

            <label>Retype password</label><br /><input type="password" name="confirm" class="text" maxlength="15" /><br />

            <span class="grey">If you would like to change the password type a new one. Otherwise leave this blank</span>

            <br /><br />

            <input type="submit" name="submit" value="Submit" id="submit" />



        </form>

  </div>

 </div>

</div>

<?php 

get_footer();

}

else { 

$redirect_to = get_bloginfo('url')."/login";//change this to your custom login url

wp_safe_redirect($redirect_to);

exit;   

}

?> 

Create a new PHP page and past this script.
Change this

/*

Template Name: Your account

*/

part to whatever your needs are and save the page to your server. Now you can select it while creating a new page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.