Date and Group Quesstion.

Discussion forum for MOD Writers regarding MOD Development.
Locked
User avatar
EFiNSTORM
Registered User
Posts: 163
Joined: Fri Dec 26, 2008 4:09 am
Location: localhost

Date and Group Quesstion.

Post by EFiNSTORM »

Hey guys i am having trouble getting the last time visited date right.

Code: Select all

'LAST_SEEN'			=> $user->format_date($row['user_lastvisit']),
Which displays "Thu Feb 4, 2011 2:53 am" and when i check the member list it shows "Thu Feb 10, 2011 10:26 pm"

can you guys point out how to fix this issues.

ok next thing.
I am trying to accomplish is i have default group where all my buddies are and i am wondering if there is a way to show what other groups the are in.

Ex:
Username, Groups, Last Seen
Joe , memeber, admin Today
Mike, members Today
Smith, leader, graphics, admin Yesterday


Hope you guys know what i mean .

thanks.
User avatar
EFiNSTORM
Registered User
Posts: 163
Joined: Fri Dec 26, 2008 4:09 am
Location: localhost

Re: Date and Group Quesstion.

Post by EFiNSTORM »

Any one?
CMCDragonkai
Registered User
Posts: 483
Joined: Sat Jun 09, 2007 11:37 pm
Location: Australia.. and other parts of the world sometimes...

Re: Date and Group Quesstion.

Post by CMCDragonkai »

For your first issue, the problem may be caused by the location of where you are viewing:

Code: Select all

$user->format_date($row['user_lastvisit'])
You need to provide more detailed information.
Show phpbb threads as html articles. V.5.03 Thanks Erik! (This will be updated constantly as I or others contribute...) This code is to be used on external HTML page, but if you want a template version see here.

For the best PHPBB total modification to posting - bbcode, embedding... everything! Visit MSSTI's ABBC3 Modification.
User avatar
EFiNSTORM
Registered User
Posts: 163
Joined: Fri Dec 26, 2008 4:09 am
Location: localhost

Re: Date and Group Quesstion.

Post by EFiNSTORM »

The issue i am having that the last visit that is stored in the users table is not accurate. With the code i posted above.

My script says my last visit was. Thu Feb 10, 2011 2:53 am

And then memeberlist.php says Wed Feb 16, 2011 3:17 am

I know it has to do with session table since the sessions that are stored don't update the users table right away.
CMCDragonkai
Registered User
Posts: 483
Joined: Sat Jun 09, 2007 11:37 pm
Location: Australia.. and other parts of the world sometimes...

Re: Date and Group Quesstion.

Post by CMCDragonkai »

Do you know which one is correct?
Show phpbb threads as html articles. V.5.03 Thanks Erik! (This will be updated constantly as I or others contribute...) This code is to be used on external HTML page, but if you want a template version see here.

For the best PHPBB total modification to posting - bbcode, embedding... everything! Visit MSSTI's ABBC3 Modification.
User avatar
EFiNSTORM
Registered User
Posts: 163
Joined: Fri Dec 26, 2008 4:09 am
Location: localhost

Re: Date and Group Quesstion.

Post by EFiNSTORM »

CMCDragonkai wrote:Do you know which one is correct?
Yes the one in the member list is correct.
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52136
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Date and Group Quesstion.

Post by Brf »

The memberlist uses the session_time, if there is one.
User avatar
EFiNSTORM
Registered User
Posts: 163
Joined: Fri Dec 26, 2008 4:09 am
Location: localhost

Re: Date and Group Quesstion.

Post by EFiNSTORM »

Brf wrote:The memberlist uses the session_time, if there is one.
Yes i looked into the memberlist.php and i seen the query where it take the session info from. I just have no idea how to link it to my current query.

Btw Brf would you know how i could build a query to show members from a default group and then show which other groups they are part off ?
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52136
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Date and Group Quesstion.

Post by Brf »

Code: Select all

$member_array = group_memberships($group_number);
$group_array = group_memberships(false,$member_array);
If you need to see what individual groups each user is a member of, then put the second statement in a loop for each user in the array.

Wait.... that is not right.
User avatar
EFiNSTORM
Registered User
Posts: 163
Joined: Fri Dec 26, 2008 4:09 am
Location: localhost

Re: Date and Group Quesstion.

Post by EFiNSTORM »

Brf wrote:

Code: Select all

$member_array = group_memberships($group_number);
$group_array = group_memberships(false,$member_array);
If you need to see what individual groups each user is a member of, then put the second statement in a loop for each user in the array.
So basically all i do is a sql query to get members from a "default group" and then use the foreach loop to get what other groups they are part of?
User avatar
Brf
Support Team Member
Support Team Member
Posts: 52136
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Date and Group Quesstion.

Post by Brf »

Code: Select all

$member_array = group_memberships($group_number);

$members = array();
foreach ($member_array as $ky => $member_row)
{
    $members[] = $member_row['user_id'];
}
$group_array = group_memberships(false,$members);
Then $group_array will have the list of 'user_id' and 'group_id'
User avatar
EFiNSTORM
Registered User
Posts: 163
Joined: Fri Dec 26, 2008 4:09 am
Location: localhost

Re: Date and Group Quesstion.

Post by EFiNSTORM »

Brf wrote:

Code: Select all

$member_array = group_memberships($group_number);

$members = array();
foreach ($member_array as $ky => $member_row)
{
    $members[] = $member_row['user_id'];
}
$group_array = group_memberships(false,$members);
Then $group_array will have the list of 'user_id' and 'group_id'
I am totally brain dead. This my current query i been using which displays the group names and members that are in each group how would i mod it to work with what you provided me.

Code: Select all

$groups=array(9, 60, 47, 56); //multiple group id's
 
foreach ($groups as $groupid)
{

   $sql = "SELECT * FROM ".GROUPS_TABLE." WHERE group_id=$groupid ";

   $result = $db->sql_query($sql);
   while ($row = $db->sql_fetchrow($result))
   {
         $template->assign_block_vars('roster_group', array(
                    'GROUP'      => $row['group_name'],
                    ));		
   }

         $sql = "SELECT u.*, g.*, r.*, ug.* FROM ".USERS_TABLE." u, ".RANKS_TABLE." r, ".GROUPS_TABLE." g, ".USER_GROUP_TABLE." ug
               WHERE g.group_id = $groupid
               AND ug.group_id = $groupid
               AND u.user_id = ug.user_id
               AND r.rank_id = u.user_rank
			   ORDER BY ug.group_leader DESC";
           
      $result = $db->sql_query($sql);
   
      while ($row = $db->sql_fetchrow($result))
      {  	  
	  //DUMP INFO INTO STYLE
	  	  
      $template->assign_block_vars('roster_group.roster', array(
				
                    ));
      }
}
Locked

Return to “[3.0.x] MOD Writers Discussion”