phpbb profile page and latest photo/comments/quota tips phpbb profile page and latest photo/comments/quota tips
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

phpbb profile page and latest photo/comments/quota tips

Started by garrynz, March 24, 2005, 07:29:38 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

garrynz

Hi, I have seen a few requests and such on how to add latest uploaded file and comments onto the phpbb userprofile. What you can do is do a cowboy job like I have done. First install phpbb eXtreme Styles mod, this alows you to include files on the phpbb templates. Then copy coppermine profile.php file and give it a different name. Comment out stuff like pageheader($title); , endtable();  , pagefooter(); and trial and error on other stuff to comment out. The 3rd and 4th message on this thread is how to get quotas and a percentage table without installing xtreme style mod.

Add in includes/usercp_viewprofile.php below $template->assign_vars(array(

'USERID' => $profiledata['user_id'],



then add this to profile_view_body.tpl


<!-- PHP -->
include('http://127.0.0.1/gallery/include-profile.php?uid=' . $this->vars['USERID']);
<!-- ENDPHP -->


obviously changing it to your host and renamed profile.php page.

I am working on getting upload statistics also added, as I know absolutely no php I am relying on internet tutorials to figure it out. So far I have added this to my include-profile.php page just above $image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['thumb_width']);


$sql = 'SELECT SUM(total_filesize) AS sum_total_filesize FROM cpg132_pictures WHERE owner_id =' . $uid;
 $result = mysql_query($sql) or die(mysql_error());
 $i = mysql_fetch_array($result);
 $uploaded = round($i['sum_total_filesize'] / 1024);


and added $uploaded somewhere amounst $user_thumb = .......

Will post back when/if I figure out how to get quota allowed for a group and make a nice graph thingy :) or someone else may like to chip in.

garrynz

Well figured out how to get percentages and make a bar graph. I am sure there is a better way, but since I am new to mysql/php ... someone with more php brains may like to figure out and post how to make one mysql query instead of three.

The select from users below should have your phpbb extention i.e phpbb_users and both phpbb and coppermine need to be on the same database.



 $sql = 'SELECT SUM(total_filesize) AS sum_total_filesize FROM cpg132_pictures WHERE owner_id =' . $uid;
 $result = mysql_query($sql) or die(mysql_error());
 $i = mysql_fetch_array($result);
 $uploaded = round($i['sum_total_filesize'] / 1024);

 $sql = 'SELECT user_level FROM users WHERE user_id =' . $uid;
 $result = mysql_query($sql) or die(mysql_error());
 $i = mysql_fetch_array($result);
 $level = $i['user_level'];
  if ($level == 0)
{$level = "2";}
  if ($level == 1)
{$level = "1";}
// add more if custom users

  $sql ='SELECT group_quota FROM cpg132_usergroups WHERE group_id =' . $level;
  $result = mysql_query($sql) or die(mysql_error());
  $i = mysql_fetch_array($result);
  $group_quota = $i['group_quota'];

$percentage = round(($uploaded / $group_quota) * 100) ;

// remaining used for 2nd td length in table
$remaining = (100 - $percentage);


and for the table, make a 1x1 pixle image the colour of your choice.


<table width=\"100\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"graphtable\"><tr><td width=\"" . $percentage . "\" background=\"/images/uploadgraph.gif\" height=\"5\"> </td><td class=\"endgraph\" width=\"". $remaining . "\"></td></tr></table>


I will have a crack at  adding this code to phpbb's profile page.

garrynz

Well its fairly simple to get quota and uploaded data from phpbb files. Once again you need to have phpbb and coppermine on the same database. Also change select user_level FROM users to whatever your phpbb tables are names i.e select user_level FROM phpbb_users

Open phpbb/includes/usercp_viewprofile.php
add above $template->assign_vars(array(


// get gallery quotas/uploaded
 $sql = 'SELECT SUM(total_filesize) AS sum_total_filesize FROM cpg132_pictures WHERE owner_id =' . $profiledata['user_id'];
 $result = mysql_query($sql) or die(mysql_error());
 $i = mysql_fetch_array($result);
 $uploaded = round($i['sum_total_filesize'] / 1024);

 $sql = 'SELECT user_level FROM users WHERE user_id =' . $profiledata['user_id'];
 $result = mysql_query($sql) or die(mysql_error());
 $i = mysql_fetch_array($result);
 $level = $i['user_level'];
  if ($level == 0)
{$level = "2";}
  if ($level == 1)
{$level = "1";}

  $sql ='SELECT group_quota FROM cpg132_usergroups WHERE group_id =' . $level;
  $result = mysql_query($sql) or die(mysql_error());
  $i = mysql_fetch_array($result);
  $group_quota = $i['group_quota'];

$percentage = round(($uploaded / $group_quota) * 100) ;
$remaining = (100 - $percentage);
// end get gallery quotas/uploaded




add below 'YIM' => $yim, or anywhere in there


'UPLOADED' => $uploaded,
'GROUPQUOTA' => $group_quota,
'PERCENTAGE' => $percentage,




Then add {UPLOADED} {GROUPQUOTA} ..... to profile_view_body.tpl

garrynz

here is a graph to add in includes/usercp_viewprofile.php add below $remaining = (100 - $percentage); in the above code


$percenttable = "<center>Quota Used<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"50%\" align=\"right\">0% </td><td><table width=\"100\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"" . $percentage . "\" background=\"/images/uploadgraph.gif\" height=\"5\"> </td><td width=\"". $remaining . "\"></td></tr></table></td><td width=\"50%\" align=\"left\">100%</td></tr></table></center>";


and add below $template->assign_vars(array(

'PERCENTGRAPH' => $percenttable,

then {PERCENTGRAPH} in profile_view_body.tpl

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2F207.58.164.217%2Fprofile.gif&hash=3503e05312d88a6b6dcb93142651bf5fe3bb7d55)

Tranz


gaatsen

How is this going to work on the Profile Control Panel MOD? which files to edit?

garrynz

Hi gaatsen, I will give it a crack over the next few days as I have just installed profile control panel.

matu111

hy garrynz,

maybe you can help me. I need only the quata (disk usage) part of your script and hopefully without having xtreme style mod, dont like it  :-\\

Thanks

garrynz

Hi, my 3rd and 4th messages on this tread are for getting the quota without having the xtreme style mod installed.

garrynz

gaatsen so far I can only figure it out using the include way with xtreme style mod. If you want to do it this way open profilecp/def/def_userfuncs_std.php add below $template->assign_vars(array(


'USERID' => $view_userdata['user_id'],


Open templates/Subsilver/profilcp/public_base_body.tpl and add at the bottom


<!-- PHP -->
include('http://127.0.0.1/gallery/include-profile.php?uid=' . $this->vars['USERID']);
<!-- ENDPHP -->

matu111

Thanks Garrynz,
quota system now works well.
Next idea is, how to get phpbb users viewprofile part to the coppermine´s profile, like a link. Cant make those sql queries, any idea how to do it, Garrynz ?


::)

garrynz

I am not sure what you mean, when I click on "my profile" in coppermine it takes me to my phpbb profile, this is part of bridging the two together. So in effect the only way I can view my coppermine profile is to manually add the address in the address bar.

garrynz

Oh you mean so you can view their latest uploaded and comments? If so just add this somewhere in your profile_view_body.tpl template file <a href="/gallery/profile.php?uid={USERID}">Gallery profile</a>

And add in includes/usercp_viewprofile.php below $template->assign_vars(array(

'USERID' => $profiledata['user_id'],

That should do it. Off course if you didnt want to use xtreme style mod you could use a iframe to include it.

matu111

 :D
allmost, but i want to be it reversed. I use coppermine profile page as well, and there must be a link to phpbb profile.
Any idea ?

garrynz

One way you could do it. Open gallery/profile.php find

$form_data = array('username' => $user_data['user_name'],

replace with

form_data = array('username' => '<a href="/phpbb/profile.php?mode=viewprofile&u=' . $HTTP_GET_VARS['uid'] . '">' . $user_data['user_name'] . '</a>',

matu111


matu111

Garrynz,

have you got any idea for example how to get phpbb privatemessage notification line ("you have 1 unread messages") to coppermine photogallery main page, just below the topmenu (it´s in theme.php). The user must be logged in, like in phpbb, to see this line (notification). I have already made a link to gallery, which points to forum/privmsg.php?folder=inbox. But when users are looking pictures in gallery, they don´t know when a privatemessage arrives, there´s no note for that.
Could you help to figure this out ?

???

matu111

I was wondering, if the quota information could be inserted into the phpbb/profile.php?mode=editprofile page as well ? Then users do not have to find their viewprofile part form the memberlist to check the quota.  :-\\

freesouljah

Quote from: garrynz on April 12, 2005, 08:52:52 PM
One way you could do it. Open gallery/profile.php find

$form_data = array('username' => $user_data['user_name'],

replace with

form_data = array('username' => '<a href="/phpbb/profile.php?mode=viewprofile&u=' . $HTTP_GET_VARS['uid'] . '">' . $user_data['user_name'] . '</a>',

note:  don't forget the   $   in $form_data or you will get a parse error  8)

thanks

gaatsen

Ik would like to have this mod on the profile cp mod. The pix must appear where the anyoing map appears. In the public view of the profile. How to do that?