Forum Replies Created

Viewing 15 replies - 46 through 60 (of 108 total)
  • Plugin Author Ariel

    (@arielhr1987)

    Hi @zee300

    Thanks for the kudos

    You could use something like this to use you own font.
    Just set the path the correct path to your font and delete your current “letter-avatar” folder in uploads dir (the plugin will generate it for you).
    Let me know if it works for you.

    function my_image_font( $font, $data ) {
    	$font = __DIR__ .'/Barlow-Regular.ttf';
    
    	return $font;
    }
    add_filter( 'leira_letter_avatar_image_font', 'my_image_font', 10, 2 );

    Kind regards

    Plugin Author Ariel

    (@arielhr1987)

    Hi @haribonda

    Which plugin are you using to change user avatar in admin area? (WordPress doesn’t include that feature by default)
    Maybe that plugin isn’t compatible with Leira Letter Avatar.

    Regards!

    Plugin Author Ariel

    (@arielhr1987)

    Hi @haribonda

    Thanks for your recommendations, I think number one looks very nice and it would be a cool feature to add.
    What i didn’t understand was the exact problem you are facing while using custom backgrounds. The avatar background color doesn’t update if you change it in settings page?

    To accomplish this no so bright color request you can do something like code below. I copied some code from this library https://github.com/mistic100/RandomColor.php which does exactly the same thing as the one you sent. Modify the code to fit your needs.

    function my_avatar_url_args( $url_args, $id_or_email ) {
    	$bg = $url_args['background'];
    
    	// Convert the username into a number based on the ASCII value of each
    	// character.
    	$num = 0;
    	for ( $i = 0; $i < strlen( $bg ); $i ++ ) {
    		$num += ord( substr( $bg, $i ) );
    	}
    
    	// Construct a color using the remainder of that number divided by 360, and
    	// some predefined saturation and value values.
    	$hue = $num % 360;
    
    	$url_args['background'] = hsv2rgb( $hue, 30, 90 );
    
    	$url_args['color'] = leira_letter_avatar()->public->get_contrast_color( $url_args['background'] );
    
    	return $url_args;
    }
    
    /**
     * https://github.com/mistic100/RandomColor.php/blob/394b2a6f87b7cdc2ae0bfb02dd59b9e35fd08d8a/src/RandomColor.php
     *
     * @param $h
     * @param $s
     * @param $v
     *
     * @return string
     */
    function hsv2rgb( $h, $s, $v ) {
    
    	$h /= 360;
    	$s /= 100;
    	$v /= 100;
    
    	$i = floor( $h * 6 );
    	$f = $h * 6 - $i;
    
    	$m = $v * ( 1 - $s );
    	$n = $v * ( 1 - $s * $f );
    	$k = $v * ( 1 - $s * ( 1 - $f ) );
    
    	$r = 1;
    	$g = 1;
    	$b = 1;
    
    	switch ( $i ) {
    		case 0:
    			list( $r, $g, $b ) = array( $v, $k, $m );
    			break;
    		case 1:
    			list( $r, $g, $b ) = array( $n, $v, $m );
    			break;
    		case 2:
    			list( $r, $g, $b ) = array( $m, $v, $k );
    			break;
    		case 3:
    			list( $r, $g, $b ) = array( $m, $n, $v );
    			break;
    		case 4:
    			list( $r, $g, $b ) = array( $k, $m, $v );
    			break;
    		case 5:
    		case 6:
    			list( $r, $g, $b ) = array( $v, $m, $n );
    			break;
    	}
    
    	$res = array(
    		'r' => floor( $r * 255 ),
    		'g' => floor( $g * 255 ),
    		'b' => floor( $b * 255 ),
    	);
    
    	$hex = '';//'#'
    	foreach ( $res as $c ) {
    		$hex .= str_pad( dechex( $c ), 2, '0', STR_PAD_LEFT );
    	}
    
    	return $hex;
    }
    
    add_filter( 'leira_letter_avatar_url_args', 'my_avatar_url_args', 10, 2 );

    Exactly as you described SVG is the one that take less space among all formats.
    I have no idea how to decrease svg size, first think that comes to my mind is make the xml shorter. You can try something like this as a first approach, let me know how it works for you.

    function my_image_content( $avatar, $data ) {
    
    	if ( $data['format'] == 'svg' ) {
    		//create a custom avatar or replace something int he current one.
    		$avatar = str_replace( "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif", "'Times New Roman', Times, serif", $avatar );
    	}
    
    	return $avatar;
    }
    
    add_filter( 'leira_letter_avatar_image_content', 'my_image_content', 10, 2 );
    Plugin Author Ariel

    (@arielhr1987)

    Hi @sylvertech

    If I install your plugin, will these 2 columns be reinstated (showing up again) ?

    This plugin does not add a “Role” column to users list. That column is added by default by WordPress.
    If your installation is multisite (I believe it is) you wont see the “Role” column in the network users list, as this column will only be visible in your site user list admin page.

    So, If I install your plugin, will I be able to see at which Role category the user belongs, and will I be able to change its ‘role’ through that screen ?

    This plugin can’t help you to change a user role… that being said
    You can’t change a role in the network users list page.
    In a multisite network a user has a role for a particular site. That ensures you can have the same user in all sites but with a different role/capabilities for each one.
    So to change a user role, just go to the specific site admin area, head to user list page, in the user row click on “edit” and there you will find a setting for change the user “role”.

    Kind regards!

    Plugin Author Ariel

    (@arielhr1987)

    I need your help to understand the scenario where these incorrect avatars are shown.

    Is this error happening only for the avatar in comments made by not logged in users?
    or it happens for all users, comments or avatar in your site?.

    Which plugins are you using that might be interfering with users/comments information? If you disable all plugins the error persist?

    Anything related with your theme? if you change your theme the error persist?

    Plugin Author Ariel

    (@arielhr1987)

    Hi @eduardochaves

    While checking your website I noticed that you are using WPDiscuz.
    All broken avatar images in your comments look like this:

    <img alt="Eduardo Chaves" src="https://fotografandooficial.com.br/wp-content/uploads/wpdiscuz/cache/gravatars/a87ff679a2f3e71d9181a67b7542122c.gif" srcset="https://fotografandooficial.com.br/wp-content/uploads/wpdiscuz/cache/gravatars/a87ff679a2f3e71d9181a67b7542122c.gif 2x" class="avatar avatar-64 photo" height="64" width="64" itemprop="image">

    As you can see the image is pointing to an url (like https://fotografandooficial.com.br/wp-content/uploads/wpdiscuz/cache/gravatars/a87ff679a2f3e71d9181a67b7542122c.gif). which is not related to leira letter avatar. Usually leira letter avatar url should look like this: https://fotografandooficial.com.br/wp-content/uploads/letter-avatar/397bb03a362ff38528e707434cfd4305.svg

    Do you have a cache plugin enabled?
    Check your wpdiscuz settings or contact the developers to check what is that image they are caching.

    Kind regards

    Plugin Author Ariel

    (@arielhr1987)

    Hi @vejapixel

    The behavior you describe is by default how the plugin works.
    The image you sent, is it from the admin comments list page?
    I don’t remember if wordpress shows how many approved comments a user has like is shown in the picture, are you using a plugin to manage comments?
    Some times plugins use a different approach to store comment author, like save the name in comment metadata. Maybe thats the case and thats why leira letter avatar can’t find the author name.
    In your database check the “comment_author” column in “wp_comments” table. If the filed is empty the comment author is stored somewhere else.

    Plugin Author Ariel

    (@arielhr1987)

    Hi @caroltheo

    The behavior you describe with the settings is the correct one.
    The plugin setting “Enable use of letter avatar” acts as a shortcut for the setting in WP Admin > Settings > Discussion > Avatars > default avatar.
    So every time you select “Enable use of letter avatar” is like if you were checking “Letters” as the default avatar as you described.
    So you either use mystery or letters but not both at the same time.

    There is a way, however, to show the mystery avatar for the user if is logged out.
    This method depends on how the avatar is being show.
    For example if your theme is using this code to show the avatar:
    echo get_avatar( wp_get_current_user() );
    or something similar you could do something like this to show the mystery avatar(add it to your functions.php).

    function mystery_avatar_if_logged_out( $args, $id_or_email ) {
    
    	if ( ( $id_or_email instanceof WP_User && ! $id_or_email->exists() ) || ! $id_or_email ) {
    		$args['force_default'] = true;
    		$args['default']       = 'mystery';
    	}
    
    	return $args;
    }
    
    add_filter( 'pre_get_avatar_data', 'mystery_avatar_if_logged_out', 90, 2 );

    So it all depends on how the user avatar is shown…

    Let me know if it works for you

    Plugin Author Ariel

    (@arielhr1987)

    @futureskills

    You can do it with some code.
    Check this one as a starting point.

    if ( ! wp_next_scheduled( 'update_post_countdown' ) ) {
        wp_schedule_event( time(), 'daily', 'update_post_countdown' );
    }
    
    function update_post_countdown(){
    	$id = 1; //your post id;
    	$metaKey = 'my_countdown_meta'; //your post meta key
    
    	$meta = get_post_meta($id, $metaKey);
    	$time = strtotime($meta);
    
    	if($time && $time < time() ){
    		//update meta countdown to 5 days from now
    		update_post_meta($id, $metaKey, strtotime($meta . ' +5 days')); 
    	}
    
    }
    Plugin Author Ariel

    (@arielhr1987)

    Hi @demian85

    Any change you made to a role or user (add or delete capabilities) is permanent, which means that uninstall the plugin won’t bring those capabilities back.
    Best thing you can do is install the plugin again and set the capabilities as they were before.

    To set capabilities to default check this page which have all default wordpress roles and capabilities.
    If you modified other capabilities that other theme/plugin added you will need to check those too.

    In the other hand default roles and capabilities can be found in wp_config table, in the record were option_name field is “wp_user_roles”.
    User capabilities can be found on wp_usermeta table, in the record were field meta_key field is “wp_capabilities”.

    Better if you don’t change the database (unless you know what you are doing), better if you use the plugin.

    Backup your database in any case

    Let me know!

    Regards

    Plugin Author Ariel

    (@arielhr1987)

    Thank you @dilszhan for such great review.
    Cheers

    Plugin Author Ariel

    (@arielhr1987)

    Hi @realact
    Great news. I am curious about what cause the issue. If anything comes out just let me know.

    Plugin Author Ariel

    (@arielhr1987)

    Hi @joroabv

    I found the solution to the problem.
    Basically WP Avatar is missing a call to a filter tha Leira Letter Avatar uses to work correctly. I opened a support thread explaining the problem and the solution. I give you the link in case you want to also comment and get more attention from the developer.

    In case you dont want to wait for them to fix the problem, you can do this.
    I noticed that if you save the settings in “Avatars” > “Settings” (which are wp avatar settings) or in “Setting” > “Discussion” that will cause that Leira Letter Avatar setting “Enable use of letter avatar” get unchecked.
    So everytime you save one of the above setting i describe go to leira letter avatar settings page and enable the option mentioned.
    That fixed the problem for me and allowed me to use both WP Avatar and Leira Letter Avatar.

    I hope it helps

    Plugin Author Ariel

    (@arielhr1987)

    Hi @futureskills

    This plugin helps you to manage cron jobs. The logic behind the cronjob is up to the developers.
    For the scenario you describe, you will need to create the cron job yourself and the logic to set the custom fields and countdown.
    So, in short, this plugin wont help to acomplish that. ??

    Plugin Author Ariel

    (@arielhr1987)

    I understand the situation.
    Allow some time to check the problem and determine the best approach to solve it.

    No beta yet, still work in progress ??

Viewing 15 replies - 46 through 60 (of 108 total)