Forum Plugin: Avatar in {SYS_MENU} Forum Plugin: Avatar in {SYS_MENU}
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Forum Plugin: Avatar in {SYS_MENU}

Started by KyleClarkeNZ, May 23, 2012, 08:37:30 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

KyleClarkeNZ

Hi,

I'm wondering if someone could please help me with a little mod to the CPG Forum Plugin. I'd like to use the users avatar as the icon next to "My Profile" instead of the yellow no-face-man icon. I'm sure it's really simple but I'm still trying to figure out some of this php/sql stuff.

Thanks in advance,

Kyle

Αndré

Copy the function theme_main_menu from themes/sample/theme.php to your theme's theme.php file if it doesn't exist. Then, find
$param = array(
and above, add
    $my_prof_ico = cpg_fetch_icon('my_profile', 1);
    if ($my_prof_ico && function_exists('forum_start')) {
        $avatar_image = mysql_result(cpg_db_query("SELECT fr_avatar FROM {$CONFIG['TABLE_USERS']} WHERE user_id = ".USER_ID), 0);
        if ($avatar_image && file_exists($avatar_image)) {
            $my_prof_ico = '<img src="'.$avatar_image.'" border="0" alt="" width="16" height="16" class="icon" />';
        }
    }


find
'{MY_PROF_ICO}' => cpg_fetch_icon('my_profile', 1),
and replace with
'{MY_PROF_ICO}' => $my_prof_ico,


Copy the function theme_admin_mode_menu from themes/sample/theme.php to your theme's theme.php file if it doesn't exist. Then, find
if ($admin_menu == '') {(
and below, add
            $my_prof_ico = cpg_fetch_icon('my_profile', 1);
            if ($my_prof_ico && function_exists('forum_start')) {
                $avatar_image = mysql_result(cpg_db_query("SELECT fr_avatar FROM {$CONFIG['TABLE_USERS']} WHERE user_id = ".USER_ID), 0);
                if ($avatar_image && file_exists($avatar_image)) {
                    $my_prof_ico = '<img src="'.$avatar_image.'" border="0" alt="" width="16" height="16" class="icon" />';
                }
            }


find
'{MY_PROF_ICO}' => cpg_fetch_icon('my_profile', 1),
and replace with
'{MY_PROF_ICO}' => $my_prof_ico,
(twice).

KyleClarkeNZ

Wow, that's awesome. Thank you so much for your help. It's very clear and easy for me to try and figure out how you've done it. Really appreciate it.

allvip

I edited the theme.php like you said but I don't see nothing.How can I ad an avatar to my profile?
Thanks

Αndré

Quote from: allvip on August 28, 2012, 02:53:42 PM
How can I ad an avatar to my profile?
Exactly as explained above. If it doesn't work for you, double check the instructions and your theme.php file and if it still doesn't work, start a new thread and post more information (e.g. a link to your gallery, your theme.php file, which plugins you use, etc.).