Warning: The author of this contribution does not provide support for it anymore.

Prime Quick Login

Function get_user_avatar causes Error - Prime Quick Login

Function get_user_avatar causes Error

by maggolo » Sat Jan 22, 2011 9:25 am

Hi primehalo,

i have installed your Prime Quick Login to my community.
I have modified it a bit.
I added the following line to get the user avatar. That nice on most pages but on register and if i go to acp i got the error below

Added Code:

Code: Select all

$av_img = get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $width, $height);


Error:

Code: Select all

Fatal error: Call to undefined function get_user_avatar() in /var/www/html/testdrive/community/includes/prime_quick_login.php on line 185


What can i do to get this work?

Bye maggo
maggolo
Registered User
Posts: 62
Joined: Tue Jun 23, 2009 12:57 pm
Contact:

Re: Function get_user_avatar causes Error

by primehalo » Sun Jan 23, 2011 9:05 am

First check to see if the function exists with function_exists(), and if it does not then include the file that contains the function declaration.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!
User avatar
primehalo
Former Team Member
Posts: 2910
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: Function get_user_avatar causes Error

by maggolo » Mon Jan 24, 2011 8:24 am

Hi primehalo,

maybe thats a solution to this what you worte, but after the last night i slept again about that.. and i think on the registrations and administration pages it is unnecessary to include this function.

I think to excolude the prime_quick_login.php on this pages is the better way.
So i added an if before i call the user Avatar, see the code below.

Code: Select all


if($user->data['is_registered'])
{
     $av_img = get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $width, $height);
}



That works fine now for the registraton site but not if i go to the administration site, i played arround with the user->data session_admin but i have not found a solution till now.

Do you have an idea to exclude the prime_quick_login for the administration login and pages?

bye maggo
maggolo
Registered User
Posts: 62
Joined: Tue Jun 23, 2009 12:57 pm
Contact:

Re: Function get_user_avatar causes Error

by primehalo » Mon Jan 24, 2011 8:48 am

I do not know of a solution off hand, though I'm sure one exists. I'm not even sure why you would need to add the function to this MOD, as once the user is logged in the quick login form goes away.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!
User avatar
primehalo
Former Team Member
Posts: 2910
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: Function get_user_avatar causes Error

by maggolo » Mon Jan 24, 2011 9:29 am

Hi primehalo,

yes i'm sure too there should be an solution.
I need this because after the user is loged in i would display the Users Avatar instead of the login form so i modified the prime_quick_login.html for my needs.

Code: Select all


<!-- IF S_PRIME_QUICK_LOGIN and not AUTO_REFRESH and not S_USER_LOGGED_IN and not S_IS_BOT -->
        <ul style="background: url() no-repeat;">
                <li style="text-align: left; padding-left: 15px;" class="menuetitel"><span class="no_link" style="font-size: 12px;">Login</span></li>
         </ul>
        <div style="display:block;margin:1px 0pt 0px 12px;">
                <table border="0" width="120" cellspacing="0" cellpadding="0">
                        <tr>
                                <td class="login_forum" style="padding-left: 2px;">
                                        <form method="post" action="{S_PRIME_QUICK_LOGIN}">
                                                <p style="font-size: 8pt; line-height: 0.3em;">
                                                        <input type="text" name="username" size="12" style="color: #999999; border: 1px ridge #999AB9; background-color: #FFFFFF;" value="Username" onblur="setField(this)" onfocus="this.value =(this.value=='Username')? '': this.value;"/><br />
                                                        <input type="password" name="password" size="12" style="color: #999999; border: 1px ridge #999AB9; background-color: #FFFFFF;" onfocus="this.value =(this.value=='Passwort')? '': this.value;" value="Passwort"/>
                                                        <input type="submit" name="login" value="{L_LOGIN}" style="border: 1px ridge #999AB9; background-color: #FFFFFF;"/>
                                                        <br />
                                                        <input type="hidden" name="redirect" value="user_start.php">
                                                        <br />
                                                        <a href="../community/ucp.php?mode=register"><span style="font-size: 8pt; color: #0033cc; font-family: arial; line-height: 0.8em;">Paguaner werden</span></a>
                                                </p>
                                        </form>
                                </td>
                        </tr>
                </table>
        </div>

<!-- ELSE -->

        <ul style="background: url() no-repeat;">
                <li style="text-align: left; padding-left: 15px;" class="menuetitel"><span class="no_link" style="font-size: 12px;">Hallo {L_PRIME_QUICK_USERNAME}</span></li>
        </ul>
        <div style="margin: 1px 0px 0px 1px;">
                <table border="0" width="124" cellspacing="0" cellpadding="0">
                        <tr>
                                <td class="login_forum" align="center">
                                        {PRIME_QUICK_AVATAR}
                                </td>
                        </tr>
                </table>
        </div>
        <div style="margin: 1px 0pt 0px 1px;">
                <table border="0" width="120" cellspacing="0" cellpadding="0">
                        <tr>
                                {PRIME_QUICK_PRIVMSG}
                                {PRIME_QUICK_VISITOR}
                                {PRIME_QUICK_FRIENDS}
                                {PRIME_QUICK_POSTS}
                                {PRIME_QUICK_GAMES}
                        </tr>
                </table>
        </div>
<!-- ENDIF -->



Other solution could be writing all the code not in these files but in an own file and put the code there but i think on the administration pages the problem will coninue.

So simply what i would get to work is to display the login in overall_header if the user is not logged in and display its Avatar in overall_header if the user is logged in.
So i could imagine that i uses two mods, the prime_quick_login for the login form an an other mod to display the avatar.
But i don't know if such a mod exists...

Or i give you all the code what i have written and we fix the problem together and you can add this function to your mod in a new version?!

Do you have an idea in which direction i should go?

best regards

maggo
maggolo
Registered User
Posts: 62
Joined: Tue Jun 23, 2009 12:57 pm
Contact:

Re: Function get_user_avatar causes Error

by primehalo » Mon Jan 24, 2011 9:40 am

Well, I'd go back to a modified version of my original suggestion, use function_exists(), except this time if the function doesn't exist then don't try to get the avatar.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!
User avatar
primehalo
Former Team Member
Posts: 2910
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: Function get_user_avatar causes Error

by maggolo » Mon Jan 24, 2011 8:50 pm

Hi primehalo,

ok the if(function_exists('get_user_avatar')) did it.

thank you
maggolo
Registered User
Posts: 62
Joined: Tue Jun 23, 2009 12:57 pm
Contact: