Skip to Content Skip to Menu

getField generating script tags

  • imarklee
  • imarklee
  • OFFLINE
  • Posts: 3
  • Thanks: 0
  • Karma: 0
12 years 10 months ago #186872 by imarklee
getField generating script tags was created by imarklee
Hey guys,

I am from stackideas.com the developers of both EasyBlog and EasyDiscuss. We actually have some integrations with Community Builder and we are actually trying to pull the avatars from Community Builder. However, we were having some issues whenever we try to call the following API,
Code:
$user->getField( 'avatar', null, 'php', 'none', 'list' );

The following block of javascript codes somehow get's outputted and causing the AJAX calls to fail,
Code:
<script type="text/javascript" src="/<a href="http://****.org/components/com_comprofiler/js/jquery-1.5.2/jquery-1.5.2.min.js?v=5dc11eced412cdd6" ><="" script><script"="">http://****.org/components/com_comprofiler/js/jquery-1.5.2/jquery-1.5.2.min.js?v=5dc11eced412cdd6"></script><script</a> type="text/javascript"><!-- jQuery.noConflict(); --></script> <script type="text/javascript" src="/<a href="http://****.org/components/com_comprofiler/js/tabpane.min.js?v=5dc11eced412cdd6" ><="" script>"="">http://****.org/components/com_comprofiler/js/tabpane.min.js?v=5dc11eced412cdd6"></script></a> <script type="text/javascript"><!-- jQuery(document).ready(function($){ var cbshowtabsArray = new Array(); function showCBTab( sName ) { if ( typeof(sName) == 'string' ) { sName = sName.toLowerCase(); } for (var i=0;i<cbshowtabsArray.length;i++) { for (var j=0;j<cbshowtabsArray[i][0].length;j++) { if (cbshowtabsArray[i][0][j] == sName) { eval(cbshowtabsArray[i][1]); return; } } } }}); --></script>

The solution which I have used to fix this is to call the following method instead. Although this seems to work, it seems like in the source itself, this method will be deprecated in the future versions of Community Builder.
Code:
$user->avatarFilePath();

Any advise?

Please Log in or Create an account to join the conversation.

  • beat
  • beat
  • ONLINE
  • Posts: 2169
  • Thanks: 463
  • Karma: 352
12 years 10 months ago #186960 by beat
Replied by beat on topic Re: getField generating script tags
That's pretty much part of CB's browser-side API, although not used in standard cases for avatars, it is used by other field types.

That outputed javascript (properly into the page header) is using non-conflict mode, so unless the other javascript on the same page has bugs, it should not interfere imho ?

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in or Create an account to join the conversation.

  • imarklee
  • imarklee
  • OFFLINE
  • Posts: 3
  • Thanks: 0
  • Karma: 0
12 years 10 months ago #186979 by imarklee
Replied by imarklee on topic Re: getField generating script tags
Hello Beat,

Yeah, the problem here actually is because we're trying to do an ajax calls to retrieve the contents (including avatars from Community Builder) and the document type is not 'html'. Perhaps there should be some checks on the document type before that block of script is being generated would help?

Please Log in or Create an account to join the conversation.

  • imarklee
  • imarklee
  • OFFLINE
  • Posts: 3
  • Thanks: 0
  • Karma: 0
12 years 6 months ago #199572 by imarklee
Replied by imarklee on topic Re: getField generating script tags
Hey awesome guys,

Was just wondering if you have any insights on this as we don't really want to use the $user->avatarFilePath since it will be deprecated in the future. Is there any other way to trigger or load the user's avatar without also triggering the browser's API?

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum