MyBB Community Forums

Full Version: Profile popups (without core edit)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
This version not work with Google SEO

Uses a portion of the code of this http://community.mybb.com/thread-151344.html

Thanks for great tutorial effone

Dependency:
This need jQuery library. Check link below to more information: http://demonate.com/thread-773.html

1 - Download TinyBox2 : http://www.scriptiny.com/2011/03/javascr...l-windows/
2 - Open tinybox2/tinybox.js and add code below before all
jQuery.noConflict();
jQuery(document).ready(function(jQ){
jQ("a[href*='user-'], a[href*='member.php?action=profile&uid=']").click(function() {
    return false;
});
    jQ("a[href*='user-'], a[href*='member.php?action=profile&uid=']").each(function(){
        var uid = parseInt(jQ(this).attr('href').match(/\d+/)); 
        jQ(this).attr({"onclick":"TINY.box.show({url:'member.php?action=profile_pop&uid="+uid+"',width:500,top:80})"});
});
});
3 - Copy tinybox2/tinybox.js in jscripts folder
4 - Copy tinybox2/images/close.png and loader.gif [Image: attachment.php?aid=31104] in images folder
5 - 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>
6 - 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"

7- 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

Image:
[Image: hcDoAIl.png]
getting this error sir Sad
[Image: z5ws.png]
(2014-02-27, 05:06 AM)melchor Wrote: [ -> ]getting this error sir Sad
[Image: z5ws.png]

find in profile.php

		require_once MYBB_ROOT."inc/functions_online.php";

add below

	
        require_once MYBB_ROOT."inc/class_parser.php";   

and re-check all steps..
I made some changes in almost all steps.

Some modifications:

- Fixed parse_badwords bug
- Use default_avatar.gif if user not has avatar
- Changed style (font size etc..) and changed loader.gif with new one (this is better)
- If you already use this, better redo all steps.
hay your tutorial not work for my template
can you help ?

1 .
[attachment=31108]


2.[attachment=31109]


www.prototype.esy.es
user : beta_tester
pasword :123456
^ haven't you noticed this :
martec Wrote:This version not work with Google SEO
(2014-02-27, 11:54 AM)elcoputra Wrote: [ -> ]hay your tutorial not work for my template
can you help ?

1 .

2.

www.prototype.esy.es
user : beta_tester
pasword :123456

(2014-02-27, 12:12 PM).m. Wrote: [ -> ]^ haven't you noticed this :
martec Wrote:This version not work with Google SEO

yes not work with google SEO plugin...
can try the version with core edit http://community.mybb.com/thread-137866.html
owh hahaha sorry my bad
@melchor

sorry...

but need some other modification...

in profile.php remove code below

		// Fetch their current location
		$lang->load("online");
		require_once MYBB_ROOT."inc/functions_online.php";
        require_once MYBB_ROOT."inc/class_parser.php";   
		$activity = fetch_wol_activity($session['location'], $session['nopermission']);
		$location = build_friendly_wol_location($activity);
		$location_time = my_date($mybb->settings['timeformat'], $memprofile['lastactive']);
why im getting blank sir? im using google seo plugin
[Image: unyi.png]
(2014-02-27, 01:53 PM)melchor Wrote: [ -> ]why im getting blank sir? im using google seo plugin
[Image: unyi.png]

not work with google SEO plugin
can try the version with core edit http://community.mybb.com/thread-137866.html
Pages: 1 2 3