Accessing function from another plugin (3 posts)

  1. s0what
    Posted 6 years ago #


    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.

  2. s0what
    Posted 6 years ago #

    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;
    	# 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)
    	# 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;
  3. s0what
    Posted 6 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.