Notifications
Clear all

wpForo 1.x.x [Solved] API] Problem with avatar link

14 Posts
2 Users
6 Reactions
1,269 Views
Posts: 7
Topic starter
(@allezpaillade)
Active Member
Joined: 4 years ago

Hello,

I am using a wordpress plugin which collect the site member's profile picture link with api. Wpforo displays avatar links in the following form: "//: www.xxxxxx.com/upload / ....."

This link is not recognized and created a display error in my other plugin which prevents its functioning.

Can I modify a line of code to be able to display the urls in the following form ? https: //www.xxxx.com/upload / ....

Thank you in advance for your help.

best regards Mathieu

Topic Tags
13 Replies
Alvina
Posts: 1863
Moderator
(@alvina)
Member
Joined: 5 years ago

Hi @allezpaillade,

This is designed and works in this way for the following reason.
If the URL in the following format "//:sayt.com.img.jpg" the browser puts the http:// and https:// depend on your site protocol. This means that it will work for the http: // and https: // protocols as well.

I am using a wordpress plugin which collect the site member's profile picture link with api. Wpforo displays avatar links in the following form: "//: www.xxxxxx.com/upload / ....."

This link is not recognized and created a display error in my other plugin which prevents its functioning.

Regarding the plugin(plugin you use for profile pictures) that does not recognize the above-mentioned format, wpForo has a hook for this purpose. In case, if you have developers we can provide a hook that allows your developers to make it work.

Posts: 7
Topic starter
(@allezpaillade)
Active Member
Joined: 4 years ago

Hello thanks for your help . 
i have’nt any developers for that.

my site is only in https and it will remain so in the future. how can i modify this in hard or via function.php file ?

 

thanks for your help

best regards

mathieu

3 Replies
Alvina
Moderator
(@alvina)
Joined: 5 years ago

Member
Posts: 1863

@allezpaillade

As far as the issue does not have any relation to the wpForo, it comes from the plugin you use for profile pictures. Thus I'm sorry but we can't provide any solution for you. We only may suggest you contact that plugin support and let them know about the issue.

(@allezpaillade)
Joined: 4 years ago

Active Member
Posts: 7

@alvina

Hi !

 

Ok thanks. Could you give me your hook pls ?

 

Best regards

Mathieu

Alvina
Moderator
(@alvina)
Joined: 5 years ago

Member
Posts: 1863

@allezpaillade,

Could you give me your hook pls ?

The hook will be available in the next version update, and we will be able to provide it you.

Posts: 7
Topic starter
(@allezpaillade)
Active Member
Joined: 4 years ago

Hi 

 

ok thanks you

7 Replies
Alvina
Moderator
(@alvina)
Joined: 5 years ago

Member
Posts: 1863

@allezpaillade,

Below is provided a promised hook:

$avatar_url = apply_filters('wpforo_avatar_url', $avatar_url, $userid);
(@allezpaillade)
Joined: 4 years ago

Active Member
Posts: 7

@alvina great new and Nice support. Thanks 

mathieu

Alvina
Moderator
(@alvina)
Joined: 5 years ago

Member
Posts: 1863

@allezpaillade,

We'd really appreciate and be thankful if you leave a good review on plugin page. This is the best way to say thank you to this project and support team.

(@allezpaillade)
Joined: 4 years ago

Active Member
Posts: 7

Hi, 

i have already rating add 😉

 

chatroll support can’t use correctly your hook.. doesn’t Work.

pls follow their reply

Please contact WpForo to ask for exact instructions (i.e. a specific PHP code example) to retrieve the avatar image URL.

Any solution for that ? Your hook gives link with

//www.website.com/

But i want

https://www.website.com

 

Thanks for your support

best regards

math

Alvina
Moderator
(@alvina)
Joined: 5 years ago

Member
Posts: 1863

@allezpaillade,

Please use the following hook to make it work:
 
add_filter('wpforo_avatar_url', function ($avatar_url){
if( strpos($avatar_url, 'http') !== 0 ) $avatar_url = 'https:' . $avatar_url;
return $avatar_url;
});
 
(@allezpaillade)
Joined: 4 years ago

Active Member
Posts: 7

Hello, 

Your hook work correctly now !

 

Thanks

Alvina
Moderator
(@alvina)
Joined: 5 years ago

Member
Posts: 1863

@allezpaillade,

Thank you for letting us know.

Glad to hear it worked.