forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 plugins => Topic started by: KyleClarkeNZ on May 23, 2012, 08:37:30 am

Title: Forum Plugin: Avatar in {SYS_MENU}
Post by: KyleClarkeNZ on May 23, 2012, 08:37:30 am
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
Title: Re: Forum Plugin: Avatar in {SYS_MENU}
Post by: Αndré on May 23, 2012, 02:34:18 pm
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
Code: [Select]
$param = array(and above, add
Code: [Select]
    $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
Code: [Select]
'{MY_PROF_ICO}' => cpg_fetch_icon('my_profile', 1),and replace with
Code: [Select]
'{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
Code: [Select]
if ($admin_menu == '') {(and below, add
Code: [Select]
            $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
Code: [Select]
'{MY_PROF_ICO}' => cpg_fetch_icon('my_profile', 1),and replace with
Code: [Select]
'{MY_PROF_ICO}' => $my_prof_ico,(twice).
Title: Re: Forum Plugin: Avatar in {SYS_MENU}
Post by: KyleClarkeNZ on May 24, 2012, 07:15:52 am
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.
Title: Re: Forum Plugin: Avatar in {SYS_MENU}
Post by: allvip on August 28, 2012, 02:53:42 pm
I edited the theme.php like you said but I don't see nothing.How can I ad an avatar to my profile?
Thanks
Title: Re: Forum Plugin: Avatar in {SYS_MENU}
Post by: Αndré on August 29, 2012, 11:03:48 am
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.).