Friend Request

In Dolphin it is not very obvious when someone is requesting to befriend. You have to go to accounts, and then activities.

So, my solution to this is as follows

Use Deanos Tools to add a PHP block code to the HOMEPAGE and add the following code;

$iProfileID = getID( $_GET['ID'] );
$oDb = new BxDolDb();
$sSQLQuery = "SELECT Profile FROM `sys_friend_list` WHERE `Profile` = $iProfileID AND `Check` = 0;";
$sProfile= $oDb->getColumn($sSQLQuery);

if ( $sProfile[0] != 0 ) {
echo "<A href='http://www.YOURDOMAINNAMEHERE.COM/communicator.php'>
<table> <tr bgcolor=\"#FFFF00\"><td> You have a friend request !</td></tr> </table> </A>";
}


 

I have this block of code at the top, so that it cannot be missed.

Thats all, have fun!

W//

Quote · 11 Mar 2011

Thanks, working perfect!

Kids first
Quote · 11 Mar 2011

I gave you a point, you deserve 1,000!

I have been wanting something like this for a year!!

ManOfTeal.COM a Proud UNA site, six years running strong!
Quote · 11 Mar 2011

I have wanted this for so long that I had forgot that I wanted it!

Me give you big point too!

Thanks....

http://towtalk.net ... Hosted by Zarconia.net!
Quote · 11 Mar 2011

This is an awesome piece of code.  I wish I would have found this about a month ago.  Thanks for providing this!

Quote · 29 Mar 2011

Great - many thanks - I have also added it to my account page - top marks

Quote · 26 Apr 2011

For some reason this wont work in IE9 for me, works very well in firefox etc - but not IE - has anyone else had this problem or solution?

many thanks, mark

Quote · 12 May 2011

 

For some reason this wont work in IE9 for me, works very well in firefox etc - but not IE - has anyone else had this problem or solution?

many thanks, mark

 

I'm seeing this more and more of this on D7 sites...

"IMPORTANT - Please use FireFox 4.0 or better when viewing this site **

Develop in IE, make members use FireFox; it's a feat when someone has only used IE..

Most are like, what the heck is FF..     :/

ManOfTeal.COM a Proud UNA site, six years running strong!
Quote · 14 May 2011

It may be becuse IE9 is much stricter when it comes to standards than ever before and it may not like the html code being used.

This piece of code is not properly written.

if ( $sProfile[0] != 0 ) {
echo "<A href='http://www.YOURDOMAINNAMEHERE.COM/communicator.php'>
<table> <tr bgcolor=\"#FFFF00\"><td> You have a friend request !</td></tr> </table> </A>";
}

This places a table inside a link which is not how a link should be done. It also uses single quotes in the html which should be double quotes. The quotes most likley don't matter, but i fixed that also.

Try this code instead which is more compliant with html standards.

if ( $sProfile[0] != 0 ) {
echo '
<table>
<tr bgcolor="#FFFF00">
<td><a href="http://www.YOURDOMAINNAMEHERE.COM/communicator.php">You have a friend request !</a></td>
</tr>
</table>
';
}

https://www.deanbassett.com
Quote · 14 May 2011

 

It may be becuse IE9 is much stricter when it comes to standards than ever before and it may not like the html code being used.

This piece of code is not properly written.

if ( $sProfile[0] != 0 ) {
echo "<A href='http://www.YOURDOMAINNAMEHERE.COM/communicator.php'>
<table> <tr bgcolor=\"#FFFF00\"><td> You have a friend request !</td></tr> </table> </A>";
}

This places a table inside a link which is not how a link should be done. It also uses single quotes in the html which should be double quotes. The quotes most likley don't matter, but i fixed that also.

Try this code instead which is more compliant with html standards.

if ( $sProfile[0] != 0 ) {
echo '
<table>
<tr bgcolor="#FFFF00">
<td><a href="http://www.YOURDOMAINNAMEHERE.COM/communicator.php">You have a friend request !</a></td>
</tr>
</table>
';
}

 Deano! You always ROCK!

ManOfTeal.COM a Proud UNA site, six years running strong!
Quote · 14 May 2011

Thank you so much Deano

Quote · 14 May 2011

Should be added to the product, but it probably won't be.

Quote · 14 May 2011

Thank you.

I added a couple of lines of code to your sample :

$iProfileID = getID( $_GET['ID'] );
$oDb = new BxDolDb();
$aCount = db_arr("SELECT COUNT(*) FROM `sys_friend_list` WHERE `Profile` = '$iProfileID' AND `Check` = 0 ");
if($aCount[0]>0){
$sText = ($aCount[0]>1) ? _t('_pending_frs',$aCount[0]) : _t('_pending_fr',$aCount[0]);
$sMsg='<table><tr bgcolor="#FFFF00"><td><a href="' . $site['url'] . '/communicator.php">' . $sText . '</a></td></tr></table>';
echo $sMsg;
$query="SELECT *,UNIX_TIMESTAMP( `sys_friend_list`.`When`) AS 'When_UTS' FROM `sys_friend_list` WHERE `Profile` = '$iProfileID' AND `Check` = 0";
$Requests=db_res($query);
$sReturn='';
while ($eachrequest = mysql_fetch_array($Requests))
{
$sNickName = getNickName($eachrequest['ID']);
$sReturn .= '<div class="browse_thumb" style ="float:left;margin:0 0 10px; overflow:hidden; width:122px; position:relative;">'.get_member_thumbnail($eachrequest['ID'], 'left', true ).' '.getLocaleDate($eachrequest['When_UTS'],BX_DOL_LOCALE_DATE).'</div>';
}
echo $sReturn;
}

You nedd to create two languages keys :

_pending_frs with i.e. 'You have {0} pending friend requests.' and _pending_fr with i.e.  'You have {0} pending friend requests.'

Quote · 20 May 2011

Many thanx!

It's a great mod! A must have for all Dolphin sites!

Rappi

Bezirzer.de, elbrocker.de, tierschutz-community.de
Quote · 2 Jun 2011

Which one works best out of these? Deanos or todoswingers? Has anyone tested both?

Quote · 14 Jul 2011

Nice to see that my 'code' is evolving .. :-)

Quote · 11 Aug 2011

I'm new to dolphin but I  was wondering if someone could write a step by step on how to place this code on the script.

Quote · 5 Sep 2011

wannabe & deano

 

THANK YOU! This fixes something we've been lamenting for ages

 

monteqristo

1. Go to market and get Deano's Tools (it's free and it should be incorporated into Dolphin as part of the actual code, it is BY FAR THE MOST USEFUL THING ON MY ENTIRE DOLPHIN INSTALL)

2. Install Deano's Tools

3. Go to Admin>Modules>Deano's Tool's>Insert PHP Block

4. Pick where you want it to go (I actually put mine on the Dashboard instead of the Homepage)

5. Make a lang key "_Friend_Requests_on_Dashboard" or whatevs.

6. Insert the text you want the lang key to show "Friend Requests" or whatevs.

7. Insert the code:

$iProfileID = getID( $_GET['ID'] );
$oDb = new BxDolDb();
$sSQLQuery = "SELECT Profile FROM `sys_friend_list` WHERE `Profile` = $iProfileID AND `Check` = 0;";
$sProfile= $oDb->getColumn($sSQLQuery);

if ( $sProfile[0] != 0 ) {
echo '
<table>
<tr bgcolor="#FFFF00">
<td><a href="http://greedysnobs.com/communicator.php">You have a friend request !</a></td>
</tr>
</table>
';
}

into the code box.

8. Save.

9. Go to Admin>Builders>Page Blocks> whatever page you put in earlier.

10. Drag the Friend Requests block that is now in the inactive blocks section to where ever you want it to be.

Quote · 9 Sep 2011

How can i do it and with invites from groups? This is perfect and i want it and for invites from groups!

Is possible that, and if is can you help me?

Quote · 8 Nov 2011

Thanks to all of you guys. I am a nubi with Dolphin and still can't find my arms and legs around. I am looking for answers for totaly diiferent problems right now (like how to set global privacy settings, or how to connect photo albums to profiles and not to general album page and many more...) but this little script and the very detailed explanation of ggsin were very helpful!! downloaded the module, inserted the block and on the way managed to understand a bit better how Dolphin work!!

So thanks again Smile

Quote · 14 Dec 2011

 

It may be becuse IE9 is much stricter when it comes to standards than ever before and it may not like the html code being used.

This piece of code is not properly written.

if ( $sProfile[0] != 0 ) {
echo "<A href='http://www.YOURDOMAINNAMEHERE.COM/communicator.php'>
<table> <tr bgcolor=\"#FFFF00\"><td> You have a friend request !</td></tr> </table> </A>";
}

This places a table inside a link which is not how a link should be done. It also uses single quotes in the html which should be double quotes. The quotes most likley don't matter, but i fixed that also.

Try this code instead which is more compliant with html standards.

if ( $sProfile[0] != 0 ) {
echo '
<table>
<tr bgcolor="#FFFF00">
<td><a href="http://www.YOURDOMAINNAMEHERE.COM/communicator.php">You have a friend request !</a></td>
</tr>
</table>
';
}

 Hi...

  How can use a _lang_key to say " You have a friend request" because I have 2 languages.  This script worked perfectly well for me, just need to show the message in other language too.

   

Quote · 23 Jun 2012

To use a language key change this line.


<td><a href="http://www.YOURDOMAINNAMEHERE.COM/communicator.php">You have a friend request !</a></td>

To

<td><a href="http://www.YOURDOMAINNAMEHERE.COM/communicator.php">' . _t('_my_lang_key') . '</a></td>

https://www.deanbassett.com
Quote · 23 Jun 2012

 

To use a language key change this line.


<td><a href="http://www.YOURDOMAINNAMEHERE.COM/communicator.php">You have a friend request !</a></td>

To

<td><a href="http://www.YOURDOMAINNAMEHERE.COM/communicator.php">' . _t('_my_lang_key') . '</a></td>

 Big Thank You, Deano... Wink

Quote · 23 Jun 2012

I tried this multiple times using 7.1.9 and got the block comes up with an error

 

Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/mydatabase/public_html/mysite/inc/classes/BxDolPageView.php(607) : eval()'d code on line 1

 

???

Quote · 26 Jun 2012

 

I tried this multiple times using 7.1.9 and got the block comes up with an error

 

Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/mydatabase/public_html/mysite/inc/classes/BxDolPageView.php(607) : eval()'d code on line 1

 

???

 The first line is this. $iProfileID = getID( $_GET['ID'] ); And your error says there is a syntax error on the first line. Missing ;

Sorry. don't know what to tell you. You have to be doing something wrong. There is nothing wrong with the code here.

Try something simpler to start to test you php blocks.

echo 'This is a test';

See if that works.


I really have no explination for your problems.


https://www.deanbassett.com
Quote · 26 Jun 2012

 tried echo 'This is a test'; and got the same error..

 

 

I tried this multiple times using 7.1.9 and got the block comes up with an error

 

Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/mydatabase/public_html/mysite/inc/classes/BxDolPageView.php(607) : eval()'d code on line 1

 

???

 The first line is this. $iProfileID = getID( $_GET['ID'] ); And your error says there is a syntax error on the first line. Missing ;

Sorry. don't know what to tell you. You have to be doing something wrong. There is nothing wrong with the code here.

Try something simpler to start to test you php blocks.

echo 'This is a test';

See if that works.


I really have no explination for your problems.


 

Quote · 26 Jun 2012

Hi,

this php block become unusable after upgrade to D7.1.x

How can it be repaird to show correctly?

Now it'is hidden behaind other page block:

 

code now is as follow:

$iProfileID = getID( $_GET['ID'] );

$oDb = new BxDolDb();

$aCount = db_arr("SELECT COUNT(*) FROM `sys_friend_list` WHERE `Profile` = '$iProfileID' AND `Check` = 0 ");

if($aCount[0]>0){

$sText = ($aCount[0]>1) ? _t('_pending_frs',$aCount[0]) : _t('_pending_fr',$aCount[0]);

$sMsg='<table><tr bgcolor="#FF33FF"><td><a href="' . $site['url'] . '/dolphin_root_folder/communicator.php">' . $sText . '</a></td></tr></table>';

echo $sMsg;

$query="SELECT *,UNIX_TIMESTAMP( `sys_friend_list`.`When`) AS 'When_UTS' FROM `sys_friend_list` WHERE `Profile` = '$iProfileID' AND `Check` = 0";

$Requests=db_res($query);

$sReturn='';

while ($eachrequest = mysql_fetch_array($Requests))

{

$sNickName = getNickName($eachrequest['ID']);

$sReturn .= '<div class="browse_thumb" style ="float:left;margin:0 0 10px; overflow:hidden; width:122px; position:relative;">'.get_member_thumbnail($eachrequest['ID'], 'left', true ).' '.getLocaleDate($eachrequest['When_UTS'],BX_DOL_LOCALE_DATE).'</div>';

}

echo $sReturn;

}

Greetings

Mayki

image.png · 277.3K · 1042 views
"When things get tough the tough get going..."
Quote · 16 Mar 2013

Hi guys, 

Thanks for the tips, I have an issue, whenevery I try to add the php block using denos it doesn´t work, I have added it several times and it desn´t appear on the pages where I place it, any ideas what I may be doing wrong?

Alexander. 

Quote · 16 May 2014

 

Hi guys, 

Thanks for the tips, I have an issue, whenevery I try to add the php block using denos it doesn´t work, I have added it several times and it desn´t appear on the pages where I place it, any ideas what I may be doing wrong?

Alexander. 

 
Explain in more detail the steps your taking.

After adding the php block, do you go to the page builders to the page you added it to and look for it in the inactive section and drag it into the page where you want it to appear?

Also note that php blocks do not appear if the code used within the block does not return any displayable result. In which case, we need to see the code you are using in the block as well. So if your using the code at the beginning of this topic, that block will not show up unless there is a friend request to show.

Also do a test block that contains only the code

echo 'Test';

Which will verify the block is working.

Unfortunately unless your provide specific details on what your doing, then we can't answer your question "any ideas what I may be doing wrong?"

https://www.deanbassett.com
Quote · 16 May 2014
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.