Support » Plugin: BuddyPress First Letter Avatar » First letter of Last Name or Second word in $name

  • Great plugin, tried it some time ago and it didn’t work with the theme but it’s now working on a new site. Thank you for your hard work! 🙂

    Would it be possible to somehow pull the first letter of the last name? (or second word)?

    I tried for sometime to find a way to do this but I’m still learning php.

    Basicly we would be looking for the first word after a space.

    https://wordpress.org/plugins/buddypress-first-letter-avatar/

Viewing 1 replies (of 1 total)
  • Plugin Author Dev49.net

    (@dev49net)

    Hi there,
    Thanks for your opinion. I do not plan to integrate such feature in my plugins. There are various sources I take the letter from and I don’t think it would be reliable, also most users use just one name.

    You may try to experiment with this, but any changes will be overwritten when plugin is updated. You may want to find a position of space ” ” in the string. You can do that using strpos() function. It will return you the index of first space bar occurence. Then all you have to do is to add that value to the letter index you have specified in my plugin settings and also add 1. This should give you 1st/2nd/3rd… letter when counting from the first spacebar occurence.

    If the strpos() function return false (you need to check it by using === false), it means there is no spacebar.

    I’m still learning php

    Every programmer is always learning 🙂

    Cheers,
    Daniel

Viewing 1 replies (of 1 total)
  • The topic ‘First letter of Last Name or Second word in $name’ is closed to new replies.