Advanced search  

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

Pages: [1] 2   Go Down

Author Topic: phpbb profile page and latest photo/comments/quota tips  (Read 55403 times)

0 Members and 1 Guest are viewing this topic.

garrynz

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
phpbb profile page and latest photo/comments/quota tips
« on: March 24, 2005, 07:29:38 pm »

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

Code: [Select]

<!-- 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']);

Code: [Select]
$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.
« Last Edit: April 11, 2005, 11:34:34 am by garrynz »
Logged

garrynz

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: phpbb profile page and latest photo/comments/quota tips
« Reply #1 on: March 25, 2005, 02:47:48 pm »

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.


Code: [Select]
 $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.

Code: [Select]
<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.
« Last Edit: March 25, 2005, 03:02:38 pm by garrynz »
Logged

garrynz

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: phpbb profile page and latest photo/comments/quota tips
« Reply #2 on: March 25, 2005, 04:13:02 pm »

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(

Code: [Select]
// 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

Code: [Select]

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



Then add {UPLOADED} {GROUPQUOTA} ..... to profile_view_body.tpl
« Last Edit: March 25, 2005, 11:13:33 pm by garrynz »
Logged

garrynz

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: phpbb profile page and latest photo/comments/quota tips
« Reply #3 on: April 01, 2005, 01:15:29 pm »

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

Code: [Select]
$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

(http://207.58.164.217/profile.gif)
« Last Edit: April 01, 2005, 01:38:25 pm by garrynz »
Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: phpbb profile page and latest photo/comments/quota tips
« Reply #4 on: April 01, 2005, 05:48:55 pm »

Very nice. :)
Logged

gaatsen

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: phpbb profile page and latest photo/comments/quota tips
« Reply #5 on: April 06, 2005, 01:43:09 pm »

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

garrynz

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: phpbb profile page and latest photo/comments/quota tips
« Reply #6 on: April 10, 2005, 02:37:54 pm »

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

matu111

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Re: phpbb profile page and latest photo/comments/quota tips
« Reply #7 on: April 10, 2005, 09:03:15 pm »

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
Logged

garrynz

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: phpbb profile page and latest photo/comments/quota tips
« Reply #8 on: April 11, 2005, 10:37:15 am »

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

garrynz

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: phpbb profile page and latest photo/comments/quota tips
« Reply #9 on: April 11, 2005, 11:32:46 am »

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(


Code: [Select]
'USERID' => $view_userdata['user_id'],

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

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

matu111

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Re: phpbb profile page and latest photo/comments/quota tips
« Reply #10 on: April 12, 2005, 04:43:08 pm »

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 ?


 ::)
Logged

garrynz

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: phpbb profile page and latest photo/comments/quota tips
« Reply #11 on: April 12, 2005, 06:53:15 pm »

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.
Logged

garrynz

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: phpbb profile page and latest photo/comments/quota tips
« Reply #12 on: April 12, 2005, 07:00:05 pm »

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.
« Last Edit: April 12, 2005, 07:07:55 pm by garrynz »
Logged

matu111

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Re: phpbb profile page and latest photo/comments/quota tips
« Reply #13 on: April 12, 2005, 07:17:04 pm »

 :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 ?
Logged

garrynz

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: phpbb profile page and latest photo/comments/quota tips
« Reply #14 on: April 12, 2005, 08:52:52 pm »

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

Code: [Select]
$form_data = array('username' => $user_data['user_name'],
replace with

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

matu111

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Re: phpbb profile page and latest photo/comments/quota tips
« Reply #15 on: April 12, 2005, 09:35:45 pm »

Thanks a lot,
you´re my life saver.  ;)
Logged

matu111

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Re: phpbb profile page and latest photo/comments/quota tips
« Reply #16 on: April 14, 2005, 02:06:18 pm »

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 ?

 ???
Logged

matu111

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
Re: phpbb profile page and latest photo/comments/quota tips
« Reply #17 on: April 18, 2005, 12:03:04 pm »

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.  :-\\
Logged

freesouljah

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 116
  • Can you feel the Love?
    • freesouljah.com
Re: phpbb profile page and latest photo/comments/quota tips
« Reply #18 on: May 29, 2005, 11:25:48 pm »

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

Code: [Select]
$form_data = array('username' => $user_data['user_name'],
replace with

Code: [Select]
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

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: phpbb profile page and latest photo/comments/quota tips
« Reply #19 on: June 02, 2005, 12:08:35 pm »

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?
Logged
Pages: [1] 2   Go Up
 

Page created in 0.03 seconds with 19 queries.