How to get Logged in User's profile picture URL ?

Just like to get Logged in user's ID, we use  $_COOKIE['memberID'];

For getting Logged in User's Name, we use

$memID = $_COOKIE['memberID'];

getNickName($memID);

 

How to get Logged in user's profile picture URL ?

Quote · 30 Aug 2015

You will need to pass the logged in user ID to the photo search function.

Geeks, making the world a better place
Quote · 30 Aug 2015

How ?

Quote · 30 Aug 2015

How?  What are your programming skills?  We don't have enough information on what you are trying to accomplish..

Geeks, making the world a better place
Quote · 30 Aug 2015

I am very new to programming. I have vanilla forum installed at my subdomain. Keeping Dolphin as main website, I want to implement Single Sign On. I am using jsConnect. It requires following details in a json file.

$user['uniqueid'] = ' ';

$user['name'] = ' ';

$user['email'] = ' ';

$user['photourl'] = ' ';

See here https://github.com/vanilla/jsConnectPHP/blob/master/index.php

 

First 3 I am able to provide. Now I need photourl for logged in user.

Tell me how to get that detail ?

Quote · 30 Aug 2015

 Use the search box top right, it's very revealing...

Tell me how to get that detail ?

 search Boonex for "$user['photourl'] = ' ';" returns

http://www.boonex.com/googlesearch/search?q=%24user%5B%27photourl%27%5D+%3D+%27+%27%3B&gse_filter=googlesearch

from this site search,

http://www.boonex.com/forums/topic/Looking-for-technical-details-on-profile-photos.htm

Those may help you.

ManOfTeal.COM a Proud UNA site, six years running strong!
Quote · 30 Aug 2015

@I already searched on boonex forum and also on the web. I didn't get anything there, that's why I asked here.

I didn't get answer to my question even on the link you provided !

Quote · 30 Aug 2015

Jobs section may help you..

"Your future is created by what you do today, not tomorrow." @ www.dexpertz.net
Quote · 30 Aug 2015

 

Jobs section may help you..

 Simplest answer !!


Can anyone tell me the real answer ? 

Quote · 30 Aug 2015

 

 

Jobs section may help you..

 Simplest answer !!


Can anyone tell me the real answer ? 

You still have not told us what you want to accomplish.  Here is the answer, start learning the structure of Dolphin.  If you want to do a direct query on the database, the profile photo is the first; by sort order, in the user's profile photo album.  So when you get the user id you can then query the database to find out the id of the member's profile photo album then you can retrieve that information and continue along to build the profile photo URL.

You can also study the functions in the search file of the photo module to gain an understanding of how to generate a member's profile photo URL

Developers are busy updating and checking modules for the upcoming 7.2 release so you probably won't get any of them coming in and giving you a function to generate a member's profile photo URL.

The idea of posting in the jobs section, http://boonex.com/jobs with an incentive of payment might get someone willing to spend the time to do it for you.  However, even then you need to be specific in what you want to accomplish it and where on the site you wish to accomplish it.

Geeks, making the world a better place
Quote · 30 Aug 2015

check this http://www.boonex.com/forums/topic/chatroll-as-a-boonex-lobby-chat-.htm

and the function is

get_member_thumbnail

Defined in inc/design.inc.php at ~175

so much to do....
Quote · 31 Aug 2015

I think the idea is to get the URL to the profile photo in the profile photo album so that it can be access directly.

Geeks, making the world a better place
Quote · 31 Aug 2015

there is this function on BxDolProfile.php:

 

    function getProfileThumbnail( $float )
    {
        $ret = $this -> getProfileImageUrl( $iProfileID, 0);
    }

 

So, you could possibly use this function to get the profile Thumbnail. Not exactly sure how this works - if it determines if avatar module or profile photos are being used. I personally use the Avatar module, and have this to put the avatar in the description block:

 include_once (BX_DIRECTORY_PATH_MODULES . 'boonex/avatar/include.php')
 echo BX_AVA_URL_USER_AVATARS . $aProfile['Avatar'] . BX_AVA_EXT; // avatar image
echo BX_AVA_URL_USER_AVATARS . $aProfile['Avatar'] . 'i'. BX_AVA_EXT; // avatar icon

 

and this is an example in actual usage along with screenshot (I am using it on the profile page, created a php block that merges the avatar and description instead of 2 separate blocks):

 

include_once (BX_DIRECTORY_PATH_MODULES . 'boonex/avatar/include.php');
$profileID = getID( $_GET['ID'] );

  $rProfile = mysql_query("SELECT * FROM Profiles WHERE ID = '$profileID'");
while ($row_profile = mysql_fetch_array($rProfile)) {
$Avatar = $row_profile["Avatar"];
$DescriptionMe = $row_profile["DescriptionMe"];
}
?>
<table style="margin-top: 10px; margin-right: 10px; margin-left: 10px; font-size: 16px; font-family: chapparral pro;">
  <tr>
    <td><table width="80" border="0" align="left">
<tr>
<td align="center" valign="top">
<img src="<?php  
  echo BX_AVA_URL_USER_AVATARS . $Avatar . BX_AVA_EXT; // avatar image
 ?>" width="64" height="64"></td>
</tr>
</table><?php echo $DescriptionMe ?></td>
  </tr>
</table>
<?php { }

screenshot of example:

http://www.boonex.com/forums/?action=download&hash=SKS7XrNBw2

 

hope this helps

caredesign.net
Quote · 31 Aug 2015

I added this to inc/design.inc.php

function get_member_pic( $ID ) {

    return $GLOBALS['oFunctions']->getMemberAvatar( $iId, $sType = 'small' );

}

 

and in my test.php file

<?php 

require_once( './inc/header.inc.php' );

require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );

$upic = get_member_pic($iID); 

echo $upic;

?>

I got url of the photo which was very very small.

I changed this $sType = 'small'   

to $sType = 'medium'

and then I got image which is larger than the previous one. But still it is not full size image. It is thumbnail size image.

I further changed to $sType = 'large'

This result in nothing. I am getting the same thumbnail size image.

How to get url for full size image ?

Quote · 31 Aug 2015

When I used this code in test.php file

<?php

include_once (BX_DIRECTORY_PATH_MODULES . 'boonex/avatar/include.php')

 echo BX_AVA_URL_USER_AVATARS . $aProfile['Avatar'] . BX_AVA_EXT; // avatar image

echo BX_AVA_URL_USER_AVATARS . $aProfile['Avatar'] . 'i'. BX_AVA_EXT; // avatar icon

?>

I got this error Parse error: syntax error, unexpected T_ECHO in /home/asdf/public_html/www.mywebsite.com/test.php on line 3

 

When I used this 

<?php

require_once( './inc/header.inc.php' );

 include_once (BX_DIRECTORY_PATH_MODULES . 'boonex/avatar/include.php');

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

 

  $rProfile = mysql_query("SELECT * FROM Profiles WHERE ID = '$profileID'"); 

while ($row_profile = mysql_fetch_array($rProfile)) { 

$Avatar = $row_profile["Avatar"];

$DescriptionMe = $row_profile["DescriptionMe"];

?>

<table style="margin-top: 10px; margin-right: 10px; margin-left: 10px; font-size: 16px; font-family: chapparral pro;">

  <tr>

    <td><table width="80" border="0" align="left">

<tr>

<td align="center" valign="top">

<img src="<?php   

  echo BX_AVA_URL_USER_AVATARS . $Avatar . BX_AVA_EXT; // avatar image

 ?>" width="64" height="64"></td>

</tr>

</table><?php echo $DescriptionMe ?></td>

  </tr>

</table>

<?php { }

?>

I got this error

Fatal error: Call to undefined function getID() in /home/asdf/public_html/www.mywebsite.com/test.php on line 4

Quote · 31 Aug 2015

 

 

 

Jobs section may help you..

 Simplest answer !!


Can anyone tell me the real answer ? 

You still have not told us what you want to accomplish.  Here is the answer, start learning the structure of Dolphin.  If you want to do a direct query on the database, the profile photo is the first; by sort order, in the user's profile photo album.  So when you get the user id you can then query the database to find out the id of the member's profile photo album then you can retrieve that information and continue along to build the profile photo URL.

You can also study the functions in the search file of the photo module to gain an understanding of how to generate a member's profile photo URL

Developers are busy updating and checking modules for the upcoming 7.2 release so you probably won't get any of them coming in and giving you a function to generate a member's profile photo URL.

The idea of posting in the jobs section, http://boonex.com/jobs with an incentive of payment might get someone willing to spend the time to do it for you.  However, even then you need to be specific in what you want to accomplish it and where on the site you wish to accomplish it.

 You didn't read my previous comment. I have already told what I want to accomplish. Please check again !

Quote · 31 Aug 2015

OK, look at this file, /moduels/boonex/photos/classes/BxPhotosSearch.php

It will have the information you need.

 

Geeks, making the world a better place
Quote · 31 Aug 2015

please keep in mind that the location of your test.php file can make a big difference. In my usage, the code is placed on a page that is NOT in the dolphin root directory, so the reference to the header.inc.php file would seem to be incorrect. You could try:

require_once( 'inc/header.inc.php' );

or

require_once( '/inc/header.inc.php' );

(not sure which one it should be)

 

Quote · 1 Sep 2015

Sorry - I posted the last message under the wrong account. Just to clarify - my code sample was actually added into the sys_page_compose table in the database.

So- instead of putting the code directly on your test page, put it in a php block or add to database. To better assist you - where exactly are you attempting to put the users profile pic? Then I can probably write it exactly for you.

 

Also, you only need this bit when using in php block in database:

include_once (BX_DIRECTORY_PATH_MODULES . ''boonex/avatar/include.php'');

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

$rProfile = mysql_query("SELECT * FROM Profiles WHERE ID = ''$profileID''"); while ($row_profile = mysql_fetch_array($rProfile)) {

$Avatar = $row_profile["Avatar"];

$DescriptionMe = $row_profile["DescriptionMe"];

}

?>

<table style="margin-top: 10px; margin-right: 10px; margin-left: 10px; font-size: 16px; font-family: chapparral pro;"> <tr> <td><table width="80" border="0" align="left"> <tr> <td align="center" valign="top"> <img src="<?php echo BX_AVA_URL_USER_AVATARS . $Avatar . BX_AVA_EXT; // avatar image ?>" width="64" height="64"></td> </tr> </table><?php echo $DescriptionMe ?></td> </tr> </table> <?php { }


Another quick note - you will have to add a bit of code that checks if the user has an avatar, and if not, then use the standard male/female image.

caredesign.net
Quote · 1 Sep 2015

@

I have installed vanilla forums at my sub domain. I want to implement Single Sign On on vanilla forums. When user is logged in on Dolphin site and when he/she visit vanilla forum then they should get automatically logged in.

There is a plugin in vanilla named jsConnect which works for SSO. It mainly requires 4 information.

$user['uniqueid'] = ' ';

$user['name'] = ' ';

$user['email'] = ' ';

$user['photourl'] = ' ';

 

I provided the information as

$memID = $_COOKIE['memberID'];

$name = getNickName($memID);

$con=mysql_connect("localhost","db_user","password");

if (!$con)

  {

  die('Could not connect: ' . mysql_error());

  }

 mysql_select_db("db_name", $con);

$result = mysql_query("SELECT Email FROM Profiles WHERE ID='$memID'");

if (!$result) {

    echo 'Could not run query: ' . mysql_error();

    exit;

}

$row = mysql_fetch_row($result);

$email = $row[0];


   $user['uniqueid'] = $memID;

   $user['name'] = $name;

   $user['email'] = $email;

   $user['photourl'] = ;


Now I require URL of the logged in user so that I can pass it to $user['photourl'] = ;

How ?


The test.php file is in dolphin root installation.

jsConnect github project https://github.com/vanilla/jsConnectPHP/blob/master/index.php



Quote · 1 Sep 2015

ah - that changes things a bit. I tought you wanted to display within dolphin site, but instead you want the image pulled from your dolphin database. I gotcha.

If you are using the Avatar module, then try this:

$rProfile = mysql_query("SELECT * FROM Profiles WHERE ID = ''$memID''");

while ($row_profile = mysql_fetch_array($rProfile)) {

$Avatar = $row_profile["Avatar"];

}


 $user['photourl'] = "yoursite.com/modules/boonex/avatar/data/images/" . $Avatar;

 


caredesign.net
Quote · 1 Sep 2015

 

$rProfile = mysql_query("SELECT * FROM Profiles WHERE ID = ''$memID''");
while ($row_profile = mysql_fetch_array($rProfile)) {
$Avatar = $row_profile["Avatar"];
}

 Sorry for the very late reply

I have Avatar module enabled, Many of the profile have avatar but looking at the Avatar column in database they have 0 value.

Using your code, I got this error :

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/asdf/public_html/www.mywebsite.com/test.php

Quote · 3 Sep 2015

$rProfile = mysql_query("SELECT * FROM Profiles WHERE ID = '$memID'");
while ($row_profile = mysql_fetch_array($rProfile)) {
$Avatar = $row_profile["Avatar"];
}

Quote · 3 Sep 2015

 

$rProfile = mysql_query("SELECT * FROM Profiles WHERE ID = '$memID'");
while ($row_profile = mysql_fetch_array($rProfile)) {
$Avatar = $row_profile["Avatar"];
}

 Now the query is working. I have enabled Avatar module, also I have set profile picture but I am getting the result 0

Why ?

Quote · 3 Sep 2015

lets start with this:

$rProfile = mysql_query("SELECT * FROM Profiles WHERE ID = '$memID'");
while ($row_profile = mysql_fetch_array($rProfile)) {
$Avatar = $row_profile["Avatar"];
}

echo $Avatar;

 

see if this gives a number other than 0

caredesign.net
Quote · 4 Sep 2015

 

lets start with this:

$rProfile = mysql_query("SELECT * FROM Profiles WHERE ID = '$memID'");
while ($row_profile = mysql_fetch_array($rProfile)) {
$Avatar = $row_profile["Avatar"];
}

echo $Avatar;

 

see if this gives a number other than 0

 I got  0

Quote · 5 Sep 2015

Quote · 8 Sep 2015

i sent you a PM 4 days ago. lol

caredesign.net
Quote · 9 Sep 2015

checked out the site, and I noticed first off that the admin account does not have an avatar - thus the result on test.php was 0. I added an avatar for testing and it does pull up the number for the image I uploaded. One thing I did notice that I messed up on was this:

$user['photourl'] = "yoursite.com/modules/boonex/avatar/data/images/" . $Avatar;

it should be:


$user['photourl'] = "yoursite.com/modules/boonex/avatar/data/images/" . $Avatar . ".jpg";

caredesign.net
Quote · 10 Sep 2015

 

I added this to inc/design.inc.php

function get_member_pic( $ID ) {

    return $GLOBALS['oFunctions']->getMemberAvatar( $iId, $sType = 'small' );

}

 

and in my test.php file

<?php 

require_once( './inc/header.inc.php' );

require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );

$upic = get_member_pic($iID); 

echo $upic;

?>

I got url of the photo which was very very small.

I changed this $sType = 'small'   

to $sType = 'medium'

and then I got image which is larger than the previous one. But still it is not full size image. It is thumbnail size image.

I further changed to $sType = 'large'

This result in nothing. I am getting the same thumbnail size image.

How to get url for full size image ?

 

@Prashank25

I want the full size photo not the thumbnail size. 
Manually looking at the full-size photo URL, it is like this 

http://mywebsite.com/m/photos/get_image/file/72ad7495adaf8668e91f4c1563cfba97.jpg

How to get this ? Please help!

Quote · 10 Sep 2015

well, unfortunately, the converted images that are stored in the Avatar module are only 64 x 64 and 32 x 32, so technically, it is the full size image.

caredesign.net
Quote · 11 Sep 2015

After a long research on the whole database, I found this. It is working for all of my cases. But I do not know whether it is the correct way to do this and whether it will work in all the cases. 

$rProfile = mysql_query("SELECT Hash as pic FROM `bx_photos_main` WHERE Owner = $memID and ID = ( SELECT LastObjId FROM `sys_albums` WHERE Owner = $memID and Uri like '%-s-photos' )");

while ($row_profile = mysql_fetch_array($rProfile)) {

$pic = $row_profile["pic"];

}

$user['photourl'] = "http://mywebsite.com/m/photos/get_image/file/{$pic}.jpg";

 

Everyone, please check and let me know whether this will work on all the case!

Quote · 11 Sep 2015
 
 
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.