UzziSoft Forum Index UzziSoft
Provider of free downloads and services - www.uzzisoft.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[BETA] Member of the Day 1.0.0

 
Post new topic   Reply to topic    UzziSoft Forum Index -> phpBB Mods
View previous topic :: View next topic  
Author Message
alexi02
Site Admin


Joined: 17 Aug 2004
Posts: 230
Location: Brisbane, Australia

PostPosted: Tue Feb 06, 2007 12:21 pm    Post subject: [BETA] Member of the Day 1.0.0 Reply with quote

MOD Title: Member of the Day
MOD Description: Displays a random member of the day in the index page daily
MOD Version: 1.0.0

MOD Download: Member of the Day 1.0.0 (7.19 KB)

MOD Screenshot: Index

MOD History:
2007-02-06 - Version 1.0.0
- Moved the function update_member_of_the_day() to includes/functions.php
- Added addslashes() and str_replace() for \' to ''

2007-02-05 - Version 0.1.0
- Initial Release (for phpBB 2.0.22)

Author Notes:

See the Member of the Day in the index page.

If you don't want to include inactive users after
installation find:

Code:
$sql = "SELECT user_id, username
                FROM " . USERS_TABLE;


and replace with:

Code:
$sql = "SELECT user_id, username
                FROM " . USERS_TABLE . "
                WHERE user_active = 1";


Please post any problems or ways to improve this mod here.
As requested from http://www.phpbb.com/phpBB/viewtopic.php?t=510524

alexi02.
_________________

UzziSoft Administrator
Back to top
View user's profile Send private message Send e-mail Visit poster's website
joyce



Joined: 10 Feb 2007
Posts: 6

PostPosted: Sat Feb 10, 2007 3:22 pm    Post subject: Reply with quote

hiya alexi,

I'm using importal... and is it possible to make it a block with the avatar and name below it?
Back to top
View user's profile Send private message
joyce



Joined: 10 Feb 2007
Posts: 6

PostPosted: Mon Feb 12, 2007 3:35 pm    Post subject: Reply with quote

I got it to work with IM Portal... just the name but no avatar... how can I add the avatar or some info from the profile?

Thanks Smile
Back to top
View user's profile Send private message
alexi02
Site Admin


Joined: 17 Aug 2004
Posts: 230
Location: Brisbane, Australia

PostPosted: Mon Feb 12, 2007 7:07 pm    Post subject: Reply with quote

Hi, follow the instructions below to add the avatar next to the name.

In index.php

Find
Code:

        //
        // End Member of the Day Mod
        //


After Add
Code:

        $id_user = $split_user_id_username[0];

        $sql = "SELECT user_avatar, user_avatar_type
                FROM " . USERS_TABLE . "
                WHERE user_id = " . $id_user;
 
        if ( !($result = $db->sql_query($sql)) ) {
           message_die(GENERAL_ERROR, 'Could not query users table', '', __LINE__, __FILE__, $sql);
        }
 
        $row = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);
 
        $user_avatar = $row['user_avatar'];
        $user_avatar_type = $row['user_avatar_type'];

        $avatar_img = '';
        if ( $user_avatar_type )
        {
                switch( $user_avatar_type )
                {
                        case USER_AVATAR_UPLOAD:
                                $avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $user_avatar . '" alt="" />' : '';
                                break;
                        case USER_AVATAR_REMOTE:
                                $avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $user_avatar . '" alt="" />' : '';
                                break;
                        case USER_AVATAR_GALLERY:
                                $avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $user_avatar . '" alt="" />' : '';
                                break;
                }
        }


Find
Code:
                'MEMBER_DAY' => $member_of_the_day,


After Add
Code:
                'AVATAR' => $avatar_img,



In templates/subSilver/index_body.tpl

Find
Code:
{MEMBER_DAY}


Before Add
Code:
<BR/>{AVATAR}


Edit: Fixed up code so it would work properly
_________________

UzziSoft Administrator


Last edited by alexi02 on Wed Feb 14, 2007 10:36 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
joyce



Joined: 10 Feb 2007
Posts: 6

PostPosted: Tue Feb 13, 2007 1:33 pm    Post subject: Reply with quote

Hiya Alexi... it doesn't seem to work Sad.

Also.. when i add this portion it gives me error...
Code:
// Add user_id and username together
   $combine_user_id_username = implode("\n",$user_details);
   $combine_user_id_username = addslashes($combine_user_id_username);
   $combine_user_id_username = str_replace("\'", "''", $combine_user_id_username)
Back to top
View user's profile Send private message
alexi02
Site Admin


Joined: 17 Aug 2004
Posts: 230
Location: Brisbane, Australia

PostPosted: Tue Feb 13, 2007 1:43 pm    Post subject: Reply with quote

Ah I forgot to change the SQL.

In index.php

Find
Code:
$sql = "SELECT user_id, username
                FROM " . USERS_TABLE;


Replace with
Code:
$sql = "SELECT user_id, username, user_avatar, user_avatar_type
                FROM " . USERS_TABLE;

_________________

UzziSoft Administrator
Back to top
View user's profile Send private message Send e-mail Visit poster's website
joyce



Joined: 10 Feb 2007
Posts: 6

PostPosted: Tue Feb 13, 2007 2:36 pm    Post subject: Reply with quote

This is my code... it does show the photo and the name but the photo that shows is different from the name... Sad

Code:
$sql = "SELECT username, user_id, user_level, user_provider, user_avatar, user_avatar_type, user_allowavatar
            FROM " . USERS_TABLE . "
            WHERE user_id <> " . ANONYMOUS . " && user_level != 1 && user_provider = 'provider' && user_allowavatar = '1'
            AND user_avatar != ''
              ORDER BY username";

        if ( !($result = $db->sql_query($sql)) ) {
           message_die(GENERAL_ERROR, 'Could not query users table', '', __LINE__, __FILE__, $sql);
        }
      

        $row = $db->sql_fetchrowset($result);
        $db->sql_freeresult($result);
        $row_count = count($row);
      
      // If the time isn't empty then check to see if the Member of the Day should change
        if ( !empty($board_config['member_of_the_day_time']) ) {
           $current_time = time();
           $new_time = $board_config['member_of_the_day_time'] + 60;

           // If the current time is bigger than the last time the member of the day was set + 1 day, then update the member of the day
           if ($current_time >= $new_time) {
              update_member_of_the_day($row,$row_count);
           }
        }
        else {
           update_member_of_the_day($row,$row_count);
        }
      
      
      
      // Split up the user_id and username
        $split_user_id_username = explode("\n",$board_config['member_of_the_day']);

        $temp_url = "profile.$phpEx?mode=viewprofile&u=" . $split_user_id_username[0];
        $member_of_the_day = '<a href="' . $temp_url . '">' . $split_user_id_username[1] . '</a>';
      
      $id_user = $split_user_id_username[0];

        $user_avatar = $row[$id_user]['user_avatar'];
        $user_avatar_type = $row[$id_user]['user_avatar_type'];
      
      $avatar_img = '';
        if ( $user_avatar_type )
        {
                switch( $user_avatar_type )
                {
                        case USER_AVATAR_UPLOAD:
                                $avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $user_avatar . '" width= "100" height= "100" alt="" border="0" />' : '';
                                break;
                        case USER_AVATAR_REMOTE:
                                $avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $user_avatar . '" alt="" />' : '';
                                break;
                        case USER_AVATAR_GALLERY:
                                $avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $user_avatar . '" alt="" />' : '';
                                break;
                }
        }
      
      
      
      

      $template->assign_vars(array(
          'PHOTO' => $avatar_img,
         'MEMBER_DAY' => $member_of_the_day
         )
      );
Back to top
View user's profile Send private message
alexi02
Site Admin


Joined: 17 Aug 2004
Posts: 230
Location: Brisbane, Australia

PostPosted: Tue Feb 13, 2007 3:37 pm    Post subject: Reply with quote

Does it show the same photo every time as it should or does it keep changing?

Also check if it's showing the avatar of the user before or after the user it's meant to be shown for?
_________________

UzziSoft Administrator
Back to top
View user's profile Send private message Send e-mail Visit poster's website
joyce



Joined: 10 Feb 2007
Posts: 6

PostPosted: Tue Feb 13, 2007 3:53 pm    Post subject: Reply with quote

alexi02 wrote:
Does it show the same photo every time as it should or does it keep changing?


- I change it to 30sec for now to c how it goes... it changes alright, sometimes it doesn't show the avatar at all just the name sometimes.

alexi02 wrote:
Also check if it's showing the avatar of the user before or after the user it's meant to be shown for?


-I can send you via e-mail my site so you can c it... I put it in the block and not in the index... btw did it work on your side(index)?
Back to top
View user's profile Send private message
alexi02
Site Admin


Joined: 17 Aug 2004
Posts: 230
Location: Brisbane, Australia

PostPosted: Tue Feb 13, 2007 5:52 pm    Post subject: Reply with quote

Yeah, send me an email with your website to admin@uzzisoft.com

The code I gave you for the avatar worked fine on my phpBB test forum.
_________________

UzziSoft Administrator
Back to top
View user's profile Send private message Send e-mail Visit poster's website
joyce



Joined: 10 Feb 2007
Posts: 6

PostPosted: Wed Feb 14, 2007 5:33 pm    Post subject: Reply with quote

Thank you so much for solving my problem... It works great!!! Very Happy Very Happy Very Happy

Please let me know if the other request could be done as well Smile

Again many thanks Smile

Joyce
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    UzziSoft Forum Index -> phpBB Mods All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group