initial commit
This commit is contained in:
@ -0,0 +1,312 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: Custom User Profile Photo
|
||||
Plugin URI: http://vincentlistrani.com
|
||||
Description: A simple and effective custom WordPress user profile photo plugin. This plugin leverages the WordPress
|
||||
Media Uploader functionality. To use this plugin go to the users tab and select a user. The new field can be found
|
||||
below the password fields for that user.
|
||||
Author: VincentListrani
|
||||
Author URI: http://vincentlistrani.com
|
||||
Text Domain: custom-user-profile-photo
|
||||
Domain Path: /languages/
|
||||
Version: 0.5.3
|
||||
*/
|
||||
|
||||
/**
|
||||
* This program has been developed for use with the WordPress Software.
|
||||
*
|
||||
* It is distributed as free software with the intent that it will be
|
||||
* useful and does not ship with any WARRANTY.
|
||||
*
|
||||
* USAGE
|
||||
* // Default:
|
||||
* This will override the WordPress get_avatar hook
|
||||
*
|
||||
* // Custom placement:
|
||||
* <?php $imgURL = get_cupp_meta( $user_id, $size ); ?>
|
||||
* or
|
||||
* <img src="<?php echo get_cupp_meta( $user_id, $size ); ?>">
|
||||
*
|
||||
* Beginner WordPress template editing skill required. Place the above tag in your template and provide the two
|
||||
* parameters.
|
||||
*
|
||||
* @param WP_User|int $user_id Default: $post->post_author. Will accept any valid user ID passed into this parameter.
|
||||
* @param string $size Default: 'thumbnail'. Accepts all default WordPress sizes and any custom sizes made by
|
||||
* the add_image_size() function.
|
||||
*
|
||||
* @return {url} Use this inside the src attribute of an image tag or where you need to call the image url.
|
||||
*
|
||||
* Inquiries, suggestions and feedback can be sent to support@3five.com
|
||||
*
|
||||
* This is plugin is intended for Author, Editor and Admin role post/page authors. Thank you for downloading our
|
||||
* plugin.
|
||||
*
|
||||
* We hope this WordPress plugin meets your needs.
|
||||
*
|
||||
* Happy coding!
|
||||
* - 3five
|
||||
*
|
||||
* Resources:
|
||||
* • Steven Slack - http://s2web.staging.wpengine.com/226/
|
||||
* • Pippin Williamson - https://gist.github.com/pippinsplugins/29bebb740e09e395dc06
|
||||
* • Mike Jolley - https://gist.github.com/mikejolley/3a3b366cb62661727263#file-gistfile1-php
|
||||
*/
|
||||
|
||||
/**
|
||||
* Load Translations.
|
||||
*/
|
||||
function cupp_load_plugin_textdomain() {
|
||||
load_plugin_textdomain( 'custom-user-profile-photo', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
|
||||
}
|
||||
|
||||
add_action( 'init', 'cupp_load_plugin_textdomain' );
|
||||
|
||||
/**
|
||||
* Enqueue scripts and styles
|
||||
*/
|
||||
function cupp_enqueue_scripts_styles() {
|
||||
// Register.
|
||||
wp_register_style( 'cupp_admin_css', plugins_url( 'custom-user-profile-photo/css/styles.css' ), false, '1.0.0', 'all' );
|
||||
wp_register_script( 'cupp_admin_js', plugins_url( 'custom-user-profile-photo/js/scripts.js' ), array( 'jquery' ), '1.0.0', true );
|
||||
|
||||
// Enqueue.
|
||||
wp_enqueue_style( 'cupp_admin_css' );
|
||||
wp_enqueue_script( 'cupp_admin_js' );
|
||||
}
|
||||
|
||||
add_action( 'admin_enqueue_scripts', 'cupp_enqueue_scripts_styles' );
|
||||
|
||||
|
||||
/**
|
||||
* Show the new image field in the user profile page.
|
||||
*
|
||||
* @param object $user User object.
|
||||
*/
|
||||
function cupp_profile_img_fields( $user ) {
|
||||
if ( ! current_user_can( 'upload_files' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// vars
|
||||
$url = get_the_author_meta( 'cupp_meta', $user->ID );
|
||||
$upload_url = get_the_author_meta( 'cupp_upload_meta', $user->ID );
|
||||
$upload_edit_url = get_the_author_meta( 'cupp_upload_edit_meta', $user->ID );
|
||||
$button_text = $upload_url ? 'Change Current Image' : 'Upload New Image';
|
||||
|
||||
if ( $upload_url ) {
|
||||
$upload_edit_url = get_site_url() . $upload_edit_url;
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="cupp_container">
|
||||
<h3><?php _e( 'Custom User Profile Photo', 'custom-user-profile-photo' ); ?></h3>
|
||||
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th><label for="cupp_meta"><?php _e( 'Profile Photo', 'custom-user-profile-photo' ); ?></label></th>
|
||||
<td>
|
||||
<!-- Outputs the image after save -->
|
||||
<div id="current_img">
|
||||
<?php if ( $upload_url ): ?>
|
||||
<img class="cupp-current-img" src="<?php echo esc_url( $upload_url ); ?>"/>
|
||||
|
||||
<div class="edit_options uploaded">
|
||||
<a class="remove_img">
|
||||
<span><?php _e( 'Remove', 'custom-user-profile-photo' ); ?></span>
|
||||
</a>
|
||||
|
||||
<a class="edit_img" href="<?php echo esc_url( $upload_edit_url ); ?>" target="_blank">
|
||||
<span><?php _e( 'Edit', 'custom-user-profile-photo' ); ?></span>
|
||||
</a>
|
||||
</div>
|
||||
<?php elseif ( $url ) : ?>
|
||||
<img class="cupp-current-img" src="<?php echo esc_url( $url ); ?>"/>
|
||||
<div class="edit_options single">
|
||||
<a class="remove_img">
|
||||
<span><?php _e( 'Remove', 'custom-user-profile-photo' ); ?></span>
|
||||
</a>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<img class="cupp-current-img placeholder"
|
||||
src="<?php echo esc_url( plugins_url( 'custom-user-profile-photo/img/placeholder.gif' ) ); ?>"/>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- Select an option: Upload to WPMU or External URL -->
|
||||
<div id="cupp_options">
|
||||
<input type="radio" id="upload_option" name="img_option" value="upload" class="tog" checked>
|
||||
<label
|
||||
for="upload_option"><?php _e( 'Upload New Image', 'custom-user-profile-photo' ); ?></label><br>
|
||||
|
||||
<input type="radio" id="external_option" name="img_option" value="external" class="tog">
|
||||
<label
|
||||
for="external_option"><?php _e( 'Use External URL', 'custom-user-profile-photo' ); ?></label><br>
|
||||
</div>
|
||||
|
||||
<!-- Hold the value here if this is a WPMU image -->
|
||||
<div id="cupp_upload">
|
||||
<input class="hidden" type="hidden" name="cupp_placeholder_meta" id="cupp_placeholder_meta"
|
||||
value="<?php echo esc_url( plugins_url( 'custom-user-profile-photo/img/placeholder.gif' ) ); ?>"/>
|
||||
<input class="hidden" type="hidden" name="cupp_upload_meta" id="cupp_upload_meta"
|
||||
value="<?php echo esc_url_raw( $upload_url ); ?>"/>
|
||||
<input class="hidden" type="hidden" name="cupp_upload_edit_meta" id="cupp_upload_edit_meta"
|
||||
value="<?php echo esc_url_raw( $upload_edit_url ); ?>"/>
|
||||
<input id="uploadimage" type='button' class="cupp_wpmu_button button-primary"
|
||||
value="<?php _e( esc_attr( $button_text ), 'custom-user-profile-photo' ); ?>"/>
|
||||
<br/>
|
||||
</div>
|
||||
|
||||
<!-- Outputs the text field and displays the URL of the image retrieved by the media uploader -->
|
||||
<div id="cupp_external">
|
||||
<input class="regular-text" type="text" name="cupp_meta" id="cupp_meta"
|
||||
value="<?php echo esc_url_raw( $url ); ?>"/>
|
||||
</div>
|
||||
|
||||
<!-- Outputs the save button -->
|
||||
<span class="description">
|
||||
<?php
|
||||
_e(
|
||||
'Upload a custom photo for your user profile or use a URL to a pre-existing photo.',
|
||||
'custom-user-profile-photo'
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
<p class="description">
|
||||
<?php _e( 'Update Profile to save your changes.', 'custom-user-profile-photo' ); ?>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table><!-- end form-table -->
|
||||
</div> <!-- end #cupp_container -->
|
||||
|
||||
<?php
|
||||
// Enqueue the WordPress Media Uploader.
|
||||
wp_enqueue_media();
|
||||
}
|
||||
|
||||
add_action( 'show_user_profile', 'cupp_profile_img_fields' );
|
||||
add_action( 'edit_user_profile', 'cupp_profile_img_fields' );
|
||||
|
||||
|
||||
/**
|
||||
* Save the new user CUPP url.
|
||||
*
|
||||
* @param int $user_id ID of the user's profile being saved.
|
||||
*/
|
||||
function cupp_save_img_meta( $user_id ) {
|
||||
if ( ! current_user_can( 'upload_files', $user_id ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$values = array(
|
||||
// String value. Empty in this case.
|
||||
'cupp_meta' => filter_input( INPUT_POST, 'cupp_meta', FILTER_SANITIZE_STRING ),
|
||||
|
||||
// File path, e.g., http://3five.dev/wp-content/plugins/custom-user-profile-photo/img/placeholder.gif.
|
||||
'cupp_upload_meta' => filter_input( INPUT_POST, 'cupp_upload_meta', FILTER_SANITIZE_URL ),
|
||||
|
||||
// Edit path, e.g., /wp-admin/post.php?post=32&action=edit&image-editor.
|
||||
'cupp_upload_edit_meta' => filter_input( INPUT_POST, 'cupp_upload_edit_meta', FILTER_SANITIZE_URL ),
|
||||
);
|
||||
|
||||
foreach ( $values as $key => $value ) {
|
||||
update_user_meta( $user_id, $key, $value );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'personal_options_update', 'cupp_save_img_meta' );
|
||||
add_action( 'edit_user_profile_update', 'cupp_save_img_meta' );
|
||||
|
||||
/**
|
||||
* Retrieve the appropriate image size
|
||||
*
|
||||
* @param int $user_id Default: $post->post_author. Will accept any valid user ID passed into this parameter.
|
||||
* @param string $size Default: 'thumbnail'. Accepts all default WordPress sizes and any custom sizes made by
|
||||
* the add_image_size() function.
|
||||
*
|
||||
* @return string (Url) Use this inside the src attribute of an image tag or where you need to call the image url.
|
||||
*/
|
||||
function get_cupp_meta( $user_id, $size = 'thumbnail' ) {
|
||||
global $post;
|
||||
|
||||
if ( ! $user_id || ! is_numeric( $user_id ) ) {
|
||||
/*
|
||||
* Here we're assuming that the avatar being called is the author of the post.
|
||||
* The theory is that when a number is not supplied, this function is being used to
|
||||
* get the avatar of a post author using get_avatar() and an email address is supplied
|
||||
* for the $id_or_email parameter. We need an integer to get the custom image so we force that here.
|
||||
* Also, many themes use get_avatar on the single post pages and pass it the author email address so this
|
||||
* acts as a fall back.
|
||||
*/
|
||||
$user_id = $post->post_author;
|
||||
}
|
||||
|
||||
// Check first for a custom uploaded image.
|
||||
$attachment_upload_url = esc_url( get_the_author_meta( 'cupp_upload_meta', $user_id ) );
|
||||
|
||||
if ( $attachment_upload_url ) {
|
||||
// Grabs the id from the URL using the WordPress function attachment_url_to_postid @since 4.0.0.
|
||||
$attachment_id = attachment_url_to_postid( $attachment_upload_url );
|
||||
|
||||
// Retrieve the thumbnail size of our image. Should return an array with first index value containing the URL.
|
||||
$image_thumb = wp_get_attachment_image_src( $attachment_id, $size );
|
||||
|
||||
return isset( $image_thumb[0] ) ? $image_thumb[0] : '';
|
||||
}
|
||||
|
||||
// Finally, check for image from an external URL. If none exists, return an empty string.
|
||||
$attachment_ext_url = esc_url( get_the_author_meta( 'cupp_meta', $user_id ) );
|
||||
|
||||
return $attachment_ext_url ? $attachment_ext_url : '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* WordPress Avatar Filter
|
||||
*
|
||||
* Replaces the WordPress avatar with your custom photo using the get_avatar hook.
|
||||
*
|
||||
* @param string $avatar Image tag for the user's avatar.
|
||||
* @param int|object|string $identifier User object, UD or email address.
|
||||
* @param string $size Image size.
|
||||
* @param string $alt Alt text for the image tag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function cupp_avatar( $avatar, $identifier, $size, $alt ) {
|
||||
if ( $user = cupp_get_user_by_id_or_email( $identifier ) ) {
|
||||
if ( $custom_avatar = get_cupp_meta( $user->ID, 'thumbnail' ) ) {
|
||||
return "<img alt='{$alt}' src='{$custom_avatar}' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' />";
|
||||
}
|
||||
}
|
||||
|
||||
return $avatar;
|
||||
}
|
||||
|
||||
add_filter( 'get_avatar', 'cupp_avatar', 1, 5 );
|
||||
|
||||
/**
|
||||
* Get a WordPress User by ID or email
|
||||
*
|
||||
* @param int|object|string $identifier User object, ID or email address.
|
||||
*
|
||||
* @return WP_User
|
||||
*/
|
||||
function cupp_get_user_by_id_or_email( $identifier ) {
|
||||
// If an integer is passed.
|
||||
if ( is_numeric( $identifier ) ) {
|
||||
return get_user_by( 'id', (int) $identifier );
|
||||
}
|
||||
|
||||
// If the WP_User object is passed.
|
||||
if ( is_object( $identifier ) && property_exists( $identifier, 'ID' ) ) {
|
||||
return get_user_by( 'id', (int) $identifier->ID );
|
||||
}
|
||||
|
||||
// If the WP_Comment object is passed.
|
||||
if ( is_object( $identifier ) && property_exists( $identifier, 'user_id' ) ) {
|
||||
return get_user_by( 'id', (int) $identifier->user_id );
|
||||
}
|
||||
|
||||
return get_user_by( 'email', $identifier );
|
||||
}
|
@ -0,0 +1,110 @@
|
||||
/*
|
||||
Title: 3five Admin CUPP Styles
|
||||
Author: Vincent Listrani
|
||||
Description: Styles for WP Admin user page.
|
||||
*/
|
||||
#cupp_container* {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#cupp_container{
|
||||
background: #fcfcfc;
|
||||
padding: 10px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
/* Current Profile Image Styles */
|
||||
#current_img{
|
||||
position: relative;
|
||||
width: 160px;
|
||||
height: auto;
|
||||
text-align: right;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.cupp-current-img{
|
||||
display: block;
|
||||
max-width: 150px;
|
||||
max-height: 150px;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
padding: 4px;
|
||||
background: #fefefe;
|
||||
border: 1px solid #e5e5e5;
|
||||
}
|
||||
|
||||
.cupp-current-img.placeholder{
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.edit_options{
|
||||
display: block;
|
||||
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
|
||||
filter: alpha(opacity=0);
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
max-width: 160px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #fff;
|
||||
background-color: rgba(255, 255, 255, 0.25);
|
||||
}
|
||||
.edit_options .remove_img, .edit_options .edit_img{
|
||||
float: left;
|
||||
position: relative;
|
||||
color: #444;
|
||||
font-size: 13px;
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
}
|
||||
.edit_options span{
|
||||
display: block;
|
||||
position: relative;
|
||||
top: 50%;
|
||||
margin-top: -10px;
|
||||
}
|
||||
|
||||
.edit_options .remove_img{
|
||||
color: #fff;
|
||||
background-color: rgb(214, 14, 14);
|
||||
background-color: rgba(214, 14, 14, 0.50);
|
||||
}
|
||||
|
||||
.edit_options.single .remove_img{
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.edit_options .remove_img:hover, .edit_options .remove_img:focus{
|
||||
background-color: #ff0000;
|
||||
background-color: rgba(214, 14, 14, 0.75);
|
||||
}
|
||||
|
||||
.edit_options .edit_img{
|
||||
color: #fff;
|
||||
background-color: rgb(50, 50, 50);
|
||||
background-color: rgba(50, 50, 50, 0.50);
|
||||
}
|
||||
|
||||
.edit_options .edit_img:hover, .edit_options .edit_img:focus{
|
||||
background-color: rgb(25, 25, 25);
|
||||
background-color: rgba(50, 50, 50, 0.75);
|
||||
}
|
||||
|
||||
/* Radio Button Styles */
|
||||
#cupp_options{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#cupp_external{
|
||||
display: none;
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 42 B |
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Adapted from: http://mikejolley.com/2012/12/using-the-new-wordpress-3-5-media-uploader-in-plugins/
|
||||
* Further modified from PippinsPlugins https://gist.github.com/pippinsplugins/29bebb740e09e395dc06
|
||||
*/
|
||||
jQuery(document).ready(function($){
|
||||
// Uploading files
|
||||
var file_frame;
|
||||
|
||||
jQuery('.cupp_wpmu_button').on('click', function( event ){
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
// If the media frame already exists, reopen it.
|
||||
if ( file_frame ) {
|
||||
file_frame.open();
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the media frame.
|
||||
file_frame = wp.media.frames.file_frame = wp.media({
|
||||
title: jQuery( this ).data( 'uploader_title' ),
|
||||
button: {
|
||||
text: jQuery( this ).data( 'uploader_button_text' ),
|
||||
},
|
||||
multiple: false // Set to true to allow multiple files to be selected
|
||||
});
|
||||
|
||||
// When an image is selected, run a callback.
|
||||
file_frame.on( 'select', function() {
|
||||
// We set multiple to false so only get one image from the uploader
|
||||
attachment = file_frame.state().get('selection').first().toJSON();
|
||||
|
||||
// Do something with attachment.id and/or attachment.url here
|
||||
// write the selected image url to the value of the #cupp_meta text field
|
||||
jQuery('#cupp_meta').val('');
|
||||
jQuery('#cupp_upload_meta').val(attachment.url);
|
||||
jQuery('#cupp_upload_edit_meta').val('/wp-admin/post.php?post='+attachment.id+'&action=edit&image-editor');
|
||||
jQuery('.cupp-current-img').attr('src', attachment.url).removeClass('placeholder');
|
||||
});
|
||||
|
||||
// Finally, open the modal
|
||||
file_frame.open();
|
||||
});
|
||||
|
||||
// Toggle Image Type
|
||||
jQuery('input[name=img_option]').on('click', function( event ){
|
||||
var imgOption = jQuery(this).val();
|
||||
|
||||
if (imgOption == 'external'){
|
||||
jQuery('#cupp_upload').hide();
|
||||
jQuery('#cupp_external').show();
|
||||
} else if (imgOption == 'upload'){
|
||||
jQuery('#cupp_external').hide();
|
||||
jQuery('#cupp_upload').show();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if ( '' !== jQuery('#cupp_meta').val() ) {
|
||||
jQuery('#external_option').attr('checked', 'checked');
|
||||
jQuery('#cupp_external').show();
|
||||
jQuery('#cupp_upload').hide();
|
||||
} else {
|
||||
jQuery('#upload_option').attr('checked', 'checked');
|
||||
}
|
||||
|
||||
// Update hidden field meta when external option url is entered
|
||||
jQuery('#cupp_meta').blur(function(event) {
|
||||
if( '' !== $(this).val() ) {
|
||||
jQuery('#cupp_upload_meta').val('');
|
||||
jQuery('.cupp-current-img').attr('src', $(this).val()).removeClass('placeholder');
|
||||
}
|
||||
});
|
||||
|
||||
// Remove Image Function
|
||||
jQuery('.edit_options').hover(function(){
|
||||
jQuery(this).stop(true, true).animate({opacity: 1}, 100);
|
||||
}, function(){
|
||||
jQuery(this).stop(true, true).animate({opacity: 0}, 100);
|
||||
});
|
||||
|
||||
jQuery('.remove_img').on('click', function( event ){
|
||||
var placeholder = jQuery('#cupp_placeholder_meta').val();
|
||||
|
||||
jQuery(this).parent().fadeOut('fast', function(){
|
||||
jQuery(this).remove();
|
||||
jQuery('.cupp-current-img').addClass('placeholder').attr('src', placeholder);
|
||||
});
|
||||
jQuery('#cupp_upload_meta, #cupp_upload_edit_meta, #cupp_meta').val('');
|
||||
});
|
||||
|
||||
});
|
Binary file not shown.
@ -0,0 +1,64 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Custom User Profile Photo\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: Thu Jan 22 2015 15:00:48 GMT+0100 (CET)\n"
|
||||
"PO-Revision-Date: 2015-11-26 00:04+0100\n"
|
||||
"Language-Team: \n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
"X-Poedit-Basepath: .\n"
|
||||
"X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3;"
|
||||
"__:1;_e:1;_c:1;_n:1,2;_n_noop:1,2;_nc:1,2;__ngettext:1,2;"
|
||||
"__ngettext_noop:1,2;_x:1,2c;_ex:1,2c;_nx:1,2,4c;_nx_noop:1,2,3c;_n_js:1,2;"
|
||||
"_nx_js:1,2,3c;esc_attr__:1;esc_html__:1;esc_attr_e:1;esc_html_e:1;"
|
||||
"esc_attr_x:1,2c;esc_html_x:1,2c;comments_number_link:2,3;t:1;st:1;trans:1;"
|
||||
"transChoice:1,2\n"
|
||||
"X-Loco-Target-Locale: nl_NL\n"
|
||||
"X-Generator: Poedit 1.8.6\n"
|
||||
"Last-Translator: David <david@closemarketing.es>\n"
|
||||
"Language: es\n"
|
||||
"X-Poedit-SearchPath-0: ../../plugins/custom-user-profile-photo\n"
|
||||
|
||||
#: ../3five_cupp.php:80 ../3five_cupp.php:114
|
||||
msgid "Upload New Image"
|
||||
msgstr "Cargar una nueva imagen"
|
||||
|
||||
#: ../3five_cupp.php:83
|
||||
msgid "Change Current Image"
|
||||
msgstr "Cambiar la imagen actual"
|
||||
|
||||
#: ../3five_cupp.php:88
|
||||
msgid "Custom User Profile Photo"
|
||||
msgstr "Foto de Perfil de usuario personalizado"
|
||||
|
||||
#: ../3five_cupp.php:93
|
||||
msgid "Profile Photo"
|
||||
msgstr "Foto del perfil"
|
||||
|
||||
#: ../3five_cupp.php:100 ../3five_cupp.php:106
|
||||
msgid "Remove"
|
||||
msgstr "Quitar"
|
||||
|
||||
#: ../3five_cupp.php:101
|
||||
msgid "Edit"
|
||||
msgstr "Editar"
|
||||
|
||||
#: ../3five_cupp.php:116
|
||||
msgid "Use External URL"
|
||||
msgstr "Utilizar URL externa"
|
||||
|
||||
#: ../3five_cupp.php:130
|
||||
msgid ""
|
||||
"Upload a custom photo for your user profile or use a URL to a pre-existing "
|
||||
"photo."
|
||||
msgstr ""
|
||||
"Añadir una foto personalizada para tu perfil de usuario o utilizar una "
|
||||
"dirección URL a una foto ya existente."
|
||||
|
||||
#: ../3five_cupp.php:131
|
||||
msgid "Update Profile to save your changes."
|
||||
msgstr "Actualizar el perfil para guardar los cambios."
|
Binary file not shown.
@ -0,0 +1,58 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Custom User Profile Photo\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-04-01 17:18:55\n"
|
||||
"PO-Revision-Date: 2015-09-25 10:34-0600\n"
|
||||
"Last-Translator: Vincent Listrani <vincent@3five.com>\n"
|
||||
"Language-Team: MediaMulti.Network <info@mediamulti.net>\n"
|
||||
"Language: hu_HU\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
"X-Poedit-Basepath: .\n"
|
||||
"X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3\n"
|
||||
"X-Generator: Poedit 1.5.7\n"
|
||||
"X-Poedit-SearchPath-0: ../../plugins/custom-user-profile-photo\n"
|
||||
|
||||
#: ../3five_cupp.php:80 ../3five_cupp.php:114
|
||||
msgid "Upload New Image"
|
||||
msgstr "Új fotó feltöltése"
|
||||
|
||||
#: ../3five_cupp.php:83
|
||||
msgid "Change Current Image"
|
||||
msgstr "Aktuális kép megváltoztatása"
|
||||
|
||||
#: ../3five_cupp.php:88
|
||||
msgid "Custom User Profile Photo"
|
||||
msgstr "Egyedi profil fotó"
|
||||
|
||||
#: ../3five_cupp.php:93
|
||||
msgid "Profile Photo"
|
||||
msgstr "Profil fotó"
|
||||
|
||||
#: ../3five_cupp.php:100 ../3five_cupp.php:106
|
||||
msgid "Remove"
|
||||
msgstr "Eltávolítás"
|
||||
|
||||
#: ../3five_cupp.php:101
|
||||
msgid "Edit"
|
||||
msgstr "Szerkesztés"
|
||||
|
||||
#: ../3five_cupp.php:116
|
||||
msgid "Use External URL"
|
||||
msgstr "Külső link használata"
|
||||
|
||||
#: ../3five_cupp.php:130
|
||||
msgid ""
|
||||
"Upload a custom photo for your user profile or use a URL to a pre-existing "
|
||||
"photo."
|
||||
msgstr ""
|
||||
"Töltsön fel egyedi profilfotót, vagy használjon egy interneten meglévőt URL "
|
||||
"megadásával."
|
||||
|
||||
#: ../3five_cupp.php:131
|
||||
msgid "Update Profile to save your changes."
|
||||
msgstr "A változtatások elmentéséhez nyomjon a Mentés gombra."
|
Binary file not shown.
@ -0,0 +1,61 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Custom User Profile Photo\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: Thu Jan 22 2015 15:00:48 GMT+0100 (CET)\n"
|
||||
"PO-Revision-Date: Thu Jan 22 2015 15:14:05 GMT+0100 (CET)\n"
|
||||
"Last-Translator: prcadmin <im@olaflederer.com>\n"
|
||||
"Language-Team: \n"
|
||||
"Language: Dutch\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
"X-Poedit-Basepath: .\n"
|
||||
"X-Poedit-SearchPath-0: ../../plugins/custom-user-profile-photo\n"
|
||||
"X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3;"
|
||||
"__:1;_e:1;_c:1;_n:1,2;_n_noop:1,2;_nc:1,2;__ngettext:1,2;__ngettext_noop:1,2;"
|
||||
"_x:1,2c;_ex:1,2c;_nx:1,2,4c;_nx_noop:1,2,3c;_n_js:1,2;_nx_js:1,2,3c;"
|
||||
"esc_attr__:1;esc_html__:1;esc_attr_e:1;esc_html_e:1;esc_attr_x:1,2c;"
|
||||
"esc_html_x:1,2c;comments_number_link:2,3;t:1;st:1;trans:1;transChoice:1,2\n"
|
||||
"X-Loco-Target-Locale: nl_NL\n"
|
||||
"X-Generator: Loco - https://localise.biz/"
|
||||
|
||||
#: ../3five_cupp.php:80 ../3five_cupp.php:114
|
||||
msgid "Upload New Image"
|
||||
msgstr "Upload een nieuwe foto"
|
||||
|
||||
#: ../3five_cupp.php:83
|
||||
msgid "Change Current Image"
|
||||
msgstr "Wijzig huidig foto"
|
||||
|
||||
#: ../3five_cupp.php:88
|
||||
msgid "Custom User Profile Photo"
|
||||
msgstr "Kies/upload je foto."
|
||||
|
||||
#: ../3five_cupp.php:93
|
||||
msgid "Profile Photo"
|
||||
msgstr "Profiel foto"
|
||||
|
||||
#: ../3five_cupp.php:100 ../3five_cupp.php:106
|
||||
msgid "Remove"
|
||||
msgstr "Verwijderen"
|
||||
|
||||
#: ../3five_cupp.php:101
|
||||
msgid "Edit"
|
||||
msgstr "Wijzigen"
|
||||
|
||||
#: ../3five_cupp.php:116
|
||||
msgid "Use External URL"
|
||||
msgstr "Gebruik foto link/URL"
|
||||
|
||||
#: ../3five_cupp.php:130
|
||||
msgid ""
|
||||
"Upload a custom photo for your user profile or use a URL to a pre-existing "
|
||||
"photo."
|
||||
msgstr "Upload een nieuw foto of kies er een foto uit de media bibliotheek."
|
||||
|
||||
#: ../3five_cupp.php:131
|
||||
msgid "Update Profile to save your changes."
|
||||
msgstr "Klik \"Profiel bijwerken\" om de wijziging te bevestigen."
|
@ -0,0 +1,53 @@
|
||||
# Copyright (C) 2016 Custom User Profile Photo
|
||||
# This file is distributed under the same license as the Custom User Profile Photo package.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Custom User Profile Photo 0.4\n"
|
||||
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/custom-user-"
|
||||
"profile-photo\n"
|
||||
"POT-Creation-Date: 2016-08-17 21:05:46+00:00\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
||||
#. #-#-#-#-# plugin.pot (Custom User Profile Photo 0.4) #-#-#-#-#
|
||||
#. Plugin Name of the plugin/theme
|
||||
#: 3five_cupp.php:83
|
||||
msgid "Custom User Profile Photo"
|
||||
msgstr ""
|
||||
|
||||
#: 3five_cupp.php:88
|
||||
msgid "Profile Photo"
|
||||
msgstr ""
|
||||
|
||||
#: 3five_cupp.php:128
|
||||
msgid ""
|
||||
"Upload a custom photo for your user profile or use a URL to a pre-existing "
|
||||
"photo."
|
||||
msgstr ""
|
||||
|
||||
#: 3five_cupp.php:129
|
||||
msgid "Update Profile to save your changes."
|
||||
msgstr ""
|
||||
|
||||
#. #-#-#-#-# plugin.pot (Custom User Profile Photo 0.4) #-#-#-#-#
|
||||
#. Plugin URI of the plugin/theme
|
||||
#. #-#-#-#-# plugin.pot (Custom User Profile Photo 0.4) #-#-#-#-#
|
||||
#. Author URI of the plugin/theme
|
||||
msgid "http://3five.com"
|
||||
msgstr ""
|
||||
|
||||
#. Description of the plugin/theme
|
||||
msgid ""
|
||||
"A simple and effective custom WordPress user profile photo plugin. This "
|
||||
"plugin leverages the WordPress Media Uploader functionality. To use this "
|
||||
"plugin go to the users tab and select a user. The new field can be found "
|
||||
"below the password fields for that user."
|
||||
msgstr ""
|
||||
|
||||
#. Author of the plugin/theme
|
||||
msgid "3five"
|
||||
msgstr ""
|
@ -0,0 +1,173 @@
|
||||
=== Plugin Name ===
|
||||
Contributors: VincentListrani, jmichaelward
|
||||
Donate link:
|
||||
Tags: custom profile photo, custom profile picture, profile picture, user profile, profile photo, user profile photo, user profile picture
|
||||
Requires at least: 3.6.1
|
||||
Tested up to: 4.7.3
|
||||
Stable tag: 0.5.3
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Add a customized User Profile photo to a WordPress user profile.
|
||||
|
||||
== Description ==
|
||||
|
||||
A more flexible way to attach and display a photo for a WordPress user profile.
|
||||
|
||||
Some users might not have or want to have a gravatar account or other universal avatar account. They simply may want to use a one-time specified photo to represent them on your WordPress site. This plugin solves that use case.
|
||||
|
||||
With the ability to upload a photo to a user profile via the WordPress Media Uploader or by specifying an external URL to an image, your users and/or authors can have a personalized photo specific to your website.*
|
||||
|
||||
This plugin will add a custom set of fields to the user profile page which will allow for the use of a custom profile photo.
|
||||
|
||||
You can add/change/edit uploaded photos directly from the user profile page. The external option allows you to provide a URL to the external image or remove it.
|
||||
|
||||
**As of v0.4**, the plugin now filters the get_avatar() function found in most WordPress themes.
|
||||
|
||||
Simply go to the users section and select a user or select "Your Profile" depending on your permission level. The new fields are added to the bottom of the user profile page. Choose which type of photo you want to use. Upload an image or add an external url. Then press the Update Profile button.
|
||||
|
||||
If you require a customized approach or your theme does not support the get_avatar() hook, use the example below.
|
||||
|
||||
To retrieve the photo on the front-end use the following example on your template page(s).
|
||||
|
||||
`
|
||||
<?php
|
||||
// Retrieve The Post's Author ID
|
||||
$user_id = get_the_author_meta('ID');
|
||||
// Set the image size. Accepts all registered images sizes and array(int, int)
|
||||
$size = 'thumbnail';
|
||||
|
||||
// Get the image URL using the author ID and image size params
|
||||
$imgURL = get_cupp_meta($user_id, $size);
|
||||
|
||||
// Print the image on the page
|
||||
echo '<img src="'. $imgURL .'" alt="">';
|
||||
?>
|
||||
`
|
||||
|
||||
You will need to place the code above in each area of your theme where you wish to add and retrieve your theme's custom avatar image. This can include but is not limited to single.php, page.php, and comments.php.
|
||||
|
||||
*Future Updates to this plugin include allowing other roles to access this feature, a settings page to allow a custom default image and other options.
|
||||
|
||||
== Installation ==
|
||||
|
||||
1. Upload `custom-user-profile-photo` folder to the `/wp-content/plugins/` directory
|
||||
2. Activate the plugin through the 'Plugins' menu in WordPress
|
||||
3. Place `<?php get_cupp_meta($user_id, $size); ?>` in your templates
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= Who can upload and manage these images? =
|
||||
|
||||
Currently, only a user with the upload_files capability can use this option.
|
||||
Editors and Admins can upload and edit files.
|
||||
Authors can only upload files.
|
||||
Subscribers and Contributors cannot do either so an Admin will need to do this for them.
|
||||
|
||||
= I installed the plugin but I want to customize the output and placement of the image. Is this possible? =
|
||||
|
||||
Yes, you can still customize the output by using the get_cupp_meta() function. Please reference the code snippet below or on the Description tab.
|
||||
`<?php echo get_cupp_meta($user_ID, $size); ?>`
|
||||
Where the $user_ID is the users ID number and the size is a registered image size like 'thumbnail' or an array like `array(50,50)`.
|
||||
|
||||
== Screenshots ==
|
||||
|
||||
1. The new fields that are added to the user profile page.
|
||||
|
||||
2. After uploading and saving your selected image.
|
||||
|
||||
3. On hover, Edit or Remove an uploaded image.
|
||||
|
||||
4. On hover, Remove a URL to an external image.
|
||||
|
||||
5. An example of getting this new image to display on the front-end.
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 0.5.3 =
|
||||
* Addressed an issue where an object being passed into `cupp_get_user_by_id_or_email` could potentially be the WP_Comment object.
|
||||
|
||||
= 0.5.2 =
|
||||
* Fixed issue with a PHP warning when getting the user with the WP_User object.
|
||||
|
||||
= 0.5.1 =
|
||||
* Fixed issue with `update_user_attribute`.
|
||||
|
||||
= 0.5 =
|
||||
* Major Update - please be sure to backup your site and db.
|
||||
* Replaced `update_user_meta` with `update_user_attribute` per WordPress VIP Standards.
|
||||
* Replaced `get_home_url` with `get_site_url` for users where the edit image link was returning a 404. Credit: SOMTIJDS
|
||||
* Fixed textdomain loading issue.
|
||||
* Added Spanish translation. Credit: David Pérez
|
||||
* Updated and formatted code per PHPCS. Credit: jmichaelward
|
||||
* Refactored multiple functions and variables for simplicity and compatibility. Credit: jmichaelward
|
||||
|
||||
= 0.4 =
|
||||
* Major Update - please be sure to backup your site and db.
|
||||
* The plugin now overrides the WordPress avatar by filtering the get_avatar() hook.
|
||||
* The get_cupp_meta() function still exists and can be used to customize the output (this will eventually be deprecated).
|
||||
|
||||
= 0.3 =
|
||||
* Changed the function which gets the attachment post ID by GUID to the WordPress core function attachment_url_to_postid() for better reliability. (Props to sqhendr).
|
||||
|
||||
= 0.2.7 =
|
||||
* Added Hungarian Translation (Thanks to Harkály Gergő)
|
||||
|
||||
= 0.2.6 =
|
||||
* Fixed a bug where the save function required a different capability than the upload function (courtesy of douglas_johnson).
|
||||
|
||||
= 0.2.5 =
|
||||
* Tested with WordPress v4.1
|
||||
* Fixed a bug where the external URL option would not return the URL with get_cupp_meta().
|
||||
* Fixed a bug where the saved image did not correspond to the selected radio button.
|
||||
* Replaced depricated update_usermeta with update_user_meta.
|
||||
* Improved image selection functionality.
|
||||
* Images now show immediately after selecting an uploaded item or entering an external URL.
|
||||
* Added Dutch translation - Thanks Olaf Lederer
|
||||
|
||||
= 0.2.4 =
|
||||
* Tested with WordPress v3.8
|
||||
* Updated description text. Better explanation of how to quickly use this plugin.
|
||||
|
||||
= 0.2.3 =
|
||||
* Beta version release.
|
||||
|
||||
== Upgrade Notice ==
|
||||
|
||||
= 0.5.3 =
|
||||
Addressed an issue where an object being passed into `cupp_get_user_by_id_or_email` could potentially be the WP_Comment object.
|
||||
|
||||
= 0.5.2 =
|
||||
Fixed issue with a PHP warning when getting the user with the WP_User object.
|
||||
|
||||
= 0.5.1 =
|
||||
Fixed issue with update_user_attribute.
|
||||
|
||||
= 0.5 =
|
||||
Major Update - please be sure to backup your site and db. The plugin was refactored and restructured per PHPCS. Some functions were swapped for ones that were less costly or could cause a 404 response. Fixed textdomain issue for translations and added Spanish translation.
|
||||
|
||||
= 0.4 =
|
||||
Major Update - please be sure to backup your site and db. The plugin now filters and overrides `get_avatar()`. This could affect your theme or other plugins you have installed.
|
||||
|
||||
= 0.3 =
|
||||
Minor improvement.
|
||||
|
||||
= 0.2.6 =
|
||||
Bug Fixes and minor improvements.
|
||||
|
||||
= 0.2.5 =
|
||||
Bug Fixes and minor improvements.
|
||||
|
||||
= 0.2.3 =
|
||||
Beta Release
|
||||
|
||||
== Translations ==
|
||||
|
||||
* English - default, always included
|
||||
* Dutch
|
||||
* Hungarian
|
||||
* Spanish
|
||||
|
||||
== Credits ==
|
||||
|
||||
Thanks to [Olaf Lederer](https://profiles.wordpress.org/finalwebsites/), [Harkály Gergő](https://github.com/harkalygergo), [sqhendr](https://profiles.wordpress.org/sqhendr/), [SOMTIJDS](https://profiles.wordpress.org/somtijds/), [David Pérez](https://www.closemarketing.es)
|
Reference in New Issue
Block a user