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 ?
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 ? |
You will need to pass the logged in user ID to the photo search function. Geeks, making the world a better place |
How ? |
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 |
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 ? |
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! |
@newton27: 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 ! |
Jobs section may help you.. "Your future is created by what you do today, not tomorrow." @ www.dexpertz.net |
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 |
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.... |
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 |
there is this function on BxDolProfile.php:
function getProfileThumbnail( $float )
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')
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'); screenshot of example: http://www.boonex.com/forums/?action=download&hash=SKS7XrNBw2
hope this helps caredesign.net |
@Prashank25 : 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 ? |
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 |
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 ! |
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 |
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)
|
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:
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 |
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 |
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:
}
caredesign.net |
$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 |
$rProfile = mysql_query("SELECT * FROM Profiles WHERE ID = '$memID'"); |
$rProfile = mysql_query("SELECT * FROM Profiles WHERE ID = '$memID'"); Now the query is working. I have enabled Avatar module, also I have set profile picture but I am getting the result 0 Why ? |
lets start with this: $rProfile = mysql_query("SELECT * FROM Profiles WHERE ID = '$memID'"); echo $Avatar;
see if this gives a number other than 0 caredesign.net |
lets start with this: $rProfile = mysql_query("SELECT * FROM Profiles WHERE ID = '$memID'"); echo $Avatar;
see if this gives a number other than 0 I got 0 |
Are you there? You didn't reply for so many days ! |
i sent you a PM 4 days ago. lol caredesign.net |
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'] = " it should be:
caredesign.net |
@Prashank25 : 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 ? Thank you for giving your time. I was checking with my another account which had Avatar but It had 0 value. I again uploaded Avatar and now I am getting some value for it. I want the full size photo not the thumbnail size. http://mywebsite.com/m/photos/get_image/file/72ad7495adaf8668e91f4c1563cfba97.jpg How to get this ? Please help! |
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 |
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! |