Re: PHBB & COPPERMINE --> profile ---> this is me, set as avatar function Re: PHBB & COPPERMINE --> profile ---> this is me, set as avatar function
 

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

Re: PHBB & COPPERMINE --> profile ---> this is me, set as avatar function

Started by Nibbler, March 14, 2005, 02:29:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Nibbler


gaatsen



gaatsen

www.partyvibes.nl/pictures/thatsme.php
www.partyvibes.nl/pictures/setasavatar.php

It uses coppermine fetch mod i believe, but í'd like to know how these php-files are constructed....can somebody help??

Joachim Müller

Try contacting the webmaster of the site you're refering to - ask nicely (you could refer to this thread as well), maybe they will give you the code.

Joachim


goddamnfunky

first create a table

CREATE TABLE PVIBES_user2foto (
   user2foto_id int(11) NOT NULL auto_increment,
   username varchar(25) NOT NULL,
   foto_id tinyint(11),
   PRIMARY KEY (user2foto_id),
   KEY username (username)
);


it's better to work with user - ID's but not with the old database stuff @ partyvibes.nl  :-\\

###################################################################
# thatsme.php #

session_start();
require('connection file.php'); // change to your connection file!

if($_SESSION['userlevel'] <= '0') { // SIMPLE LOGIN CHECK
?> <a href="../becomemember.php" target="_top"><img src="../images/thatsme.jpg" border="0"></a><? }
else { // MEMBERS ONLY
$pid = $HTTP_GET_VARS[pic];
$user = $_SESSION['username'];



// Let's see if the user and picture are linked

mysql_select_db(your connection);
$sql_event_check = mysql_query("SELECT username, foto_id FROM PVIBES_user2foto WHERE username = '$user' AND foto_id = '$pid'");

$event_check = mysql_num_rows($sql_event_check);

if($event_check >= 1){ ?>
<a href="../member.php?username=<? echo $user; ?>" target="_top"><img src="../images/added2yourprofile.jpg" border="0"></a> <? }
else {

if($HTTP_GET_VARS[url] == '1') {  // if clicked then...
$insertSQL = "INSERT INTO PVIBES_user2foto (username, foto_id) VALUES ('$user', '$pid')";
$Result1 = mysql_query($insertSQL, $your connection info) or die(mysql_error()); ?>

<a href="../member.php?username=<? echo $user; ?>" target="_top"><img src="../images/added2yourprofile.jpg" border="0"></a>

<? } else { ?>

<a href="thatsme.php?url=1&pic=<? echo $pid; ?>" target="_self"><img src="../images/thatsme.jpg" border="0"></a>
<? }
} }


##################################################
# displayimage.php - edit

// find:
   
    if (!in_array($CURRENT_PIC_DATA['pid'], $FAVPICS)) {
        $info[$lang_picinfo['addFavPhrase']] = "<a href=addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . " >" . $lang_picinfo['addFav'] . '</a>';
    } else {
        $info[$lang_picinfo['addFavPhrase']] = "<a href=addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . " >" . $lang_picinfo['remFav'] . '</a>';
  }


// add:

$pic = $CURRENT_PIC_DATA['pid'];
$info ?><div id="Layer2" style="position:absolute; left:0px; top:250px; width:89px; height:58px; z-index:2"><iframe src="thatsme.php?pic=<? echo $pic; ?>" frameborder="0" width="89" height="58" scrolling="no"></iframe></div><? ;
$info ?><div id="Layer3" style="position:absolute; left:0px; top:320px; width:89px; height:58px; z-index:2"><iframe src="setasavatar.php?pic=<? echo $pic; ?>" frameborder="0" width="89" height="58" scrolling="no"></iframe></div><? ;



note: you need to change the layer style for working with the latest Mozilla

########################################
# setasavater.php


session_start();
require('your connection file');

if($_SESSION['userlevel'] <= '0') { // LOGIN CHECK
?> <a href="../becomemember.php" target="_top"><img src="../images/setasavatar.jpg" border="0" alt="You need to register / login to use this function"></a><? }
else { // MEMBERS ONLY
$pid = $HTTP_GET_VARS[pic];

mysql_select_db(your connection info);
$query_topimage = "SELECT * FROM cpg11d_pictures WHERE pid = '$pid'";
$topimage = mysql_query($query_topimage, $connection info) or die(mysql_error());
$row_topimage = mysql_fetch_assoc($topimage);

$avatar = "http://www.partyvibes.nl/pictures/albums/" . $row_topimage['filepath'] . "thumb_" . $row_topimage['filename']; // url to albums dir
$user = $_SESSION['username'];


if($HTTP_GET_VARS[url] == '1') {  // WHEN CLICKED, so changed iframe url in displayimage.php
$insertSQL = "UPDATE YOUR_MEMBERS_TABLE SET user_avatar='$avatar', pictures_avatar='1' WHERE username = '$user'";
$Result1 = mysql_query($insertSQL, $connection info) or die(mysql_error());

$query_createavatar = "SELECT username, user_avatar FROM YOUR_MEMBERS_TABLE WHERE username = '$user'";
$createavatar = mysql_query($query_createavatar, $connection info) or die(mysql_error());
$row_createavatar = mysql_fetch_assoc($createavatar);

session_register('useravatar');
$_SESSION['useravatar'] = $row_createavatar['user_avatar']; // update session
?>
<a href="../member.php?username=<? echo $user; ?>" target="_top"><img src="../images/createdavatar.jpg" border="0" alt="Click here to view your updated profile"></a>

<? } else { ?>

<a href="setasavatar.php?url=1&pic=<? echo $pid; ?>" target="_self"><img src="../images/setasavatar.jpg" border="0" alt="Set this picture as avatar (little picture next to your comments)"></a>
<? }
}



#
Thats about it... please note that i've wrote this for partyvibes.nl so a lot of url's and files are not standard within coppermine or phbb
It was one off my first codes so please don't flame me for bad coding  ;)

If you have any questions just let me know
Tim

goddamnfunky

I could update (or upgrade  ;)) this to a working add-on for coppermines users...
but I think that it would be better if other (better) coders will do this... just let me know

gaatsen

Thanks a lot Tim, you have been of great help.

Now i have to make this compatible with phpbb forum profiles.

Does anyone know how to? input? What files do i have to change....

gaatsen


gaatsen


pulz

This is a very good mod I think, too bad its not fully worked out here but I'll give it a try coding the msising parts,

Update @20 april: I'm currently busy combining it with the avatar in profile and comments, and personal message system, I think its gonna work soon (PM system allready fully integrated, avatar function for 70% integrated)
Don't ask me: Can you do this .... or Give me that...or I need Quick help in PM's. I'm not Santaclaus so post your questions on the board so it will be in the benefit for everyone.

pulz

Well almost 90% working :)

But with almost totall different codes and not using the phpbb integration jsut have to code one more little thing and thats that it also adds the name in the description of the file if someone clicks the I'm on this picture function. Uptill now itsonly setting the PID and USER_ID relationships so if you do an sql query you can sort every picture a person is on. BUT I also want to display it immediatly in the description of the image. but have to sort it out first so almost working.

By the way I hate using <IFRAME> tags like is done by the suggestion of party vibes.... wouldn't advise using it, just hard code it in the original theme template...

after:

$template_display_picture = <<<EOT
       <tr>
               <td align="center" class="tableb" height="{CELL_HEIGHT}" style="white-space: nowrap; padding: 0px;">
                       <table cellspacing="2" cellpadding="0" class="imageborder">
                               <tr>
                                       <td>
                                               <div id="photoholder">{IMAGE}</div>
                                               {ADMIN_MENU}</td>
                               </tr>
                       </table>


just add:

<table width="your used size" border="0" cellspacing="0" cellpadding="0" bgcolor="">
<tr>
<td align="left"><a href="imonthispicture.php?pid={AVATAR_ID}&user={AVATAR_USER}"><img src="themes/xxx/images/displayimage/imonthispicturebl.png"></a></td>
<td align="right"><a href="setavatar.php?pid={AVATAR_ID}&user={AVATAR_USER}"><img src=""themes/xxx/images/displayimage/myavatarbl.png"></a></td>
</tr>
</table>


But I want to integrate it so there wouldn't be separate files used but well its just a personal issue that I like to get things integrated this was just more for testing purposes
Don't ask me: Can you do this .... or Give me that...or I need Quick help in PM's. I'm not Santaclaus so post your questions on the board so it will be in the benefit for everyone.

pulz

100% up and running, and fully tested

I changed so much that I dont have a clear DIY here cause I integrated it together with other modules I needed. But I can give help if people have specific questions. Coding was pretty easy by the way and I would suggest you inlcude pid, user, album, pos in your calls from displayimage.php  so something like xxxxx.php?pid=$pid etc etc to get functions working in the files like

$referer ="displayimage.php?album=$album&pos=$pos";

for using functions like:    pageheader($lang_imonthispicture['toevoegen'], "<META http-equiv=\"refresh\" content=\"3;url=$referer\">");

To return to the picture you were looking at, (I dont use i frames I hate them...)
Don't ask me: Can you do this .... or Give me that...or I need Quick help in PM's. I'm not Santaclaus so post your questions on the board so it will be in the benefit for everyone.

freesouljah

this is an interesting mod...but I am looking for something a little different, which calls the userdata from phpbb and places the user's avatar inside the coppermine gallery:

User Avatar in Menu:



<!-- BEGIN my_avatar -->
                                             <a href="{MY_PROF_TGT}">{MyAvatar}</a> <br>
<!-- End my_avatar -->

<!-- BEGIN my_gallery -->
                                               <a href="{MY_GAL_TGT}" title="{MY_GAL_TITLE}" class="nav">{MY_GAL_LNK}</a> <br>
<!-- END my_gallery -->


etc........




and {MSG_AUTHOR_AVATAR} next to each comment:



// HTML template for the display of comments
$template_image_comments = <<<EOT

       <tr>
               <td>
                       <table width="100%" cellpadding="0" cellspacing="0">
                               <td class="tableh2_compact" nowrap> <b>{MSG_AUTHOR_AVATAR}<br>
         {MSG_AUTHOR}</b>
<!-- BEGIN ipinfo -->
                                                                                ({HDR_IP} [{RAW_IP}])
<!-- END ipinfo -->

etc.........





Here are some examples from phpbb that I have calling avatar info for my bbs:


page_header.php

//
// Generate logged in/logged out status
//
if ( $userdata['session_logged_in'] )
{
$u_login_logout = 'login.'.$phpEx.'?logout=true&sid=' . $userdata['session_id'];
$l_login_logout = $lang['Logout'] . ' [ ' . $userdata['username'] . ' ]';
$avatar = '';
if ( $userdata['user_avatar_type'] && $userdata['username'] != ANONYMOUS && $userdata['user_allowavatar'] )
{
switch( $userdata['user_avatar_type'] )
{
case USER_AVATAR_UPLOAD:
$avatar = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_REMOTE:
$avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_GALLERY:
$avatar = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
}
}
}

else
{
$u_login_logout = 'login.'.$phpEx;
$l_login_logout = $lang['Login'];
}

$s_last_visit = ( $userdata['session_logged_in'] ) ? create_date($board_config['default_dateformat'], $userdata['user_lastvisit'], $board_config['board_timezone']) : '';



'MyAvatar' => $avatar,


and viewforum.php


// Topic Author Avatar
     
$poster_avatar = ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . '=' . $topic_rowset[$i]['user_id']) . '">' : '';
$poster_avatar .= '';

if ( $topic_rowset[$i]['user_avatar_type'] && $topic_rowset[$i]['user_allowavatar'] )
{
switch( $topic_rowset[$i]['user_avatar_type'] )
{
case USER_AVATAR_UPLOAD:
$poster_avatar = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $topic_rowset[$i]['user_avatar'] . '" alt="" border="0" />'  : '';
break;
case USER_AVATAR_REMOTE:
$poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $topic_rowset[$i]['user_avatar'] . '" alt="" border="0" />'  : '';
break;
case USER_AVATAR_GALLERY:
$poster_avatar = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $topic_rowset[$i]['user_avatar'] . '" alt="" border="0" />'  : '';
break;


}
}
$poster_avatar .= ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? '</a>' : '';
$template->assign_vars(array('POSTER_AVATAR' => $poster_avatar));




'POSTER_AVATAR' => $poster_avatar,
'U_VIEW_POSTER_PROFILE' => ($userdata['user_level'] != ADMIN)? append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $topic_rowset[$i]['topic_poster']) : append_sid("admin/admin_users.$phpEx?mode=edit&amp;u=" . $topic_rowset[$i]['topic_poster']) ,




I am not sure what and where exactly to tweak the code...so I am weary of experimenting @ the moment, but if someone could point me in the right direction, I would be a little more confident.


thanks  8)

cassie396

Did anyone ever get the code to work with PHPBB and Coppermine? I am looking to make my Coppermine (linked with PHPBB) an avatar gallery for my users. If someone could point me in the right direction, I would really appreciate it!!

Thanks,
Cassie


IGGYCORP