Forum

Forum - DatingScript

Online dating software

You are not logged in.

#1 2017-11-14 12:16:22

levelup
Member

MOD - Profile pictures in PHPBB

This mod is for people who use PHPBB as forum.
It can also be used for other forums but i don't have them installed.
The mod is pretty straight forward and easy to install.
It displays the profile picture from datingscript as an avatar in PHPBB

Have fun with it

1) create a file called "viewthumb.php" with the following code and place it in the root of your website!

<?php 

/* 
* View User Profile Pictures in PHPBB 3.2.1 for DS v1.2.7
* Author: Mark | webmaster@girlslovegirls.net 
* Website: https://www.girlslovegirls.net 
* Version: 0.2Beta
*
* Inspired by the viewthumbnail mod for VLDPersonals by Steve
*/ 

/* Establish The database connection and set paths */
/* First we need the FULL path to your datingscript config file */

include_once "/your_full_home_dir_path/application/config.php"; 

/* Reading the config file settings for use in the script */

define('db_server',		$database['hostname']);
define('db_username',		$database['username']);
define('db_password',		$database['password']);
define('db_name',		$database['database']);
define('table_prefix',		$database['prefix']);
define('siteroot', 		$config['base_url']);

/* Set the folder where to profile pictures are located, mostly /uploads */

$upload_path = "/uploads"; 

/* If the user has no profile picture, set a default one we can use */

$default = "http://www.yourdomain.com/no_avatar.gif"; 

/* Don't Edit below this line unless you know what you are doing */ 

$user = $_GET['user'];

/* Secure for SQL Injection */

if (preg_match('#^[A-Za-z0-9_-]{3,20}$#s', $user, $matches)) {
}
else 
{
  exit();
}

/* Connect to the database */

$dbcnx = @($GLOBALS["___mysqli_ston"] = mysqli_connect(db_server,  db_username,  db_password)); 
if (!$dbcnx) { 
  echo( "<P>Unable to connect to the " . 
        "database server at this time. No Connection!</P>" ); 
  exit(); 
} 

if (! @((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE " . db_name)) ) { 
  echo( "<P>Unable to locate the " . 
        "database at this time.</P>" ); 
  exit(); 
} 

/* Select the picture id for the user */

$picid = "SELECT m.* FROM " . table_prefix . "users AS m WHERE m.username='$user'"; 

$result = mysqli_query($GLOBALS["___mysqli_ston"], $picid); 

while($row = mysqli_fetch_array($result,  MYSQLI_ASSOC)) 
{ 
    $photo = $row['picture_id']; 
    $member_id = $row['user_id']; 
} 

/* Select the picture name, location and extension */

$pic = "SELECT m.* FROM " . table_prefix . "storage_files AS m WHERE m.file_id='$photo'"; 

$picture = mysqli_query($GLOBALS["___mysqli_ston"], $pic); 

while($row = mysqli_fetch_array($picture,  MYSQLI_ASSOC)) 
{ 
    $path = $row['path']; 
    $name = $row['name']; 
    $extension = $row['extension']; 
} 


((is_null($___mysqli_res = mysqli_close($dbcnx))) ? false : $___mysqli_res); 

/* 
* Print the content of the requested picture for use in PHPBB
* Display default profile picture if users has none
*/

if($name){
	echo file_get_contents(siteroot .$upload_path.'/'.$path.'/'.$name.'_t'.'.'.$extension);
}
else
{
	readfile($default);
}

?> 

2) edit the "viewtopic_body.html" wich is located in your styles/template folder of phpbb

replace the code between
<!-- EVENT viewtopic_body_avatar_before --> and <!-- EVENT viewtopic_body_avatar_after -->
with this code

<img src="https://www.yourdomain.com/viewthumb.php?user={postrow.POST_AUTHOR}" alt="{postrow.POST_AUTHOR}"/>

I hope this is usefull for you and thanks if you use it!

Online

#2 2017-11-15 09:33:42

littlebit
Member

Re: MOD - Profile pictures in PHPBB

Great, tnx Mark !

Offline

#3 2018-12-16 02:31:41

novalava
Member

Re: MOD - Profile pictures in PHPBB

Hello,
Is this code working for DS v1.3.1 and PHPBB v3.2.2? 
I implemented this code, but it's not working.  I would appreciate any ideas.
Rob

Offline

#4 2019-03-07 11:22:38

rdog
Member

Re: MOD - Profile pictures in PHPBB

novalava wrote:

Hello,
Is this code working for DS v1.3.1 and PHPBB v3.2.2? 
I implemented this code, but it's not working.  I would appreciate any ideas.
Rob

I don't think it works after v1.3.1 tried just seeing if you could just view the image using https://www.mysite.com/viewthumb.php?user=testuser
it didn't bring up the picture just a blank page, so I tired it with a user who didn't have a image,  instead of bringing up the default image, it brought up a page that looks like image code on the page instead of a image

PNG  IHDR22?sRGBgAMA a pHYsodIDAThCZ T>o3j(jbMզb1HmMqkL5)b͚jd T@HXs{;ᄍ3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B`

I decided to change the default image to something else and noticed that the code changed by image, so the code was specific to each image. see the images just can't decode them.

Last edited by rdog (2019-03-07 23:16:37)

Offline

Board footer