FreiChat related discussions
[SOLVED] Connect FreiChat with AlphaUserPoints!!!

Hello there!!!

I have installed the AlphaUserPoint joomla extension and I want to have the option to see user's profile when I click on a user's name in FreiChat!!! Can anybody help me do this???

Thank you in advance!!!

Hello there!!! I have installed the AlphaUserPoint joomla extension and I want to have the option to see user's profile when I click on a user's name in FreiChat!!! Can anybody help me do this??? Thank you in advance!!!
www.greenmadness.net

As I was searching, I found this API Manual. It seems very useful, but only for someone that can understand where to put all those things!!! In page 6 of this manual, it says how I should do this but I don't now where should I put those part of code and in which FreiChat file to include it!!!

What I want to do, is to place a small icon next to user's name and when I click on it, it will show me user's profile (AUP user's profile). I know it's simple but not for me!!! I am a kind of self-educated in "programming" and as you can understand, my knowledge has close limitations!!! I would be really grateful if someone help me!!! In other hand, if all this costs, we can talk about it!!!

Thank you anyway!!!

As I was searching, I found this <a href="http://www.alphaplug.com/index.php/downloads.html?func=startdown&id=25">API Manual</a>. It seems very useful, but only for someone that can understand where to put all those things!!! In page 6 of this manual, it says how I should do this but I don't now where should I put those part of code and in which FreiChat file to include it!!! What I want to do, is to place a small icon next to user's name and when I click on it, it will show me user's profile (AUP user's profile). I know it's simple but not for me!!! I am a kind of self-educated in "programming" and as you can understand, my knowledge has close limitations!!! I would be really grateful if someone help me!!! In other hand, if all this costs, we can talk about it!!! Thank you anyway!!!
www.greenmadness.net

when you are in a particular profile, just see how the URL looks like, does it have an ID or username which uniquely identifies a person?
you will have to edit the chat code to insert this ID as a link to the profile page.

when you are in a particular profile, just see how the URL looks like, does it have an ID or username which uniquely identifies a person? you will have to edit the chat code to insert this ID as a link to the profile page.
Necessity is the mother of all inventions!

I got what you said and it was really helpful but, take a look at the link that creates!!! It doesn't read user's ID but user's REFFERID!!! I took a look in to my database tables and this number it's a REFFERID!!! So it would be really easy if this thing was read user's ID and not this REFFERID. What should I do in this case?

http://greenmadness.net/site/index.php?option=com_alphauserpoints&view=account&userid=GMS-4DD23EBDF164A&Itemid=24

Thank you very much for your answer!!!

I got what you said and it was really helpful but, take a look at the link that creates!!! It doesn't read user's ID but user's REFFERID!!! I took a look in to my database tables and this number it's a REFFERID!!! So it would be really easy if this thing was read user's ID and not this REFFERID. What should I do in this case? http://greenmadness.net/site/index.php?option=com_alphauserpoints&view=account&userid=GMS-4DD23EBDF164A&Itemid=24 Thank you very much for your answer!!!
www.greenmadness.net

Well... I found something but I need your help here!!! Take a look... I add this part of code into server/freichat.php file:

$user_ref_query = "SELECT a.referreid FROM jos_alpha_userpoints AS a WHERE a.userid = '". $res['session_id'] ."'";


I added that part of code into public function get_members() before $text variable that creates the userlist. The query is working (i have test it) but when I am trying to to get query's result as value it gives me the whole query as text!!! In other words, I am placing the variable $user_ref_query into $text content, and instead of query's result (numbers & letters) I am getting the part of query's code!!!

Can you please help me on this??? What should I do to take query's result and not query's code???

Thank you for your time!!!

Well... I found something but I need your help here!!! Take a look... I add this part of code into server/freichat.php file: <code>$user_ref_query = "SELECT a.referreid FROM jos_alpha_userpoints AS a WHERE a.userid = '". $res['session_id'] ."'";</code> I added that part of code into <strong>public function get_members()</strong> before <strong>$text</strong> variable that creates the userlist. The query is working (i have test it) but when I am trying to to get query's result as value it gives me the whole query as text!!! In other words, I am placing the variable <strong>$user_ref_query</strong> into <strong>$text</strong> content, and instead of query's result (numbers & letters) I am getting the part of query's code!!! Can you please help me on this??? What should I do to take query's result and not query's code??? Thank you for your time!!!
www.greenmadness.net

Didnt you execute the query ?

For executing queries you must do something like this

$data = $this->db->query($user_ref_query)->fetchAll();


Now the result will be stored in $data , then just do var_dump($data)
And see if its working .

One more thing , you said you added the query before $text variable .
Make sure you dont execute the query inside the loop , that could be a
tremendous resource waste .

Didnt you execute the query ? For executing queries you must do something like this <code> $data = $this->db->query($user_ref_query)->fetchAll(); </code> Now the result will be stored in $data , then just do var_dump($data) And see if its working . One more thing , you said you added the query before $text variable . Make sure you dont execute the query inside the loop , that could be a tremendous resource waste .
Necessity is the mother of all inventions!

Do you mean to set it out of foreach ($result as $res) but into public function get_members()???

Do you mean to set it out of <strong>foreach ($result as $res)</strong> but into <strong>public function get_members()</strong>???
www.greenmadness.net

Yes , anywhere in the function outside the loop , unless it is
very necessary .

Yes , anywhere in the function outside the loop , unless it is very necessary .
Necessity is the mother of all inventions!

One more thing. Where should I place the var_dump($data)??? Cause even if I place it in or out from foreach ($result as $res) loop, it breaks the whole thing and it doesn't give me even the users list!!! If I make it as comment it works but it gives me the word Array. Take a look on what I am doing:
*
*
*

$user_ref_query = "SELECT a.referreid FROM jos_alpha_userpoints AS a WHERE
a.userid = '". $res['session_id'] ."'";
$data = $this->db->query($user_ref_query)->fetchAll();
//var_dump($data);

foreach ($result as $res) { blah blah blah...

$text.= " <div>blah blah blah... <span>". $data ."</span></div>";

$onlcnt++;
$freichat->user_array[] = $guest;
$freichat->id_array[] = $res['session_id'];
$freichat->img_array[] = $avatar_url;
$logged = true;
}

One more thing. Where should I place the &amp;lt;strong&amp;gt;var_dump($data)&amp;lt;/strong&amp;gt;??? Cause even if I place it in or out from &amp;lt;strong&amp;gt;foreach ($result as $res)&amp;lt;/strong&amp;gt; loop, it breaks the whole thing and it doesn&#039;t give me even the users list!!! If I make it as comment it works but it gives me the word Array. Take a look on what I am doing: * * * &amp;lt;code&amp;gt; $user_ref_query = &quot;SELECT a.referreid FROM jos_alpha_userpoints AS a WHERE a.userid = &#039;&quot;. $res[&#039;session_id&#039;] .&quot;&#039;&quot;; $data = $this-&amp;gt;db-&amp;gt;query($user_ref_query)-&amp;gt;fetchAll(); //var_dump($data); foreach ($result as $res) { blah blah blah... $text.= &quot; &amp;lt;div&amp;gt;blah blah blah... &amp;lt;span&amp;gt;&quot;. $data .&quot;&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&quot;; $onlcnt++; $freichat-&amp;gt;user_array[] = $guest; $freichat-&amp;gt;id_array[] = $res[&#039;session_id&#039;]; $freichat-&amp;gt;img_array[] = $avatar_url; $logged = true; }&amp;lt;/code&amp;gt;
www.greenmadness.net

*
*
*
*
*
*
I found it!!! And it works only if I put it into foreach ($result as $res) loop. Take a look...

$ref_query = "SELECT a.referreid FROM jos_alpha_userpoints AS a WHERE a.userid = '". $res['session_id'] ."'";
$data = $this->db->query($ref_query)->fetchColumn(0);

But now I have an other problem... I am trying to make a link for every user's profile but when I create this link into $text variable, it doesn't show up!!! Here is what I am doing:
<span>
<a href="index.php?option=com_alphauserpoints&view=account&userid=%22.%24data.%22&Itemid=24">
<div id="UserProfile_Normal" onmouseover="id='UserProfile_MOver'" onmouseout="id='UserProfile_MOut'" title="&Pi;&rho;&omicron;&phi;ί&lambda; &Chi;&rho;ή&sigma;&tau;&eta;" alt="profile">&nbsp;</div>
</a>
</span>

Why can't show up???

* * * * * * I found it!!! And it works only if I put it into &amp;lt;strong&amp;gt;foreach ($result as $res)&amp;lt;/strong&amp;gt; loop. Take a look... &amp;lt;code&amp;gt; $ref_query = &quot;SELECT a.referreid FROM jos_alpha_userpoints AS a WHERE a.userid = &#039;&quot;. $res[&#039;session_id&#039;] .&quot;&#039;&quot;; $data = $this-&amp;gt;db-&amp;gt;query($ref_query)-&amp;gt;fetchColumn(0); &amp;lt;/code&amp;gt; But now I have an other problem... I am trying to make a link for every user&#039;s profile but when I create this link into &amp;lt;strong&amp;gt;$text&amp;lt;/strong&amp;gt; variable, it doesn&#039;t show up!!! Here is what I am doing: &amp;lt;code&amp;gt; &amp;lt;span&amp;gt; &amp;lt;a href=&#039;index.php?option=com_alphauserpoints&amp;view=account&amp;userid=&quot;.$data.&quot;&amp;Itemid=24&#039;&amp;gt; &amp;lt;div id=&#039;UserProfile_Normal&#039; onMouseOver= id=&#039;UserProfile_MOver&#039; onMouseOut= id=&#039;UserProfile_MOut&#039; title=&#039;Προφίλ Χρήστη&#039; alt=&#039;profile&#039;&amp;gt;&amp;nbsp;&amp;lt;/div&amp;gt; &amp;lt;/a&amp;gt; &amp;lt;/span&amp;gt; &amp;lt;/code&amp;gt; Why &amp;lt; a href=&quot;&quot;...&amp;gt; can&#039;t show up???
www.greenmadness.net

Its not working outside the loop , because you are using $res['session_id'] which
is actually defined inside the loop .

Anyway , we will think about the optimization part later .

Why can't show up???

Then what is it showing ?
I mean are there any errors ?
Make sure the quotes you are using are escaped properly , in the
string defined in $text variable .

And yes the var_dump() is not required , Use it only for debugging
when you want quick PHP output .

Its not working outside the loop , because you are using $res[&#039;session_id&#039;] which is actually defined inside the loop . Anyway , we will think about the optimization part later . &amp;lt;em&amp;gt; Why &amp;lt; a href=&quot;&quot;...&amp;gt; can&#039;t show up??? &amp;lt;/em&amp;gt; Then what is it showing ? I mean are there any errors ? Make sure the quotes you are using are escaped properly , in the string defined in $text variable . And yes the var_dump() is not required , Use it only for debugging when you want quick PHP output .
Necessity is the mother of all inventions!

Yes I just realized why $res['session_id'] doesn't work outside the loop!!! But what is the problem if we leave it in there???

About the ... I don't know... I tried the very simple thing, to add a simple Test alone to see what will happen but... Nothing!!! It shows everything except part. No errors, nothing. Everything looks fine, just part is missing!!!

Here is the code!!!

$text = "<div title='". $res[' status_mesg . onmousedown="\"FreiChat.createChatBoxmesg('"." class='\"freichat_userlist\"' onmouseover="\"\$jn(this).addClass('freichat_userlist_hover');\"" onmouseout="\"\$jn(this).removeClass('freichat_userlist_hover');\"">

<span class='\"freichat_userscontentname\"'>". (strlen($guest) > 20 ? $this->msubstr($guest, 0, 10). "..." : $guest)."<br><span class='\"status_msg\"'>". $res['status_mesg'] ."
</span>
</span>

<span>&nbsp;<img class="freichat_userscontentstatus" style="padding-top:3px; padding-right:4px;" src="%22.%20%24img_url.%20%22" height="12" width="12" alt="status"></span>

<span>
<a href="index.php?option=com_alphauserpoints&view=account&userid=%22.%24data.%22&Itemid=24">
<div id="UserProfile_Normal" onmouseover="id='UserProfile_MOver'" onmouseout="id='UserProfile_MOut'" title="&Pi;&rho;&omicron;&phi;ί&lambda; &Chi;&rho;ή&sigma;&tau;&eta;" alt="profile">&nbsp;</div>
</a>
</span>

</div>";

Yes I just realized why &amp;lt;strong&amp;gt;$res[&#039;session_id&#039;]&amp;lt;/strong&amp;gt; doesn&#039;t work outside the loop!!! But what is the problem if we leave it in there??? About the &amp;lt;a&amp;gt;... I don&#039;t know... I tried the very simple thing, to add a simple &amp;lt;a href=&#039;&#039;&amp;gt;Test&amp;lt;/a&amp;gt; alone to see what will happen but... Nothing!!! It shows everything except &amp;lt;a&amp;gt; part. No errors, nothing. Everything looks fine, just &amp;lt;a&amp;gt; part is missing!!! Here is the code!!! &amp;lt;code&amp;gt; $text = &quot;&amp;lt;div title=&#039;&quot;. $res[&#039;status_mesg&#039;] .&quot;&#039; onmousedown=\&quot;FreiChat.createChatBoxmesg(&#039;&quot;. $guest. &quot;&#039;,&#039;&quot;. $res[&#039;session_id&#039;]. &quot;&#039;)\&quot; class=\&quot;freichat_userlist\&quot; onmouseover=\&quot;\$jn(this).addClass(&#039;freichat_userlist_hover&#039;);\&quot; onmouseout=\&quot;\$jn(this).removeClass(&#039;freichat_userlist_hover&#039;);\&quot;&amp;gt; &amp;lt;span class=\&quot;freichat_userscontentname\&quot;&amp;gt;&quot;. (strlen($guest) &amp;gt; 20 ? $this-&amp;gt;msubstr($guest, 0, 10). &quot;...&quot; : $guest).&quot;&amp;lt;br /&amp;gt; &amp;lt;span class=\&quot;status_msg\&quot;&amp;gt;&quot;. $res[&#039;status_mesg&#039;] .&quot; &amp;lt;/span&amp;gt; &amp;lt;/span&amp;gt; &amp;lt;span&amp;gt;&amp;nbsp;&amp;lt;img class =&#039;freichat_userscontentstatus&#039; style=&#039;padding-top:3px; padding-right:4px;&#039; src=&#039;&quot;. $img_url. &quot;&#039; height=&#039;12&#039; width=&#039;12&#039; alt=&#039;status&#039;/&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span&amp;gt; &amp;lt;a href=&#039;index.php?option=com_alphauserpoints&amp;view=account&amp;userid=&quot;.$data.&quot;&amp;Itemid=24&#039;&amp;gt; &amp;lt;div id=&#039;UserProfile_Normal&#039; onMouseOver= id=&#039;UserProfile_MOver&#039; onMouseOut= id=&#039;UserProfile_MOut&#039; title=&#039;Προφίλ Χρήστη&#039; alt=&#039;profile&#039;&amp;gt;&amp;nbsp;&amp;lt;/div&amp;gt; &amp;lt;/a&amp;gt; &amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&quot;; &amp;lt;/code&amp;gt;
www.greenmadness.net

Yes I just realized why $res['session_id'] doesn't work outside the loop!!! But what is the problem if we leave it in there???

About the ... I don't know... I tried the very simple thing, to add a simple Test alone to see what will happen but... Nothing!!! It shows everything except part. No errors, nothing. Everything looks fine, just part is missing!!!

Here is the code!!!

$text = "<div title='". $res[' status_mesg . onmousedown="\"FreiChat.createChatBoxmesg('"." class='\"freichat_userlist\"' onmouseover="\"\$jn(this).addClass('freichat_userlist_hover');\"" onmouseout="\"\$jn(this).removeClass('freichat_userlist_hover');\"">

<span class='\"freichat_userscontentname\"'>". (strlen($guest) > 20 ? $this->msubstr($guest, 0, 10). "..." : $guest)."<br><span class='\"status_msg\"'>". $res['status_mesg'] ."
</span>
</span>

<span>&nbsp;<img class="freichat_userscontentstatus" style="padding-top:3px; padding-right:4px;" src="%22.%20%24img_url.%20%22" height="12" width="12" alt="status"></span>

<span>
<a href="index.php?option=com_alphauserpoints&view=account&userid=%22.%24data.%22&Itemid=24">
<div id="UserProfile_Normal" onmouseover="id='UserProfile_MOver'" onmouseout="id='UserProfile_MOut'" title="&Pi;&rho;&omicron;&phi;ί&lambda; &Chi;&rho;ή&sigma;&tau;&eta;" alt="profile">&nbsp;</div>
</a>
</span>

</div>";

Yes I just realized why &amp;lt;strong&amp;gt;$res[&#039;session_id&#039;]&amp;lt;/strong&amp;gt; doesn&#039;t work outside the loop!!! But what is the problem if we leave it in there??? About the &amp;lt; a&amp;gt;... I don&#039;t know... I tried the very simple thing, to add a simple &amp;lt; a href=&#039;&#039;&amp;gt;Test&amp;lt; /a&amp;gt; alone to see what will happen but... Nothing!!! It shows everything except &amp;lt; a&amp;gt; part. No errors, nothing. Everything looks fine, just &amp;lt; a&amp;gt; part is missing!!! Here is the code!!! &amp;lt;code&amp;gt; $text = &quot;&amp;lt;div title=&#039;&quot;. $res[&#039;status_mesg&#039;] .&quot;&#039; onmousedown=\&quot;FreiChat.createChatBoxmesg(&#039;&quot;. $guest. &quot;&#039;,&#039;&quot;. $res[&#039;session_id&#039;]. &quot;&#039;)\&quot; class=\&quot;freichat_userlist\&quot; onmouseover=\&quot;\$jn(this).addClass(&#039;freichat_userlist_hover&#039;);\&quot; onmouseout=\&quot;\$jn(this).removeClass(&#039;freichat_userlist_hover&#039;);\&quot;&amp;gt; &amp;lt;span class=\&quot;freichat_userscontentname\&quot;&amp;gt;&quot;. (strlen($guest) &amp;gt; 20 ? $this-&amp;gt;msubstr($guest, 0, 10). &quot;...&quot; : $guest).&quot;&amp;lt;br /&amp;gt; &amp;lt;span class=\&quot;status_msg\&quot;&amp;gt;&quot;. $res[&#039;status_mesg&#039;] .&quot; &amp;lt;/span&amp;gt; &amp;lt;/span&amp;gt; &amp;lt;span&amp;gt;&amp;nbsp;&amp;lt;img class =&#039;freichat_userscontentstatus&#039; style=&#039;padding-top:3px; padding-right:4px;&#039; src=&#039;&quot;. $img_url. &quot;&#039; height=&#039;12&#039; width=&#039;12&#039; alt=&#039;status&#039;/&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span&amp;gt; &amp;lt;a href=&#039;index.php?option=com_alphauserpoints&amp;view=account&amp;userid=&quot;.$data.&quot;&amp;Itemid=24&#039;&amp;gt; &amp;lt;div id=&#039;UserProfile_Normal&#039; onMouseOver= id=&#039;UserProfile_MOver&#039; onMouseOut= id=&#039;UserProfile_MOut&#039; title=&#039;Προφίλ Χρήστη&#039; alt=&#039;profile&#039;&amp;gt;&amp;nbsp;&amp;lt;/div&amp;gt; &amp;lt;/a&amp;gt; &amp;lt;/span&amp;gt; &amp;lt;/div&amp;gt;&quot;; &amp;lt;/code&amp;gt;
www.greenmadness.net

The string is not escaped properly .

Try outputting a simple link by doing

$string .= "<a href="#"> Test link </a>";
And see what happens

The string is not escaped properly . Try outputting a simple link by doing &amp;lt;code&amp;gt; $string .= &quot;&amp;lt;a href=&#039;#&#039; &amp;gt; Test link &amp;lt;/a&amp;gt;&quot;; &amp;lt;/code&amp;gt;And see what happens
Necessity is the mother of all inventions!

There is some problem ,
The code i had posted here is not being shown correctly in the forums

i have edited my previous post .

There is some problem , The code i had posted here is not being shown correctly in the forums i have edited my previous post .
Necessity is the mother of all inventions!

Where is your edited part of code??? I can't see something in here!!!

Where is your edited part of code??? I can&#039;t see something in here!!!
www.greenmadness.net
123
269
44
0
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft