forum.coppermine-gallery.net

No Support => Modifications/Add-Ons/Hacks => Mods: Bridging/Integration => Topic started by: garrynz on March 24, 2005, 07:29:38 pm

Title: phpbb profile page and latest photo/comments/quota tips
Post by: garrynz 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.
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: garrynz 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.
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: garrynz 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
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: garrynz 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)
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: Tranz on April 01, 2005, 05:48:55 pm
Very nice. :)
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: gaatsen on April 06, 2005, 01:43:09 pm
How is this going to work on the Profile Control Panel MOD? which files to edit?
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: garrynz 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.
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: matu111 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
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: garrynz 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.
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: garrynz 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 -->
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: matu111 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 ?


 ::)
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: garrynz 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.
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: garrynz 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.
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: matu111 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 ?
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: garrynz 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>',
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: matu111 on April 12, 2005, 09:35:45 pm
Thanks a lot,
you´re my life saver.  ;)
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: matu111 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 ?

 ???
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: matu111 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.  :-\\
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: freesouljah 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
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: gaatsen 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?
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: Joachim Müller on June 03, 2005, 07:17:18 am
@gaatsen & matu111: usually, mods come as-is, there's little point in permanently requesting new features. The mod author might not even be around any more.
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: peksami on October 17, 2005, 02:33:28 pm
How can work SIMPLE MACHINES FORUM ?
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: Joachim Müller on October 17, 2005, 05:40:39 pm
ask this on the smf board - you would have to write a completely different hack. Don't try to hijack threads, especially when the previous postings already say something along the same lines.
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: flowmo on August 03, 2007, 12:51:46 am
I know this is a very old topic, but could someone include their modified profile.php so I can get some ideas of what all needs to be removed?
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: somebunny on October 13, 2007, 04:14:37 pm
I go the profile page to show the link, but Im trying to get php to show the link When veiwing posts.
see over there on the left, I want it to display "MY GALLERY" under where it sayd POST COUNT...

I have successfully gotten the link to show by adding the
Code: [Select]
<a href="/gallery/profile.php?uid={USERID}">Gallery profile</a>

but the link stops at the uid, without adding the persons UID....
ex: /gallery/profile.php?uid=

Im not sure where else I need to edit.
I added
Code: [Select]
below $template->assign_vars(array(

'USERID' => $profiledata['user_id'],
to the topic_review.php but that didnt help...

any ideas?

Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: pszone on October 26, 2007, 01:06:00 pm
@ somebunny

I think, I can help, but I dont understand where exactly you want to show the link  "Gallery Profile" - in view topic, in profile page or in diffrent place.
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: somebunny on October 26, 2007, 01:13:20 pm
When reading all the posts in a thread.  Like right now, if you look over to the left to see who wrote this, you will see my username, karma, and all that.  I would like it to work right there under karma...
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: pszone on October 27, 2007, 10:07:35 am
Open viewtopic.php

Find:
Code: [Select]
'U_POST_ID' => $postrow[$i]['post_id'])
Before ADD
Code: [Select]
'U_USER_ID' => $posterow[$i]['user_id'],
To make a link for the gallery in viewtopic_body.tpl add this:

Code: [Select]
<a href="/gallery/profile.php?uid={postrow.U_USER_ID}">Gallery profile</a>
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: somebunny on October 27, 2007, 10:36:33 am
nope, still doesnt show the userid.
I dont understand why it works on the PROFILE page, but not right there.

[Edit GauGau] Replaced hotlinkied image with attachment [/Edit]

Code is inserted correctly...

Code: [Select]
'L_GALLERY_LINK' => $gallerylink,
'U_USER_ID' => $posterow[$i]['user_id'],
'U_POST_ID' => $postrow[$i]['post_id'])
);
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: pszone on October 27, 2007, 11:54:23 am
I made a little mistake, sorry. Here, that should work:

In viewtopic.php change:

Code: [Select]
'U_USER_ID' => $posterow[$i]['user_id'],
to

Code: [Select]
'U_USER_ID' => $poster_id,
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: somebunny on October 27, 2007, 03:38:32 pm
oh yay!
thats seems to have it!
THANKS SO MUCH!!!!
 ;D
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: cordiafreaks on November 17, 2007, 08:36:05 am
I've installed this hack onto my forum, but I'm getting error code, here's a link to the example:

http://cordiafreaks.com/phpbb2/profile.php?mode=viewprofile&u=2 (http://cordiafreaks.com/phpbb2/profile.php?mode=viewprofile&u=2)

I hope someone can help! thanks
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: cordiafreaks on November 17, 2007, 09:33:13 am
Here's my edited 'profile_view_body.tpl'..... It isn't inserting the users id into the hyperlink!

Code: [Select]
            <a href="/cpg1410/profile.php?uid={postrow.U_USER_ID}">Gallery profile</a>
<!-- PHP -->
            include('/cpg1410/include-profile.php?uid=' . $this->vars['USERID']);
            <!-- ENDPHP -->


And the 'usercp_viewprofile.php'
Code: [Select]
$template->assign_vars(array(
'USERID' => $profiledata['user_id'],
'USERNAME' => $profiledata['username'],

I have copied the 'profile.php' and renamed the copy to 'include-profile.php' but haven't made any changes to the file.

In my php profiles, I want a link to the user's gallery with the latest addition thumbnails below it.

Cheers
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: cordiafreaks on November 18, 2007, 09:29:50 am
I worked out some of it myself... no longer need the help! Thanks
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: Joachim Müller on November 18, 2007, 02:43:00 pm
Why don't you share your insight, for the benefit of others with similar questions?
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: hkr on April 05, 2008, 06:05:45 am
Hi,
is there any MOD which could help do the same if i am not using cpg in bridging mode?

thnx..
Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: edenffs on January 14, 2009, 07:53:27 pm
I have just got this to work.
PHPBB3  - COPPERMINE bridge,  this one http://forum.coppermine-gallery.net/index.php/topic,53678.0.html
Coppermine installed in web root and phpbb3 in /forum
using Subsilver2 style

Display a link to all of a users uploaded images in the phpbb3 user profile.

Find in memberlist.php
Code: [Select]
'U_REMOVE_FOE' => ($foe) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&amp;remove=1&amp;mode=foes&amp;usernames[]=' . $user_id) : '',
Add after
Code: [Select]
'CPG_GAL_LINK' => $user_id != ANONYMOUS ? ('../thumbnails.php?album=lastupby&uid=' . ($user_id)) : '',
Find in styles/subsilver2/template/memberlist_view.html
Code: [Select]
<!-- IF S_USER_LOGGED_IN and S_ZEBRA -->
<tr>
<td class="genmed" align="center">[ <!-- IF U_ADD_FRIEND and U_ADD_FOE--><a href="{U_ADD_FRIEND}">{L_ADD_FRIEND}</a> | <a href="{U_ADD_FOE}">{L_ADD_FOE}</a><!-- ENDIF --><!-- IF U_REMOVE_FRIEND --><a href="{U_REMOVE_FRIEND}">{L_REMOVE_FRIEND}</a><!-- ENDIF --><!-- IF U_REMOVE_FOE --><a href="{U_REMOVE_FOE}">{L_REMOVE_FOE}</a><!-- ENDIF --> ]</td>
</tr>

Add After
Code: [Select]
<tr>
<td class="genmed" align="center">[<a href="{CPG_GAL_LINK}">View all uploaded images</a>]</td>
</tr>

Title: Re: phpbb profile page and latest photo/comments/quota tips
Post by: Joachim Müller on February 05, 2009, 08:20:41 am
An unrelated reply by sjoudi (http://forum.coppermine-gallery.net/index.php?action=profile;u=63334) was split into a separate thread (http://forum.coppermine-gallery.net/index.php/topic,57901.0.html) and moved to the bridging support board (http://forum.coppermine-gallery.net/index.php/board,50.0.html), where sjoudi should have started his thread in the first place. Of course you can not start a new thread on the mods board, as that board deals with actual mods and is not meant to allow people to dump their support or mod requests. That's what the support board is for. Hence I moved your reply. You caused a lot of extra moderation effort that could have been avoided easily if you would have looked just a little harder.