hi
the title is not very clear but this is what i want to do:
I want avatars but i can't install Stramm's mod pack, i changed so many files i wouln't know where to begin,
anyway i don't need the other functions of the mod pack, only the avatars.
So i hacked my own (down and dirty :D) avatar system (at least i tried), far from perfect because the user can't upload his own avatar,
has to host it on another site :-[ but it works.
i used the custom profile 6 (like it says in the help files) and bbcode to put an avatar in the side menu (attached pic1) and made it work with foulu's forum plugin (pic2)
but i can't ad it to the comments (pic3), i spent hour trying but i just don't know where to put the code.
i want to reduce the text box size (pic3-black box) and put the avatar on the left (pic3-red box).
I'm really new to php and by reading the manuals i was able to do part of it, but this is over my head.
i used this code in 'init.inc.php' in Stramm's 'CPG PMS v1.1' to show the avatar in the side menu and similar code for foulu's forum:
//loginForm data ... the statistics, pms status
if (USER_ID) {
$loginFormHtml = '<div align=\"left\" class=\"smallfont\"><h2>My Account</h2><hr />'.$lang_pms_sys['welcome'].' <br><strong><a href="profile.php?uid=' .(USER_ID). '">'.(USER_NAME).'</a></strong>';
//begin avatar
$result = mysql_query("SELECT user_profile6 FROM {$CONFIG['TABLE_USERS']} WHERE user_id = '".(USER_ID)."'");
$row = mysql_fetch_array( $result );
$avatar_url = $row['user_profile6'];
if ($avatar_url !="") $avatar_url = $avatar_url;
else $avatar_url="";
$loginFormHtml .= bb_decode($avatar_url);
//end avatar
something similar would probably work in the comments (maybe), if i just knew where to put it.
So any help would be really really appreciated.
i use the Giallo theme, just tell me if you need access to my site or for me to upload any files.
Thanks
Jorge
forgot to give a link to the site:
http://www.customcoversdb.com
test account:
user: test
pass: test
registered account.
Quote from: MadMaxx on July 10, 2008, 03:58:31 AM
//loginForm data ... the statistics, pms status
if (USER_ID) {
$loginFormHtml = '<div align=\"left\" class=\"smallfont\"><h2>My Account</h2><hr />'.$lang_pms_sys['welcome'].' <br><strong><a href="profile.php?uid=' .(USER_ID). '">'.(USER_NAME).'</a></strong>';
//begin avatar
$result = mysql_query("SELECT user_profile6 FROM {$CONFIG['TABLE_USERS']} WHERE user_id = '".(USER_ID)."'");
$row = mysql_fetch_array( $result );
$avatar_url = $row['user_profile6'];
if ($avatar_url !="") $avatar_url = $avatar_url;
else $avatar_url="";
$loginFormHtml .= bb_decode($avatar_url);
//end avatar
I used the 'user_profile6' field for the user signature in cpgforum! The path to the avatar is stored in 'avatar_url'.
Just edit function theme_html_comments().
Copy the whole function
// Displays comments for a specific picture
function theme_html_comments($pid)
{
to your theme.php
Search
$params = array('{MSG_AUTHOR}' => stripslashes($row['msg_author']),
'{MSG_ID}' => $row['msg_id'],
'{PID}' => $row['pid'],
'{EDIT_TITLE}' => &$lang_display_comments['edit_title'],
'{CONFIRM_DELETE}' => &$lang_display_comments['confirm_delete'],
'{MSG_DATE}' => localised_date($row['msg_date'], $comment_date_fmt),
'{MSG_BODY}' => bb_decode($comment_body),
'{MSG_BODY_RAW}' => $row['msg_body'],
'{OK}' => &$lang_display_comments['OK'],
'{SMILIES}' => $smilies,
'{IP}' => $ip,
'{REPORT_COMMENT_TITLE}' => &$lang_display_comments['report_comment_title'],
'{WIDTH}' => $CONFIG['picture_table_width']
);
add after it
$result_a = cpg_db_query("SELECT avatar_url FROM {$CONFIG['TABLE_USERS']} WHERE user_id={$row['author_id']}");
$avatar = mysql_fetch_array($result_a);
$params['{MSG_BODY}'] = "<img src={$avatar[0]} />".$params['{MSG_BODY}'];
Result can be seen in the attachment. It's a very simple solution and could be optimized :D
Quote from: MadMaxx on July 10, 2008, 03:58:31 AM
... i changed so many files i wouln't know where to begin...
that is not an excuse as you always should upgrade to the newest version. With what you say, you intend to skip future security releases.
If you heavily modded your gallery, then use a diff viewer to find exactly what you've changed. These changes you can port to the newest coppermine version (as easy as with a mouse click).
I suggest to use WinMerge (http://winmerge.org/) as it's free and working excellent.
@Stramm, i didn't know about that, so i would install the updates and the program would find the changes i made, very nice i'm gonna check it out, thanks for the info.
@eenemeenemuu, thanks it works, just a small problem, it only shows the last comment not the ones before, if i have 4 comments it only shows the 4th one.
Oops :o i will check this 8)
Use:
$result_a = cpg_db_query("SELECT avatar_url FROM {$CONFIG['TABLE_USERS']} WHERE user_id={$row['author_id']}");
$avatar = mysql_fetch_array($result_a);
$params['{MSG_BODY}'] = "<img src={$avatar[0]} />".$params['{MSG_BODY}'];
instead of
$result = cpg_db_query("SELECT avatar_url FROM {$CONFIG['TABLE_USERS']} WHERE user_id={$row['author_id']}");
$avatar = mysql_fetch_array($result);
$params['{MSG_BODY}'] = "<img src={$avatar[0]} />".$params['{MSG_BODY}'];
(Code updated in first post)
great, works perfect now ;D
thank you so much !
Quote from: eenemeenemuu on July 10, 2008, 09:09:00 AM
Just edit function theme_html_comments().
Copy the whole function
// Displays comments for a specific picture
function theme_html_comments($pid)
{
to your theme.php
Search
$params = array('{MSG_AUTHOR}' => stripslashes($row['msg_author']),
'{MSG_ID}' => $row['msg_id'],
'{PID}' => $row['pid'],
'{EDIT_TITLE}' => &$lang_display_comments['edit_title'],
'{CONFIRM_DELETE}' => &$lang_display_comments['confirm_delete'],
'{MSG_DATE}' => localised_date($row['msg_date'], $comment_date_fmt),
'{MSG_BODY}' => bb_decode($comment_body),
'{MSG_BODY_RAW}' => $row['msg_body'],
'{OK}' => &$lang_display_comments['OK'],
'{SMILIES}' => $smilies,
'{IP}' => $ip,
'{REPORT_COMMENT_TITLE}' => &$lang_display_comments['report_comment_title'],
'{WIDTH}' => $CONFIG['picture_table_width']
);
add after it
$result_a = cpg_db_query("SELECT avatar_url FROM {$CONFIG['TABLE_USERS']} WHERE user_id={$row['author_id']}");
$avatar = mysql_fetch_array($result_a);
$params['{MSG_BODY}'] = "<img src={$avatar[0]} />".$params['{MSG_BODY}'];
Result can be seen in the attachment. It's a very simple solution and could be optimized :D
great work thanks, if user is not loaded avatar? How to make default avatar?
Thanks
the path to the avatar is stored in $avatar[0] ... check if it's empty
if ($avatar[0] == '')
{
$avatar[0] = 'here_is/the_path/to_the/default_avatar.jpg';
}
Quote from: Stramm on January 10, 2009, 10:36:21 AM
the path to the avatar is stored in $avatar[0] ... check if it's empty
if ($avatar[0] == '')
{
$avatar[0] = 'here_is/the_path/to_the/default_avatar.jpg';
}
Thanks stramm thanks..
Hi again,
It is possible?
Thanks
include/themes.inc.php find the $template_image_comments
copy it into the theme.php of the theme you're actually using (themes/your_theme/theme.php). First lines should be
// HTML template for the display of comments
if (!isset($template_image_comments)) { //{THEMES}
till the next ending EOT;
Now edit it to your needs
somewhere here add your avatar
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="tableh2_compact" nowrap="nowrap">
<b>{MSG_AUTHOR}</b><a name="comment{MSG_ID}"></a>
$pm_link
and remove it from there
<tr>
<td class="tableb_compact">
<p>
<div id="cbody{MSG_ID}" style="display:block">
{AVATAR} {MSG_BODY}</div>
</div>
</p>
<div id="cedit{MSG_ID}" style="display:none">
Quote from: ibanez on January 14, 2009, 12:29:45 AM
Hi again,
It is possible?
Thanks
In
theme_html_comments($pid), search
$params = array('{MSG_AUTHOR}' => stripslashes($row['msg_author']),
and replace with
$avatar_url = mysql_result(cpg_db_query("SELECT avatar_url FROM {$CONFIG['TABLE_USERS']} WHERE user_id={$row['author_id']}"),0);
$params = array('{MSG_AUTHOR}' => "<img src=\"{$avatar_url}\" />".stripslashes($row['msg_author']),
ibanez doesn't need to edit the function anymore as it is already prepared to query the avatar and his special version even to replace the avatar with a default one if the user hasn't uploaded an avatar
Thank you very much for your effort. It works and seems very good.
Best Regards