Forum Replies Created
-
Thanks @danbp, I thought I had already forgotten me. But this code did not work here. There is appearing on every page avatars? And when someone enters the profile that appears avatar?
Hi @henrywright
I create the template for a software called Artisteer. There’s nothing I can do?Thank you. But still did not solve my problem. He appears in the members and activity page, but the web page still does not appear, as the home page and admin manager. Has no solution for this?
I’m trying to edit the plugin BuddyPress Fistr Letter Avatar because it changes the avatar everywhere the site taking the value of the first letter of the name of the user. But always when I try to use a value of xprofile field it does not work the way I want.
Has no solution for this? Any suggestion?
Tried a new code using bp_profile_field_data:
wpse_49216_my_new_avatar_url function () { $ current_user = wp_get_current_user (); $ current_user_id = $ current_user-> ID; global $ bp; $ var = bp_profile_field_data (array ('user_id' => $ current_user_id, 'field' => 'ranking')); if ($ var == "Cranking") { return 'http://hsseek2.esy.es/wp-content/uploads/2015/04/lendario.png'; } if ($ var == "Dranking") { return 'http://hsseek2.esy.es/wp-content/uploads/2015/04/25.png'; } } add_filter ('bp_core_fetch_avatar_url', 'wpse_49216_my_new_avatar_url'); function wpse_49216_filter_bp_avatar ($ html) { return preg_replace ('/src=".+?"/', 'src =' 'wpse_49216_my_new_avatar_url ()..' "', $ html); } add_filter ('bp_core_fetch_avatar', 'wpse_49216_filter_bp_avatar');
It now appears the name of the field on the homepage, but I need to treat the value returned by bp_profile_field_data it looks like is:
username: teste
password: 1234What value the bp_profile_field_data returns? How can I treat it?
Thanks for trying to help me @danbp.
So I want to save an avatar for a user depending on what he select the field xprofile. It is possible? How do I?
the code I am using is:
wpse_49216_my_new_avatar_url function () { global $ bp; $ranking = xprofile_get_field_data ('ranking', bp_get_member_user_id ()); if ($ranking == "Top 25") { return 'http://hsseek2.esy.es/wp-content/uploads/2015/04/25.png'; } if ($ gender == "Top 24") { return 'http://hsseek2.esy.es/wp-content/uploads/2015/04/24.png'; } } add_filter ('bp_core_fetch_avatar_url', 'wpse_49216_my_new_avatar_url'); function wpse_49216_filter_bp_avatar ($ html) { return preg_replace ('/src=".+?"/', 'src =' 'wpse_49216_my_new_avatar_url ()..' "', $ html); } add_filter ('bp_core_fetch_avatar', 'wpse_49216_filter_bp_avatar');
in function.php
The avatars only works when I’m in BuddyPress pages.
I want to make it work around the site by adding the following code passing the user ID I found searching for:<? php $ Userid = bp_loggedin_user_id (); echo bp_core_fetch_avatar (array ('item_id' => $ id user)); ?>
But in which .phpeu add file this code?
In which .php I add file this code?*
already removed the error. you can see that in the area of members appears the avatar and the homepage will not appear?
Area of members:
Homepage:
Here is the link to my site:
http://hsseek2.esy.es/you can log in and see:
username: test
password: testAvatars not appear on pages outside of BuddyPress, as the home page for example. In BuddyPress pages appear in the web page does not appear.
The profile name is ranking, used the gender variable because adapted from another code and not changed.
My theme is Twnty Fifteen
gave the following error:
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘: 1)’ at line 1]
SELECT id, user_id, field_id, value, last_updated FROM wp_bp_xprofile_data WHERE field_id = 2 AND user_id IN (displayed: 1)Read on the internet that I must pass the id as parameter for bp_core_fetch_avatar:
<?php $userid = bp_loggedin_user_id(); echo bp_core_fetch_avatar( array( ‘item_id’ => $userid) ); ?>
But do not know where I have to put this code or how to implement in my code. Can you help me?