TinyPortal

Development => Support => Topic started by: keith021773 on October 18, 2006, 04:43:56 PM

Title: PM button on forum stats
Post by: keith021773 on October 18, 2006, 04:43:56 PM
Hey all.   Quick question.    Is there a way to edit the original "forum stats" box to include a PM button beside the users name?     The forum stats that I am talking about is called "Some Stats" here on the left side.     I liked in the box on my site but it doesn't have anywhere to edit or change the code..   Thanks.
Title: Re: PM button on forum stats
Post by: fb on October 19, 2006, 06:39:23 AM
 
In the Themes\default\TPortalBlocks.template.php file, find this:

Quote
      foreach($online['users'] as $user){
      echo $bullet2 , $user['hidden'] ? '' . $user['link'] . '' : $user['link'];
      echo '
';
      }
      echo '</div>';
         }
   echo '
</td></tr></table>';

change it to this:

Quote
      foreach($online['users'] as $user){
      echo $bullet2 , $user['hidden'] ? '' . $user['link'] . '' : $user['link'];
      echo ' <a href="', $scripturl, '?action=pm;sa=send;u=', $context['user']['id'], '"> (PM)</a>';
      echo '
';
      }
      echo '</div>';
         }
   echo '
</td></tr></table>';

Title: Re: PM button on forum stats
Post by: keith021773 on October 20, 2006, 02:48:10 AM
That didn't work.   It did however put PM/URL next to each users nameand they weren't lined up right..    Thanks though..    I appreciate it.
Title: Re: PM button on forum stats
Post by: rbh on October 20, 2006, 03:28:47 AM
i tried it with this

      foreach($online['users'] as $user){
      echo $bullet2 , $user['hidden'] ? '' . $user['link'] . '' : $user['link'];
      echo ' <a href="', $scripturl, '?action=pm;sa=send;u=', $context['user']['id'], '"> PM';
      echo '
';
      }
      echo '</div>';
         }
   echo '
</td></tr></table>';


and that worked
Title: Re: PM button on forum stats
Post by: JPDeni on October 20, 2006, 04:13:25 AM
Let's try this again. The link isn't being closed off.

     foreach($online['users'] as $user){
      echo $bullet2 , $user['hidden'] ? '' . $user['link'] . '' : $user['link'];
      echo ' <a href="', $scripturl, '?action=pm;sa=send;u=', $context['user']['id'], '"> (PM)</a>';
      echo '
';
      }
      echo '</div>';
         }
   echo '
</td></tr></table>';


That will put a link by the name, with the text PM, which, when clicked will take the clicker to a place where they can send a PM to the user with that name. You asked for a "button." I'm not sure there's room for a button, if I understand where you intend to put it.
Title: Re: PM button on forum stats
Post by: jacortina on October 20, 2006, 04:18:39 AM
What is the 'hidden' check doing in that code? Shouldn't hiding be applied to this link?
Title: Re: PM button on forum stats
Post by: fb on October 20, 2006, 06:57:16 AM
Quote from: keith021773 on October 20, 2006, 02:48:10 AM
That didn't work.   It did however put PM/URL next to each users nameand they weren't lined up right..    Thanks though..    I appreciate it.

The code is good, but i posted it in a QUOTE , instead of CODE , which
alters what you will actually see on screen.  Sry..



      foreach($online['users'] as $user){
echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
echo ' <a href="', $scripturl, '?action=pm;sa=send;u=', $context['user']['id'], '"> (PM)</a>';
echo '<br />';
   }
echo '</div>';
         }
echo '<br /></td></tr></table>';



It is actually just 1 line that i've added, but showing a general area
of the script for your reference.
 
Title: Re: PM button on forum stats
Post by: keith021773 on October 20, 2006, 11:38:01 AM
Maybe a button isn't what I wanted..    How can I get the greeen online/pm icon beside their name.   :)     I'm not very good with words.  LOL
Title: Re: PM button on forum stats
Post by: JPDeni on October 20, 2006, 02:25:09 PM
Oh! :)

Give this a try:
foreach($online['users'] as $user){
  echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];
  echo ' <a href="', $scripturl, '?action=pm;sa=send;u=', $user['id'], '"> <img src="' . $settings['images_url'] . '/useron" /></a>';
  echo '<br />';
}


J. A., you'd think that the hidden folks should be able to remain hidden, but that's how it is in the original code.
Title: Re: PM button on forum stats
Post by: jacortina on October 20, 2006, 02:32:54 PM
Right. I see now that 'hidden's won't be in the list if they're not shown to the viewer at all. The hidden check is only to italicize for those who ARE allowed to view hidden users.