MyBB Community Forums

Full Version: CSS Userstars
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Never done this before nor know how to, seen couple of forums back in day even now using Fa Star as user stars for postbit/profile. If anybody know's how to do this working with user titles I'd appreciate it if somebody would help.

So basically I'm trying to use fa icon star instead of image star.
It can be done by replacing {$post['groupimage']} in postbit template with something like <div class="userbar userbar-4"><i class="fa fa-user" aria-hidden="true"></i> Administrator</div>
where 4 is the group id of administrators group.
Here are some userbars i tried https://codepen.io/DarkPowerInvader/pen/baVGMV
No you don't get it, the userstars is basically images/star.png right?
Instead of using image I'd like to use fa-fa-star which css color, I want it replaced basically instead of using image star I'd like to use css based fa star.
Have you tryed something like this plugin: https://community.mybb.com/mods.php?action=view&pid=652 ?

I don't really understand what do you need...
That's group image bro I need something like this basically..
https://i.imgur.com/9l1BRSE.png
The user stars.....
So actually you want to have for example 6 empty stars at each user's rank and than with each new star this old one empty becomes full, right?
(2017-12-20, 05:09 PM)Ikerepc Wrote: [ -> ]So actually you want to have for example 6 empty stars at each user's rank and than with each new star this old one empty becomes full, right?

Yeah so it works like default system basically by user titles, but it's just the stars I want them to be fa-fa-star
(2017-12-20, 04:54 PM)Livewire Wrote: [ -> ]No you don't get it, the userstars is basically images/star.png right?
Instead of using image I'd like to use fa-fa-star which css color, I want it replaced basically instead of using image star I'd like to use css based fa star.

I remembered someone done it earlier have you tried messing with postbit_userstar template i guess it includes the key to do it.
as above helper suggested,
you can change content of postbit_userstar template (like below)
<i class="fa fa-star-o"></i>


it can be wrapped with a span element & css class to modify the display [eg. different colored stars for each group]
<span class="fastars_{$mybb->usergroup['title']}"><i class="fa fa-star-o"></i></span>

.fastars_Administrators {color: green;}
Hi thank you m.
It work's perfectly.

There's one problem I can't seem to figure out with group label I managed to change codes around to work default user titles in postbit and user cp but I can't seem to figure out for memberlist and profile..
Here's the php codes.

<?php

/*
        Groupimage to label text [v1.2]
      (c) Copyright 2013-2016 by Inferno
 
      @author    : Inferno (http://www.Inferno24.pl)
      @contact   : [email protected]
      @date      : 03-02-2016
      @update    : 17-11-2017

*/

if(!defined("IN_MYBB")){
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
$plugins->add_hook("postbit", "rank_postbit");
$plugins->add_hook("member_profile_end", "rank_profile");
$plugins->add_hook("usercp_end", "rank_usercp");
$plugins->add_hook("memberlist_user", "rank_memberlist");

function labelrank_info(){
	global $lang;
	$lang->load("labelrank_group");
	return array(
		'name'			=> 'Groupimage to label text',
		'description'	=> $lang->agi_descr,
		'website'		=> 'http://www.inferno24.pl',
		'author'		=> 'Inferno',
		'authorsite'	=> 'http://www.Inferno24.pl',
		'version'		=> '1.2',
		'guid'			=> 'bab9eaae39210fd31d6c31c4fe4c9baf',
		'codename'		=> 'groupimage_to_labeltext'
	);
}
function labelrank_activate(){
    global $db,$lang;
	$lang->load("labelrank_group");
    $group = array(
        "gid"            => "NULL",
        "title"          => "Group Label",
        "name"           => "labelrank_group",
        "description"    => $lang->setting_description,
        "disporder"      => "1",
        "isdefault"      => "0",
    );
    
    $db->insert_query("settinggroups", $group);
    $gid = $db->insert_id();
    
    
    $setting_1 = array(
        "sid"            => "NULL",
        "name"           => "labelrank_postbit",
        "title"          => $lang->postbit_title,
        "description"    => $lang->postbit_descr,
        "optionscode"    => "yesno",
        "value"          => 'yes',
        "disporder"      => '1',
        "gid"            => intval($gid),
    );

    $db->insert_query("settings", $setting_1);

    $setting_2 = array(
        "sid"            => "NULL",
        "name"           => "labelrank_profile",
        "title"          => $lang->profile_title,
        "description"    => $lang->profile_descr,
        "optionscode"    => "yesno",
        "value"          => 'yes',
        "disporder"      => '1',
        "gid"            => intval($gid),
    );

    $db->insert_query("settings", $setting_2);

    $setting_3 = array(
        "sid"            => "NULL",
        "name"           => "labelrank_usercp",
        "title"          => $lang->usercp_title,
        "description"    => $lang->usercp_descr,
        "optionscode"    => "yesno",
        "value"          => 'yes',
        "disporder"      => '1',
        "gid"            => intval($gid),
    );

    $db->insert_query("settings", $setting_3);

    $setting_4 = array(
        "sid"            => "NULL",
        "name"           => "labelrank_memberlist",
        "title"          => $lang->memberlist_title,
        "description"    => $lang->memberlist_descr,
        "optionscode"    => "yesno",
        "value"          => 'yes',
        "disporder"      => '1',
        "gid"            => intval($gid),
    );

    $db->insert_query("settings", $setting_4);

    rebuild_settings();

    require_once MYBB_ROOT."/inc/adminfunctions_templates.php";

	find_replace_templatesets(
		"memberlist_user",
		"#" . preg_quote('{$usergroup[\'groupimage\']}') . "#i",
		'{$group_label}<br />'
	);
}
function labelrank_deactivate(){
    global $db;

	$db->delete_query("settinggroups", "name=\"labelrank_group\"");
	$db->delete_query("settings", "name LIKE \"labelrank%\"");

	require_once MYBB_ROOT."/inc/adminfunctions_templates.php";

	find_replace_templatesets(
		"memberlist_user",
		"#" . preg_quote('{$group_label}<br />') . "#i",
		'{$usergroup[\'groupimage\']}'
	);
    rebuild_settings();
} 

function rank_postbit(&$post){	
	global $mybb;

	if($mybb->settings['labelrank_postbit']){
		$usertitle = getgroupname($post['usertitle']);
		$post['usertitle'] = "<div class=\"profile-rank\"><span class=\"gid-".$post['usergroup']."\">".($post['usertitle'])."</span></div>";
	}
	
}
function rank_profile(){	
	global $mybb, $memprofile, $groupimage, $usertitle;

	if($mybb->settings['labelrank_profile']){
		$usertitle = getgroupname($memprofile['usertitle']);
		$usergroup = "<div class=\"profile-rank\"><span class=\"gid-".$memprofile['usergroup']."\">".($memprofile['usertitle'])."</span></div>";
	}
}

function rank_usercp(){
	global $mybb, $user, $usergroup, $usertitle;

	if($mybb->settings['labelrank_usercp']){
		$usertitle = getgroupname($mybb->user['usertitle']);
		$usergroup = "<div class=\"profile-rank\"><span class=\"gid-".$mybb->user['usergroup']."\">".($mybb->user['usertitle'])."</span></div>";
	}
}

function rank_memberlist(){
	global $mybb, $user, $group_label;
	if($mybb->settings['labelrank_memberlist']){
		$groupname = getgroupname($user['usergroup']);
		eval("\$group_label = '<div class=\"profile-rank\"><span class=\"gid-".$user['usergroup']."\">".$groupname."</span></div>';");
	}
}

function getgroupname($usertitle){
	global $cache;

	$usergroups = $cache->read("usergroups");
	$usertitle=$usergroups[$usertitle]['usertitle'];
	return $usertitle;
}
?>
Pages: 1 2