Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 03 Jan 2017, 19:39
SilverBoy SilverBoy is offline
 
Join Date: Feb 2002
Real name: Malik
Adding user profile picture to open graph

Hi

In my CMS articles I displays the avatars of the author of the article, but because the image is small (6060 px) Facebook didn't grab it when I share the link to Facebook.

So I think in adding user profile picture (Big size) as a variable to the opengraph array.

The question is ..
How I can get the profile picture in every article?
then how I can add it to opengraph array?

Thanks in advance.
__________________
One of highly customized vBCMS used for news site.
www.manshor.net
Reply With Quote
  #2  
Old 03 Jan 2017, 19:56
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Real name: Mark
Assuming you have the user's userid in $userid, you can get the URL of their profile pic as follows:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Now, if the variable $profilepicexists evaluates to true, the URL of the profile pic is in $ppuserinfo['profilepicurl'].
__________________
Former vBulletin.org Staff Member



Support for my products (as well as updates/new product publishing) has been moved to MHB - vBulletin Products and TAZ - Add-ons
Reply With Quote
  #3  
Old 03 Jan 2017, 19:59
SilverBoy SilverBoy is offline
 
Join Date: Feb 2002
Real name: Malik
Thank you mark, I will give it a try, but how I can inject the profilepic to the opengraph array?
I tried it manually by adding link to the image in the top of vbcms_content_article template but Facebook ignore it and don't add it to the og:images !!
__________________
One of highly customized vBCMS used for news site.
www.manshor.net
Reply With Quote
  #4  
Old 03 Jan 2017, 20:05
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Real name: Mark
I don't know what key you wish to use for the $opengraph array, but suppose with wish to use the key "profilepicurl', then you could add:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
Former vBulletin.org Staff Member



Support for my products (as well as updates/new product publishing) has been moved to MHB - vBulletin Products and TAZ - Add-ons
Reply With Quote
  #5  
Old 03 Jan 2017, 20:11
SilverBoy SilverBoy is offline
 
Join Date: Feb 2002
Real name: Malik
I want to use og:image property.
__________________
One of highly customized vBCMS used for news site.
www.manshor.net
Reply With Quote
  #6  
Old 03 Jan 2017, 20:20
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Real name: Mark
Originally Posted by SilverBoy View Post
I want to use og:image property.
I don't know what that is...I thought you wanted to store the URL of the profile pic in the specified array.

I have negligible experience with the CMS articles feature of vB, but I thought I would be able to give you a leg up on getting the data you want into the array.
__________________
Former vBulletin.org Staff Member



Support for my products (as well as updates/new product publishing) has been moved to MHB - vBulletin Products and TAZ - Add-ons
Reply With Quote
  #7  
Old 03 Jan 2017, 20:23
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Real name: Mark
After a quick google search, it appears you need a meta tag in your template, and you will have to register the URL variable for your template, and your meta tag would then look something like:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
Former vBulletin.org Staff Member



Support for my products (as well as updates/new product publishing) has been moved to MHB - vBulletin Products and TAZ - Add-ons
Reply With Quote
  #8  
Old 03 Jan 2017, 20:24
SilverBoy SilverBoy is offline
 
Join Date: Feb 2002
Real name: Malik

When you share a link in FB, the image that appears as thumbnail comes from this property.
If you open any page in sharing debugger tools you will see all properties that FB uses from your page.
https://developers.facebook.com/tools/debug/sharing/

--------------- Added 03 Jan 2017 at 20:25 ---------------

Stupid Q
How I can register the variable?

--------------- Added 03 Jan 2017 at 20:30 ---------------


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Sorry, #8 here what is mean?
__________________
One of highly customized vBCMS used for news site.
www.manshor.net
Reply With Quote
  #9  
Old 03 Jan 2017, 20:33
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Real name: Mark
Suppose you have the name of the template to which you wish to send the variable in $template_name, then in your plugin, you could use


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
Former vBulletin.org Staff Member



Support for my products (as well as updates/new product publishing) has been moved to MHB - vBulletin Products and TAZ - Add-ons
Reply With Quote
  #10  
Old 03 Jan 2017, 20:39
SilverBoy SilverBoy is offline
 
Join Date: Feb 2002
Real name: Malik
Here is my plugin, is it right?

Hook: vbcms_article_populate_end(vbulletin cms)
Name: Add profile picture as meta tag
Order: 5
Code:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

--------------- Added 03 Jan 2017 at 20:44 ---------------

It didn't work !!

Here is what I get in my source code

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
One of highly customized vBCMS used for news site.
www.manshor.net
Reply With Quote
  #11  
Old 03 Jan 2017, 20:48
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Real name: Mark
You will need to get the actual userid, it's not going to automatically be in $userid...I just used that as a placeholder...for example, at the plugin hook location "postbit_display_complete" you can get it from $post['userid'], but I don't know what array is going to contain it at your plugin hook location.

Looking at that template, I would first try (at the very top of the plugin):


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
Former vBulletin.org Staff Member



Support for my products (as well as updates/new product publishing) has been moved to MHB - vBulletin Products and TAZ - Add-ons
Reply With Quote
  #12  
Old 03 Jan 2017, 20:52
SilverBoy SilverBoy is offline
 
Join Date: Feb 2002
Real name: Malik
authorid is the variable

Here is the code I use to show avatar for example

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

--------------- Added 03 Jan 2017 at 20:59 ---------------

I modified the plugin code to this, but without luck !!

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

--------------- Added 04 Jan 2017 at 00:17 ---------------

I made a lot of tests, but I don't know why the plugin can't see $authorid or $poststarter['userid'] or even $userid.

BTW, if I put {vb:raw authorid} in the template it give me the author id !!

Any suggestions?

--------------- Added 04 Jan 2017 at 13:07 ---------------

No suggestions to how to get the authorid to complete this plugin?

--------------- Added 04 Jan 2017 at 14:01 ---------------

I found it ^_^


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

solve the things

there is only one problem left, this code

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

give me wrong image pathlike this


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

the right path is

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

How I can fix this?

Thanks in advance.
__________________
One of highly customized vBCMS used for news site.
www.manshor.net

Last edited by SilverBoy; 03 Jan 2017 at 23:16.
Reply With Quote
  #13  
Old 04 Jan 2017, 15:35
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Real name: Mark
Try changing the line:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

to:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
Former vBulletin.org Staff Member



Support for my products (as well as updates/new product publishing) has been moved to MHB - vBulletin Products and TAZ - Add-ons
Reply With Quote
  #14  
Old 04 Jan 2017, 19:34
SilverBoy SilverBoy is offline
 
Join Date: Feb 2002
Real name: Malik
Thank you Mark it works now.

I tried before inject bburl in this line

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

but I couldn't figure it out, but now it works and Facebook grap the picture too ^_^
just note I not use template I added the code to the plugin that I bought from BirdOPery5 (More Open Graph Images Gold) and now I have what I want exactly.
__________________
One of highly customized vBCMS used for news site.
www.manshor.net
Reply With Quote
  #15  
Old 04 Jan 2017, 19:37
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Real name: Mark
Excellent! Glad to hear you now have it working as you want.
__________________
Former vBulletin.org Staff Member



Support for my products (as well as updates/new product publishing) has been moved to MHB - vBulletin Products and TAZ - Add-ons
Reply With Quote
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
Integration with vBulletin More Open Graph Images (Free) by BOP5 BirdOPrey5 vBulletin 4.x Add-ons 76 22 Mar 2019 19:29



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 13:45.

Layout Options | Width: Wide Color: