Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-14-2008, 08:39 AM
Conner85 Conner85 is offline
 
Join Date: Jan 2008
Posts: 129
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Using MySpace Default as Profile Picture

I've been searching aimlessly to find a way to link the default picture on MySpace to the profile picture area in my users' profiles. Pretty much all they have to do is type in their MySpace user name and their default picture shows up. As well as auto-updating every time they change their default picture on MySpace. I finally came across PHP code, but I have NO CLUE how to turn it into a plugin. If anyone could help, it would be awesome.

Code:
<?php

function grab_main_pic($url)
{
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
   
    if (preg_match('/<a\s+id="ctl00_Main_ctl00_UserBasicInformation1_hlDefaultImage"[^>]+><img\s+src="([^"]+)"/si', curl_exec($ch), $mainpic))
    {
        return $mainpic[1];
    }
   
    return 'Failed to grab main pic.';
}


echo grab_main_pic('http://www.myspace.com/$userinfo[field24]');


?>
Reply With Quote
  #2  
Old 04-16-2008, 12:49 PM
Conner85 Conner85 is offline
 
Join Date: Jan 2008
Posts: 129
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Not meaning to bump.. but.. no one at all?
Reply With Quote
  #3  
Old 04-16-2008, 07:46 PM
MoT3rror MoT3rror is offline
 
Join Date: Mar 2007
Posts: 423
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you want to show the myspace profile picture on everypage for the user signed in.

Hook: global_start

PHP Code:
function grab_main_pic($url)
{
    
$ch curl_init($url);
    
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
   
    if (
preg_match('/<a\s+id="ctl00_Main_ctl00_UserBasicInformation1_hlDefaultImage"[^>]+><img\s+src="([^"]+)"/si'curl_exec($ch), $mainpic))
    {
        return 
$mainpic[1];
    }
   
    return 
'Failed to grab main pic.';
}


$myspaceimage =  grab_main_pic('http://www.myspace.com/' $vbulletin->userinfo['field24']); 
Then in your template the variable $myspaceimage will include what your function is returning.

Also single and double quotes mean different things.
PHP Code:
$variable 1;
echo 
'$varaible'//will return $variable
echo "$variable"//will return 1 
Reply With Quote
  #4  
Old 04-16-2008, 09:16 PM
Conner85 Conner85 is offline
 
Join Date: Jan 2008
Posts: 129
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That seems to atleast get the plugin to respond. The way I was setting the plugin up was causing a bunch of errors. But now all it says is Failed to grab main pic. Is there anything I'm doing wrong?

By the way, thank you very much.
Reply With Quote
  #5  
Old 04-16-2008, 09:31 PM
SEOvB's Avatar
SEOvB SEOvB is offline
 
Join Date: May 2007
Location: Indianapolis
Posts: 2,451
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

make sure curl is intalled and compiled on your server
Reply With Quote
  #6  
Old 04-16-2008, 09:35 PM
Conner85 Conner85 is offline
 
Join Date: Jan 2008
Posts: 129
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's installed. Is there anything else it could be?
Reply With Quote
  #7  
Old 04-17-2008, 10:48 PM
Conner85 Conner85 is offline
 
Join Date: Jan 2008
Posts: 129
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmmmm.. Still saying Failed to grab main pic. Maybe the link needs to be changed into something like images.myspace.com? I've been trying to play around with it all I can. But as always, failed attempts.
Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 02:41 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03853 seconds
  • Memory Usage 2,216KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete