• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Easy Profile integration

Easy Profile integration 8 years 11 months ago #35085

  • bioman
  • bioman's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
I have prepared some code to support Easy social profiles. Can you merge them to the main project?

Thanks.

1. Edit components\com_rseventspro\helpers\rseventspro.php

Add after line 4045
// Easy Profile
				case 'easy_profile':
					if (file_exists(JPATH_SITE.'/components/com_jsn/helpers/helper.php')) {
						include_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
						$user 		= JsnHelper::getUser($id);
						$avatarUrl	= $user->avatar_mini;
						$name		= $user->name;
						$html .= '<img src="'.$avatarUrl.'" alt="'.$user->name.'" class="rs_avatar" width="64" height="64" />';
					} else {
						$html .= '<img src="'.JURI::root().'components/com_rseventspro/assets/images/user.png" alt="Easy Profile Avatar" class="rs_avatar" width="64" height="64" />';
					}
				break;

2. Also edit file: administrator\components\com_rseventspro\models\forms\settings.xml

and add
<option value="easy_profile">COM_RSEVENTSPRO_CONF_USER_AVATAR_EASY_PROFILE</option>

After line 184.
The administrator has disabled public write access.

Easy Profile integration 8 years 11 months ago #35086

  • bioman
  • bioman's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
Also in the settings.xml add the last option:
<field name="user_profile" type="list" label="COM_RSEVENTSPRO_CONF_USER_PROFILE" description="COM_RSEVENTSPRO_CONF_USER_PROFILE_DESC" default="0">
			<option value="0">COM_RSEVENTSPRO_CONF_USER_PROFILE_NONE</option>
			<option value="1">COM_RSEVENTSPRO_CONF_USER_PROFILE_JS</option>
			<option value="2">COM_RSEVENTSPRO_CONF_USER_PROFILE_CB</option>
			<option value="3">COM_RSEVENTSPRO_CONF_USER_AVATAR_EASY_PROFILE</option>
		</field>

to support link to attendies user profile.
<field name="event_owner_profile" type="list" label="COM_RSEVENTSPRO_CONF_EVENT_OWNER_PROFILE" description="COM_RSEVENTSPRO_CONF_EVENT_OWNER_PROFILE_DESC" default="0">
			<option value="0">COM_RSEVENTSPRO_CONF_USER_PROFILE_NONE</option>
			<option value="1">COM_RSEVENTSPRO_CONF_USER_PROFILE_JS</option>
			<option value="2">COM_RSEVENTSPRO_CONF_USER_PROFILE_CB</option>
			<option value="3">COM_RSEVENTSPRO_CONF_USER_AVATAR_EASY_PROFILE</option>
		</field>

To support Event owner link to user profile
<field name="event_owner" type="list" label="COM_RSEVENTSPRO_CONF_EVENT_OWNER" description="COM_RSEVENTSPRO_CONF_EVENT_OWNER_DESC" default="0">
			<option value="0">COM_RSEVENTSPRO_CONF_USER_DISPLAY_NAME</option>
			<option value="1">COM_RSEVENTSPRO_CONF_USER_DISPLAY_USERNAME</option>
			<option value="2">COM_RSEVENTSPRO_CONF_USER_DISPLAY_JS</option>
			<option value="3">COM_RSEVENTSPRO_CONF_USER_DISPLAY_CB</option>
			<option value="4">COM_RSEVENTSPRO_CONF_USER_AVATAR_EASY_PROFILE</option>
		</field>

to support display of owner name from easyprofile.

And in rseventspro.php add the part that says Easy profile:
public static function getProfile($type, $id) {
		$profile = $type == 'guests' ? rseventsproHelper::getConfig('user_profile','int') : rseventsproHelper::getConfig('event_owner_profile','int');
		$url	 = '';
 
		if (!empty($profile)) {
			// JomSocial
			if ($profile == 1) {
				if (file_exists(JPATH_SITE.'/components/com_community/libraries/core.php')) {
					include_once(JPATH_SITE.'/components/com_community/libraries/core.php');
					$url = CRoute::_('index.php?option=com_community&view=profile&userid='.$id);
				}
			}
			// Community Builder
			else if ($profile == 2) {
				if (file_exists(JPATH_ADMINISTRATOR.'/components/com_comprofiler/plugin.foundation.php')) {
					include_once(JPATH_ADMINISTRATOR.'/components/com_comprofiler/plugin.foundation.php');
					global $_CB_framework;
					cbimport('cb.database');
					$url = $_CB_framework->userProfileUrl( $id, true );
				}
			}
			// Easy Profile
			else if ($profile == 3) {
				if (file_exists(JPATH_SITE.'/components/com_jsn/helpers/helper.php')) {
					include_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
					$user 		= JsnHelper::getUser($id);
					$url = $user->getLink();	
				}
			}
		}

And this to get the owner name from easy profile:
public static function getUser($uid, $type = 'owner') {
		$db		= JFactory::getDbo();
		$query	= $db->getQuery(true);
		$user	= JFactory::getUser($uid);
		$option = $type == 'guest' ? rseventsproHelper::getConfig('user_display','int') : rseventsproHelper::getConfig('event_owner','int');
 
		if (!$uid) {
			return JText::_('COM_RSEVENTSPRO_GLOBAL_GUEST');
		}
 
		if ($option == 0) {
			return $user->name;
		} elseif ($option == 1) {
			return $user->username;
		} elseif ($option == 2) {
			if (file_exists(JPATH_SITE.'/components/com_community/libraries/core.php')) {
				include_once JPATH_SITE.'/components/com_community/libraries/core.php';
				$user  = CFactory::getUser($uid);
				return $user->getDisplayName();
			} else return $user->name;
		} elseif ($option == 3) {
			$query->clear()
				->select($db->qn('firstname'))->select($db->qn('middlename'))->select($db->qn('lastname'))
				->from($db->qn('#__comprofiler'))
				->where($db->qn('user_id').' = '.(int) $uid);
 
			$db->setQuery($query);
			if ($details = $db->loadObject()) {
				return $details->firstname.' '.$details->middlename.' '.$details->lastname;
			}
 
			return $user->name;
		} elseif ($option == 4) {
			if (file_exists(JPATH_SITE.'/components/com_jsn/helpers/helper.php')) {
					include_once(JPATH_SITE.'/components/com_jsn/helpers/helper.php');
					$user 		= JsnHelper::getUser($uid);	
				}
			return $user->name;
		}	else return $user->name;
	}
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!