• Hi!

    I know this question is more connected to object oriented coding in general, but could you please tell me, how can I access function ( sfc_get_profile_data() ) which is defined in one plugin (SimplePress forum) from another plugin (WP-PostRatings)?

    There is probably something with global variables, but I’m not sure.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter s0what

    (@s0what)

    this function looks like this:

    # ------------------------------------------------------------------
    # sfc_get_profile_data(userid)
    #
    # Grabs all of the profile data for specified user and
    # returns in an array
    # ------------------------------------------------------------------
    function sfc_get_profile_data($userid)
    {
    	global $wpdb;
    
    	if ($userid == 0 || $userid == '') return;
    
    	$profile=array();
    
    	# from USERS
    	$profile = $wpdb->get_row("SELECT ID, user_login, user_email, user_url, user_registered FROM ".SFUSERS." WHERE ID=".$userid, ARRAY_A);
    
    	if(empty($profile)) return;
    
    	# from USERMETA
    	$m = $wpdb->get_results("SELECT meta_key, meta_value FROM ".SFUSERMETA." WHERE user_id=".$userid, ARRAY_A);
    
    	if (empty($m)) return;
    
    	foreach ($m as $item)
    	{
    		$profile[$item['meta_key']]=$item['meta_value'];
    	}
    
    	# from SFMEMBERS
    	$m = $wpdb->get_row("SELECT * FROM ".SFMEMBERS." WHERE user_id=".$userid, ARRAY_A);
    	if (!empty($m))
    	{
    		$profile = array_merge($profile, $m);
    	}
    
    	if (isset($profile['avatar'])) $profile['avatar'] = unserialize($profile['avatar']);
    	if (isset($profile['photos'])) $profile['photos'] = unserialize($profile['photos']);
    	if (isset($profile['user_options'])) $profile['user_options'] = unserialize($profile['user_options']);
    
    	return $profile;
    }

    Thread Starter s0what

    (@s0what)

    I updated from WP 3.0 beta to WP 3.0 Final and it started working

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Accessing function from another plugin’ is closed to new replies.