[ABD] UserStars

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
shahinavthal
Registered User
Posts: 277
Joined: Fri Sep 19, 2008 6:53 am

Re: [RC1] UserStars

Post by shahinavthal »

no wonder i get a lot of sql errors and syntax errors...so i reverted the edits to the functions and 2 other files to restore the site back :lol:
User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Re: [RC2] UserStars

Post by stickerboy »

Changes have now been committed. For anyone wanting to update to RC2, make the changes on the previous page :)
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red
User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Re: [RC3] UserStars

Post by stickerboy »

Download has been updated for RC3 - which is really 1.0.0, but I can't put that in the dev topic title ;) MOD has now been submitted to the MODs Database. There have been a few changes between RC2 and RC3/Final - basically changing the 'if' statements for inline-'if's. Tidy's up the code a little. I don't have an upgrade script and probably won't put one out. Just look through the main RC2 install.xml file for all the if statements and replace that code with the new download :)
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red
DJ Skitzo
Registered User
Posts: 596
Joined: Sun Aug 12, 2007 7:25 pm

Re: [RC3] UserStars

Post by DJ Skitzo »

Would it be possible to add an option for a star to be placed beside a username if they are a member of a specific group?

This would work well with donation/subscription mods which add donating/paid members to a group
User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Re: [RC3] UserStars

Post by stickerboy »

Not for the current version, but I can certainly mark it as a possibility for a future version (1.2 or 2.0) :)
Noted on the dev site now ;)
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red
indijanac
Registered User
Posts: 105
Joined: Wed Jan 14, 2009 1:10 am

Re: [RC3] UserStars

Post by indijanac »

what about subsilver support?
User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Re: [RC3] UserStars

Post by stickerboy »

I don't provide subSilver2 support for any of my MODs of Code Snippets - only prosilver
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red
User avatar
Lisbon
Registered User
Posts: 825
Joined: Wed Jan 30, 2008 12:28 pm
Location: Zermatt

Re: [RC3] UserStars

Post by Lisbon »

cherokee red wrote:I don't provide subSilver2 support for any of my MODs of Code Snippets - only prosilver
:cry: :cry: I like subsilver. Well, nothing to do :oops:
User avatar
manuxtreme
Registered User
Posts: 48
Joined: Tue Aug 23, 2005 11:54 am

Re: [RC3] UserStars

Post by manuxtreme »

Will this be only one field? or will I be able to have multiple fields?

I mean will this just add one star? I ask cause I want to have a few like one donator icon and a few others.
**CASANOVA**
Registered User
Posts: 99
Joined: Wed May 26, 2010 12:31 pm
Contact:

Re: [RC3] UserStars

Post by **CASANOVA** »

Great mod but one question!


How I can make that this star is be visible on
Users active over the last 24 hours, in chat body, on the index when you lookin at the Last post author and in the viewforum body in the postauthor!

I hope so that you understand me! It is working for viewtopic body ofc and memberlist_view and for who is online but I want to make star visible on this parts too:
Users active over the last 24 hours, in chat body, on the index when you lookin at the Last post author and in the viewforum body in the postauthor!

Tnx in advance


PS Why you don't make a code for subsilver2 based styles :(
User avatar
noth
Registered User
Posts: 2487
Joined: Fri Jan 07, 2005 7:10 pm
Location: North Surrey
Contact:

Re: [RC3] UserStars

Post by noth »

is there a DEMO of this in action please?

sounds like a great facility to have :)
User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Re: [RC3] UserStars

Post by stickerboy »

**CASANOVA** wrote:How I can make that this star is be visible on
Users active over the last 24 hours, in chat body, on the index when you lookin at the Last post author and in the viewforum body in the postauthor!
Can you post a link to the MODs you use for your chat and active users, thanks.
I will post the changes for viewforum shortly
**CASANOVA** wrote:PS Why you don't make a code for subsilver2 based styles :(
It's hard enough to maintain something for prosilver, nevermind a 2nd style. It just over-complicates things and I really don't have to time to provide support for both. All the work I do on my own sites is based on prosilver and I prefer that as it's much cleaner to work with :)
That being said, If anyone wishes to provide changes for subSilver based styles, I will gladly include them in my MOD (credited, of course, but again I will not provide support for them ;))
noth wrote:is there a DEMO of this in action please?
Demo is linked in the 1st post
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red
**CASANOVA**
Registered User
Posts: 99
Joined: Wed May 26, 2010 12:31 pm
Contact:

Re: [RC3] UserStars

Post by **CASANOVA** »

Active users mod: http://www.phpbb.com/community/viewtopi ... 9&t=839925
Chat: Hmm I didn' instal that so I really don' t know which version is it :(! My friend instal that for me. I can make a print screen so you can view it if you want but for active users I use this mod UP!


And one more thing cherokee I didn' t tell you I have style based on subsilver2! And I didn' t tell you too that I remake your code in style code part and make it working for subsilver2 based style ;)!

I just need to make this star be visible in Users active over the last 24 hours, in chat body, on the index when you lookin at the Last post author and in the viewforum body in the postauthor and forgot in the thanks list too but I don' t know how and what to edit :(


EDIT: For thanks I use this http://www.phpbb.com/community/viewtopic.php?t=1690905

I am desperate because of this mod :cry: :lol: I want it so badly to make the star visible on this parts too!
User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Re: [RC3] UserStars

Post by stickerboy »

I do apologise for not posting back sooner, but honestly this is the 1st real chance I've had to look into this for you.

Activity Stats MOD Add-On
OPEN: includes/functions_activity_stats.php
FIND:

Code: Select all

    global $template, $user; 
REPLACE WITH:

Code: Select all

    global $template, $user, $config, $phpbb_root_path; 
FIND:

Code: Select all

            $template->assign_block_vars('lastvisit', array(
                'USERNAME_FULL'    => get_username_string((($row['user_type'] == USER_IGNORE) ? 'no_profile' : 'full'), $row['user_id'], $row['username'], $row['user_colour']),
            )); 
REPLACE WITH:

Code: Select all

            $template->assign_block_vars('lastvisit', array(
                'USERNAME_FULL'    => get_username_string((($row['user_type'] == USER_IGNORE) ? 'no_profile' : 'full'), $row['user_id'], $row['username'], $row['user_colour']),
                'USER_STAR'        => ($row['user_star'] == 1) ? '<img src="' . $phpbb_root_path . $config['user_star_img'] . '" alt="' . $row['username'] . ' ' . $row['user_star_text'] . '" title="' . $row['username'] . ' ' . $row['user_star_text'] . '" />' : '',
            )); 
FIND:

Code: Select all

'SELECT'    => 'u.user_id, u.user_colour, u.username, u.user_type', 
REPLACE WITH:

Code: Select all

'SELECT'    => 'u.user_id, u.user_colour, u.username, u.user_type, u.user_star, u.user_star_text', 
FIND:

Code: Select all

                'user_colour'    => $row['user_colour'], 
AFTER ADD:

Code: Select all

                'user_star'    => $row['user_star'],
                'user_star_text'    => $row['user_star_text'], 
OPEN: styles/your_style/template/index_body.html
FIND:

Code: Select all

<!-- BEGIN lastvisit -->{lastvisit.USERNAME_FULL}
IN-LINE AFTER ADD:

Code: Select all

 {lastvisit.USER_STAR}
Right now there's no easy way to add the star to the index/viewforum without querying the users table separately and pulling the results. IIRC, I left them out intentionally as it causes unnecessary overheard (if you notice other areas when I place the star, I usually piggy back on to another query).
As for the chat MOD, i'd have to know which MOD and which version before I can do anything - but the code will probably be very similar to that I've posted above
Last edited by stickerboy on Wed Jun 23, 2010 1:12 pm, edited 2 times in total.
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red
**CASANOVA**
Registered User
Posts: 99
Joined: Wed May 26, 2010 12:31 pm
Contact:

Re: [RC3] UserStars

Post by **CASANOVA** »

I don' t think so this is good :/ I do exactly what you have told me and I got error on index
home/xxxxx/public_html/forum/includes/functions_activity_stats.php on line 48

Here is Activity Stats Code

Code: Select all

<?php
/**
*
* @package phpBB3
* @author Highway of Life ( David Lewis ) http://startrekguide.com
* @version $Id$
* @copyright (c) 2008 Star Trek Guide Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
	exit();
}

/**
 * Display extra stats, activity over the last 24 hours for new users, posts and topics.
 *
 * @return bool
 */
function activity_mod()
{
	global $template, $user;

	$user->add_lang('mods/activity_stats');

	// if the user is a bot, we won’t even process this function...
	if ($user->data['is_bot'])
	{
		return false;
	}

	// obtain user activity data
	$active_users = obtain_active_user_data();
	
	// obtain posts/topics/new users activity
	$activity = obtain_activity_data();

	// 24 hour users online list, assign to the template block: lastvisit
	foreach ($active_users as $row)
	{
			$template->assign_block_vars('lastvisit', array(
				'USERNAME_FULL'	=> get_username_string((($row['user_type'] == USER_IGNORE) ? 'no_profile' : 'full'), $row['user_id'], $row['username'], $row['user_colour']),
			));
	}

	// assign the stats to the template.
	$template->assign_vars(array(
		'USERS_24HOUR_TOTAL'	=> sprintf($user->lang['USERS_24HOUR_TOTAL'], sizeof($active_users)),
		'24HOUR_TOPICS'			=> sprintf($user->lang['24HOUR_TOPICS'], $activity['topics']),
		'24HOUR_POSTS'			=> sprintf($user->lang['24HOUR_POSTS'], $activity['posts']),
		'24HOUR_USERS'			=> sprintf($user->lang['24HOUR_USERS'], $activity['users']),
	));

	return true;
}

/**
 * Obtain an array of active users over the last 24 hours.
 *
 * @return array
 */
function obtain_active_user_data()
{
	global $cache;

	if (($active_users = $cache->get('_active_users')) === false)
	{
		global $db;

		$active_users = array();

		// grab a list of users who are currently online
		// and users who have visited in the last 24 hours
		$sql_ary = array(
			'SELECT'	=> 'u.user_id, u.user_colour, u.username, u.user_type',
			'FROM'		=> array(USERS_TABLE => 'u'),
			'LEFT_JOIN'	=> array(
				array(
					'FROM'	=> array(SESSIONS_TABLE => 's'),
					'ON'	=> 's.session_user_id = u.user_id',
				),
			),
			'WHERE'		=> 'u.user_lastvisit > ' . (time() - 86400) . ' OR s.session_user_id <> ' . ANONYMOUS,
			'GROUP_BY'	=> 'u.user_id',
			'ORDER_BY'	=> 'u.username',
		);

		$result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary));

		while ($row = $db->sql_fetchrow($result))
		{
			$active_users[$row['user_id']] = array(
				'user_id'		=> $row['user_id'],
				'user_type'		=> $row['user_type'],
				'username'		=> $row['username'],
				'user_colour'	=> $row['user_colour'],
			);
		}
		$db->sql_freeresult($result);

		// cache this data for 1 hour, this improves performance
		$cache->put('_active_users', $active_users, 3600);
	}

	return $active_users;
}

/**
 * obtained cached 24 hour activity data
 *
 * @return array
 */
function obtain_activity_data()
{
	global $cache;

	if (($activity = $cache->get('_activity_mod')) === false)
	{
		global $db;

		// set interval to 24 hours ago
		$interval = time() - 86400;

		$activity = array();

		// total new posts in the last 24 hours
		$sql = 'SELECT COUNT(post_id) AS new_posts
				FROM ' . POSTS_TABLE . '
				WHERE post_time > ' . $interval;
		$result = $db->sql_query($sql);
		$activity['posts'] = $db->sql_fetchfield('new_posts');
		$db->sql_freeresult($result);

		// total new topics in the last 24 hours
		$sql = 'SELECT COUNT(topic_id) AS new_topics
				FROM ' . TOPICS_TABLE . '
				WHERE topic_time > ' . $interval;
		$result = $db->sql_query($sql);
		$activity['topics'] = $db->sql_fetchfield('new_topics');
		$db->sql_freeresult($result);

		// total new users in the last 24 hours, counts inactive users as well
		$sql = 'SELECT COUNT(user_id) AS new_users
				FROM ' . USERS_TABLE . '
				WHERE user_regdate > ' . $interval;
		$result = $db->sql_query($sql);
		$activity['users'] = $db->sql_fetchfield('new_users');
		$db->sql_freeresult($result);

		// cache this data for 1 hour, this improves performance
		$cache->put('_activity_mod', $activity, 3600);
	}

	return $activity;
}
?>
Locked

Return to “[3.0.x] Abandoned MODs”