MyBB Community Forums

Full Version: Profile popups
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
1 - Download TinyBox2 : http://www.scriptiny.com/2011/03/javascr...l-windows/
2 - Copy tinybox2/tinybox.js in jscripts folder
3 - Copy tinybox2/images/close.png and loader.gif [attachment=31104] in images folder
4 - Edit headerinclude templates (repeat this step to all templates that you use)
add after all:
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/tinybox.js"></script>
5 - Create new template with name "profile_pop" in global template and add
<style type="text/css">
hr {
background-color:#989898;
}
</style>
<table><tr>
<td id="tvatar" style="width: 135px;text-align:center"><span><img src="{$memprofile['avatar']}" alt="" style="max-width:135px; max-height:135px" /></span></td>
<td style="vertical-align: top; padding-left: 9px; width:340px;color:#fff">
<div style="min-height:175px;line-height:1.27;"><a href="member.php?action=profile&amp;uid={$uid}"><span style="font-size:18px;color:#fff"><strong>{$formattedname}</strong></span></a>
<br /><span style="font-size:11px">{$usertitle}</span> <br /><br /><br /> 
<span style="font-size:11px;font-weight:bold"><a href="member.php?action=profile&amp;uid={$uid}" style="color:#989898">Profile Page</a> 
<a href="private.php?action=send&amp;uid={$memprofile['uid']}" style="padding-left:5px;color:#989898">Send PM</a></span><hr>
<span style="font-size:11px">{$lang->postbit_status} {$online_status} &nbsp;{$lang->registration_date} {$memregdate} 
&nbsp;{$lang->total_posts} {$memprofile['postnum']} &nbsp;{$lang->reputation} {$memprofile['reputation']} 
&nbsp;{$lang->warning_level} <a href="{$warning_link}" style="color:#989898">{$warning_level} %</a>
<br />(<a href="search.php?action=finduserthreads&amp;uid={$uid}" style="color:#989898">{$lang->find_threads}</a> &mdash; <a href="search.php?action=finduser&amp;uid={$uid}" style="color:#989898">{$lang->find_posts}</a>)<hr>
{$lang->lastvisit} {$memlastvisitdate} {$memlastvisittime}</span></div></td></tr></table>

Ps. If Search engine friendly URL is enabled in your forum, change all
"member.php?action=profile&amp;uid={$uid}" to "user-{$uid}.html"

6- Create new stylesheet wit name "tiny.css" and add (repeat this step to all templates that you use)
.tbox {position:absolute; display:none; padding:14px 17px; z-index:900;text-align:left}
.tinner {padding:15px; -moz-border-radius:5px; border-radius:5px; background:url(images/loader.gif) no-repeat 50% 50% rgba(0, 0, 0, 0.8); border-right:1px solid #333; border-bottom:1px solid #333}
.tmask {position:absolute; display:none; top:0px; left:0px; height:100%; width:100%; background-color:#FFF; z-index:800; opacity:0.5 !important;}
.tclose {position:absolute; top:0px; right:0px; width:30px; height:30px; cursor:pointer; background:url(images/close.png) no-repeat}
.tclose:hover {background-position:0 -30px}

#error {background:#ff6969; color:#fff; text-shadow:1px 1px #cf5454; border-right:1px solid #000; border-bottom:1px solid #000; padding:0}
#error .tcontent {padding:10px 14px 11px; border:1px solid #ffb8b8; -moz-border-radius:5px; border-radius:5px}
#success {background:#2ea125; color:#fff; text-shadow:1px 1px #1b6116; border-right:1px solid #000; border-bottom:1px solid #000; padding:10; -moz-border-radius:0; border-radius:0}
#bluemask {background:#4195aa}
#frameless {padding:0}
#frameless .tclose {left:6px}
#tvatar img {
    padding: 1px;
    border: 1px solid #D5D5D5;
    box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.1);
}

#tvatar img:hover {
border-color:#7D7D7D;
}

7 - create profile.php in Notepad++

<?php 
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

// Plugin info
function profile_info ()
{
	return array(
		"name"			=> "profile",
		"description"	=> "profile",
		"website"		=> "profile",
		"author"		=> "profile",
		"authorsite"	=> "profile",
		"version"		=> "profile",
		"guid" 			=> "profile",
		"compatibility" => "16*"
	);
}

$plugins->add_hook('global_start', 'profile_pop');
function profile_pop(){
	global $lang, $mybb, $templates, $profile_pop, $db;

	if($mybb->input['action'] == "profile_pop"){

		if($mybb->usergroup['canviewprofiles'] == 0)
	{
		error_no_permission();
	}
	
    $uid = $mybb->input['uid'];
	$memprofile = get_user($uid);
	$memprofile['avatar'] = htmlspecialchars_uni($memprofile['avatar']);
        if(strlen(trim($memprofile['avatar'])) == 0) {$memprofile['avatar'] = "images/default_avatar.gif";};
	$formattedname = format_name($memprofile['username'], $memprofile['usergroup'], $memprofile['displaygroup']);
        $usertitle = "";
        if (!empty($memprofile['usertitle'])) { $usertitle = $memprofile['usertitle']; $usertitle = "($usertitle)";};
	$memregdate = my_date($mybb->settings['dateformat'], $memprofile['regdate']);
	$memprofile['postnum'] = my_number_format($memprofile['postnum']);
	$warning_link = "warnings.php?uid={$memprofile['uid']}";
	$warning_level = round($memprofile['warningpoints']/$mybb->settings['maxwarningpoints']*100);
	$memlastvisitdate = my_date($mybb->settings['dateformat'], $memprofile['lastactive']);
	$memlastvisittime = my_date($mybb->settings['timeformat'], $memprofile['lastactive']);
	$lang->load("member");

	// User is currently online and this user has permissions to view the user on the WOL
	$timesearch = TIME_NOW - $mybb->settings['wolcutoffmins']*60;
	$query = $db->simple_select("sessions", "location,nopermission", "uid='$uid' AND time>'{$timesearch}'", array('order_by' => 'time', 'order_dir' => 'DESC', 'limit' => 1));
	$session = $db->fetch_array($query);
	
	if(($memprofile['invisible'] != 1 || $mybb->usergroup['canviewwolinvis'] == 1 || $memprofile['uid'] == $mybb->user['uid']) && !empty($session))
	{
		eval("\$online_status = \"".$templates->get("member_profile_online")."\";");
	}
	// User is offline
	else
	{
		eval("\$online_status = \"".$templates->get("member_profile_offline")."\";");
	}

		eval("\$profile_pop = \"".$templates->get("profile_pop")."\";");
		output_page($profile_pop);
	}
}
?>

8 - Activate profile plugin

9 - Edit inc/function.php
Find:
return "<a href=\"{$mybb->settings['bburl']}/".get_profile_link($uid)."\"{$target}{$onclick}>{$username}</a>";
Replace:
//return "<a href=\"{$mybb->settings['bburl']}/".get_profile_link($uid)."\"{$target}{$onclick}>{$username}</a>";
return "<a onclick=\"TINY.box.show({url:'{$mybb->settings['bburl']}/member.php?action=profile_pop&uid=$uid',width:500,top:80})\" href=\"javascript:void(0)\"{$target}{$onclick}>{$username}</a>";

Image:
[Image: hcDoAIl.png]
Hey great tutorial! But do you know why mine is showing the info twice?

[Image: Untitled-64.png]
(2013-04-19, 06:27 AM)fedidaido Wrote: [ -> ]Hey great tutorial! But do you know why mine is showing the info twice?

[Image: Untitled-64.png]

Check step 5...
you probably copied the code twice...

If you use black theme...

Edit tiny.css

Find

 .tinner {padding:15px; -moz-border-radius:5px; border-radius:5px; background:#fff url(images/preload.gif) no-repeat 50% 50%; border-right:1px solid #333; border-bottom:1px solid #333}

Replace
 .tinner {padding:15px; -moz-border-radius:5px; border-radius:5px; background:rgb(24, 24, 23) url(images/loader.gif) no-repeat 50% 50%; border-right:1px solid #333; border-bottom:1px solid #333}

Copy loader.gif (attachment) in images folder
nice i may try and add this.
I have checked my "member_profile_pop" when I saw this happen and the code is not repeating.

<table>
    <tr>
        <td id="tvatar">
             <span>
                 <img src="{$memprofile['avatar']}" alt="" max-width="135" max-height="135" />
             </span>
        </td>
        <td style="vertical-align: top; padding-left: 10px;">
             <a href="member.php?action=profile&amp;uid={$uid}">
                  <span style="font-size:15px">
                      <strong>{$formattedname}</strong>
                  </span>
            </a><br />
            <span style="font-size:11px">
                ({$usertitle})
            </span><br />
            {$groupimage}<br />
            {$userstars}<br /><br />
            <span style="font-size:10px;font-weight:bold">
                  <a href="member.php?action=profile&amp;uid={$uid}">
                       Profile Page
                  </a>
                  <a href="private.php?action=send&amp;uid={$memprofile['uid']}" style="padding-left:5px">
                       Send PM
                  </a>
            </span><hr>
            <span style="font-size:10px">
                {$lang->postbit_status}
                {$online_status}
                {$lang->registration_date}
                {$memregdate}
                {$lang->total_posts}
                {$memprofile['postnum']}
                {$lang->reputation}
                {$memprofile['reputation']}
                {$lang->warning_level}
                   <a href="{$warning_link}">
                      {$memprofile['warningpoints']}
                   </a><hr>
                {$lang->lastvisit}
                {$memlastvisitdate}
                {$memlastvisittime}
             </span>
            </td>
        </tr>
</table>
(2013-04-19, 01:32 PM)fedidaido Wrote: [ -> ]I have checked my "member_profile_pop" when I saw this happen and the code is not repeating.

<table>
    <tr>
        <td id="tvatar">
             <span>
                 <img src="{$memprofile['avatar']}" alt="" max-width="135" max-height="135" />
             </span>
        </td>
        <td style="vertical-align: top; padding-left: 10px;">
             <a href="member.php?action=profile&amp;uid={$uid}">
                  <span style="font-size:15px">
                      <strong>{$formattedname}</strong>
                  </span>
            </a><br />
            <span style="font-size:11px">
                ({$usertitle})
            </span><br />
            {$groupimage}<br />
            {$userstars}<br /><br />
            <span style="font-size:10px;font-weight:bold">
                  <a href="member.php?action=profile&amp;uid={$uid}">
                       Profile Page
                  </a>
                  <a href="private.php?action=send&amp;uid={$memprofile['uid']}" style="padding-left:5px">
                       Send PM
                  </a>
            </span><hr>
            <span style="font-size:10px">
                {$lang->postbit_status}
                {$online_status}
                {$lang->registration_date}
                {$memregdate}
                {$lang->total_posts}
                {$memprofile['postnum']}
                {$lang->reputation}
                {$memprofile['reputation']}
                {$lang->warning_level}
                   <a href="{$warning_link}">
                      {$memprofile['warningpoints']}
                   </a><hr>
                {$lang->lastvisit}
                {$memlastvisitdate}
                {$memlastvisittime}
             </span>
            </td>
        </tr>
</table>

i don´t know why...
you can provide link of your forum?
(2013-04-19, 06:27 AM)fedidaido Wrote: [ -> ]Hey great tutorial! But do you know why mine is showing the info twice?

[Image: Untitled-64.png]
Same happens to me...
http://thespeedyfeed.com
(2013-04-19, 11:36 PM)TheSpeedyFeed Wrote: [ -> ]
(2013-04-19, 06:27 AM)fedidaido Wrote: [ -> ]Hey great tutorial! But do you know why mine is showing the info twice?

[Image: Untitled-64.png]
Same happens to me...
http://thespeedyfeed.com

i don´t know why...

but try change 7.3 to

if($mybb->input['action'] == "profile_pop"){
    eval("\$profile_pop = \"".$templates->get("member_profile_pop")."\";");
    output_page($profile_pop);}
else
    eval("\$profile = \"".$templates->get("member_profile")."\";");
    output_page($profile);

it still does not work try the code below

if($mybb->input['action'] == "profile_pop"){
    eval("\$profile_pop = \"".$templates->get("member_profile_pop")."\";");
    output_page($profile_pop);}
if($mybb->input['action'] == "profile"){
    eval("\$profile = \"".$templates->get("member_profile")."\";");
    output_page($profile);}
Okay now it works. I did the change to this code.

if($mybb->input['action'] == "profile_pop"){
    eval("\$profile_pop = \"".$templates->get("member_profile_pop")."\";");
    output_page($profile_pop);}
else
    eval("\$profile = \"".$templates->get("member_profile")."\";");
    output_page($profile);

Thank you so much! Big Grin Ignore my pm then. xD
(2013-04-20, 12:36 AM)fedidaido Wrote: [ -> ]Okay now it works. I did the change to this code.

if($mybb->input['action'] == "profile_pop"){
    eval("\$profile_pop = \"".$templates->get("member_profile_pop")."\";");
    output_page($profile_pop);}
else
    eval("\$profile = \"".$templates->get("member_profile")."\";");
    output_page($profile);

Thank you so much! Big Grin Ignore my pm then. xD

thanks.... Big Grin
i will change first post...
Pages: 1 2 3 4 5