رفتن به مطلب

گذاشتن مطلب در پروفایل کاربر


پست های پیشنهاد شده

سلام.

میخوام توی پروفایل کاربران یک فیلد اضافی بزارم و به عنوان مدیر برای هرکابر یک مطلب توش بنویسیم.

فقط میخوام گزینه های زیر رو داشته باشه:

1: مطلبی که مینویسیم قابلیت گذاشتن تصویر و ... رو داشته باشه.

2: کاربر نتونه ویرایشش کنه. فقط ببینه توی پروفایلش.

افزونه یا کدی هست؟؟

تشکر

لینک به ارسال

دوست عزیز فکر کنم کد زیر با کمی تغییر به درد شما بخوره


function fb_add_custom_user_profile_fields( $user ) {
?>
<h3><?php _e('Extra Profile Information', 'your_textdomain'); ?></h3>
<table class="form-table">
<tr>
<th>
<label for="address"><?php _e('Address', 'your_textdomain'); ?>
</label></th>
<td>
<input type="text" name="address" id="address" value="<?php echo esc_attr( get_the_author_meta( 'address', $user->ID ) ); ?>" class="regular-text" /><br />
<span class="description"><?php _e('Please enter your address.', 'your_textdomain'); ?></span>
</td>
</tr>
</table>
<?php }
function fb_save_custom_user_profile_fields( $user_id ) {
if ( !current_user_can( 'edit_user', $user_id ) )
return FALSE;
update_usermeta( $user_id, 'address', $_POST['address'] );
}
add_action( 'show_user_profile', 'fb_add_custom_user_profile_fields' );
add_action( 'edit_user_profile', 'fb_add_custom_user_profile_fields' );
add_action( 'personal_options_update', 'fb_save_custom_user_profile_fields' );
add_action( 'edit_user_profile_update', 'fb_save_custom_user_profile_fields'

این کد رو فانشن قالب کپی کنید

ویرایش شده توسط mamadspeed
لینک به ارسال

لطفا برای ارسال دیدگاه وارد شوید

شما بعد از اینکه وارد حساب کاربری خود شدید می توانید دیدگاهی ارسال کنید



ورود به حساب کاربری
×
×
  • اضافه کردن...