• 0

[IPB]user group list format


Question

9 answers to this question

Recommended Posts

  • 0

Assuming what you want is to have the group color be the name color in topics..

Here's 1 way of doing it.

sources/sql/mysql_queries.php

function topics_get_posts_with_join( $a )

Add with the other left joins:

LEFT JOIN ".SQL_PREFIX."groups g ON (m.mgroup=g.g_id)

then add this into the select line: g.prefix, g.suffix,

like this (may vary depending what you have done)

make sure the other lines are still there (m.id, m.name, m.mgroup) etc etc.

return "SELECT p.*, pp.*, g.prefix, g.suffix,

then sources/action_public/topics.php

find:

$poster['_members_display_name'] = "<a href='{$this->base_url}showuser={$poster['id']}'>{$poster['members_display_name_short']}</a>";

change to:

$poster['_members_display_name'] = "<a href='{$this->base_url}showuser={$poster['id']}'>{$poster['prefix']}{$poster['members_display_name_short']}{$poster['suffix']}</a>";

This should do it. Unless I forgot something.

  • 0

I haven't tested this that much so use at your own risk.

This will change the 'Topic Starter' into the group prefix/suffix format.

Probably others ways of doing it but this is what I have so far.

sql/mysql_queries.php

we're adding: ,m.mgroup and LEFT JOIN ".SQL_PREFIX."members m ON (t.starter_id=m.id)

make it look like this

this will do the 'I replied' topic listings

function forums_get_replied_topics_actual( $a )
	{
		return  "SELECT DISTINCT(p.author_id), t.* ,m.mgroup
					FROM ".SQL_PREFIX."topics t
						  LEFT JOIN ".SQL_PREFIX."posts p ON (p.topic_id=t.tid AND p.author_id={$a['mid']})
						LEFT JOIN ".SQL_PREFIX."members m ON (t.starter_id=m.id)
				 	WHERE t.forum_id={$a['fid']} AND {$a['query']} AND p.new_topic=0
				 	ORDER BY t.pinned desc,{$a['topic_sort']} {$a['sort_key']} {$a['r_sort_by']}
				 	LIMIT {$a['limit_a']}, {$a['limit_b']}";
	}

action_public/forums.php

find:

// No point in getting dots again...

a little bit under that you will see this.

else
		{
			$this->ipsclass->DB->simple_construct( array( 'select' => '*',
														  'from'   => 'topics t',
														  'where'  =>  $query . $add_query,
														  'order'  => 't.pinned DESC, '.$topic_sort.' t.'.$sort_key .' '. $r_sort_by,
														  'limit'  => array( intval($First), $this->ipsclass->vars['display_max_topics'] )
												 )	  );
			$this->ipsclass->DB->simple_exec();
		}

change to:

else
		{
			$this->ipsclass->DB->simple_construct( array( 'select' => 't.*',
														  'from'   => array('topics' => 't'),
														  'where'  =>  $query . $add_query,
														  'order'  => 't.pinned DESC, '.$topic_sort.' t.'.$sort_key .' '. $r_sort_by,
														  'limit'  => array( intval($First), $this->ipsclass->vars['display_max_topics'] ),
														'add_join' => array( 0 => array( 'select' => 'm.mgroup', 'from' => array( 'members' => 'm'), 'where' => 't.starter_id=m.id',   'type'   => 'left'  ) )
												 )	  );
			$this->ipsclass->DB->simple_exec();
		}

then find

		$topic['starter']	 = $topic['starter_id']	 ? $this->ipsclass->make_profile_link( $topic['starter_name'], $topic['starter_id']) : $this->ipsclass->vars['guest_name_pre'] . $topic['starter_name'] . $this->ipsclass->vars['guest_name_suf'];

change to

		$topic['starter']	 = $topic['starter_id']	 ? $this->ipsclass->make_profile_link( $this->ipsclass->make_name_formatted($topic['starter_name'],$topic['mgroup']), $topic['starter_id']) : $this->ipsclass->vars['guest_name_pre'] . $topic['starter_name'] . $this->ipsclass->vars['guest_name_suf'];

that should do it. any problems, let me know.

this is just getting the mgroup from the members table and then making the names formatted in the listings.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Why should simply opening the Action Center ... require any significant amount of CPU cycles? Too many are ignoring the elephant in the room: today's CPUs may have similar clock frequencies to CPUs from a decade ago (~4 to 5 GHz), but they run with far higher performance per clock, even on the smallest E-cores. The Action Center is a static, minor desktop element. It ought to open instantly on any CPU made in the past 2.5 decades at even low clocks. Opening a program? Boost away. Unzipping a file? Boost to your heart's content. Right-clicking the notification area? This should be an ultra-efficient, low-impact event that opens instantly. Compare today's UI elements to Windows 7 UI elements. Today's UI elements hardly do anything more substantial or important or critical, yet now require modern-day processors to jump half a GHz to reduce their latency.
    • This is not an option lmao: it is part of the KB5094126 update, pushed to all users. There is no GUI to configure it. Reading the article should be required for commenting.
    • Can you recommend me a good Pixel 7 on eBay? Because some are saying Gen 1, and I don't think that's what I want, right?
    • Close, but it is for any application starting, not just during boot time. In fact, it probably will not improve boot time at all because during a boot, the CPU is already boosting, so a pre-boost wouldn't change anything. I agree that it isn't exciting (especially considering every other OS already does it), but it is a good thing, even if they are just playing catch up.
    • Any so called performance increase will be in milliseconds, which nobody will actually notice in real world usage.
  • Recent Achievements

    • One Year In
      slackerzz earned a badge
      One Year In
    • One Year In
      highriskpaym earned a badge
      One Year In
    • One Month Later
      highriskpaym earned a badge
      One Month Later
    • Week One Done
      highriskpaym earned a badge
      Week One Done
    • Week One Done
      FBSPL earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      501
    2. 2
      PsYcHoKiLLa
      198
    3. 3
      +Edouard
      156
    4. 4
      Steven P.
      84
    5. 5
      ATLien_0
      71
  • Tell a friend

    Love Neowin? Tell a friend!