• This forum is for release discussion only. Discussions that do not relate specifically to the resource release should be discussed in another, more appropriate forum.
  • This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Enforce No Shouting For One Group

Jake Bunce

XenForo moderator
Staff member
(in response to this thread)

First enable this option:

Admin CP -> Home -> Options -> Threads, Discussions and Conversations -> Automatically Adjust Case of Discussion Titles

Now we can edit the code to apply this restriction to a specific group only. Edit this file:

library/XenForo/DataWriter/Discussion.php

Add the red code. Change the blue part to specify the user_group_id that cannot shout:

Rich (BB code):
	/**
	 * Verifies that the discussion title is valid
	 *
	 * @param string
	 *
	 * @return boolean
	 */
	public function _verifyTitle(&$title)
	{
		/* ONLY ENFORCE NO SHOUTING FOR ONE GROUP */
		$visitor = XenForo_Visitor::getInstance();
		$noShout = $visitor->isMemberOf(11, true);
		if (!$noShout)
		{
			return true;
		}
		/* ONLY ENFORCE NO SHOUTING FOR ONE GROUP */

		// TODO: send these to callbacks to allow hookability?

		switch ($this->getOption(self::OPTION_ADJUST_TITLE_CASE))
		{
			case 'ucfirst': // sentence case
				$title = utf8_ucfirst(utf8_strtolower($title));
				break;

			case 'ucwords': // title case
				$title = utf8_ucwords(utf8_strtolower($title));
				break;
		}

		return true;
	}
 

Dean

Well-known member
OUTSTANDING!!!! (that was an attempt at humor)

Thank you very much Jake :)

edit: that works great! I will slowly add people in that group as needed. That way the well behaved people will not have their titles changed.
 

ineedhelp

Well-known member
Can I see a before and after effect of this please?

IF SOMEONE TYPES LIKE THIS OR COPY AND PASTES TEXT TYPED IN ALL CAPS - WILL IT AUTOMATICALLY LOWER CASE IT?

And keep the First letter Capital ?

Is this code compatible with 1.1.0 ?

Also - I would like this feature throughout the site, not just for a particular group.
 

Dean

Well-known member
Can I see a before and after effect of this please?

IF SOMEONE TYPES LIKE THIS OR COPY AND PASTES TEXT TYPED IN ALL CAPS - WILL IT AUTOMATICALLY LOWER CASE IT?

And keep the First letter Capital ?

Is this code compatible with 1.1.0 ?

Also - I would like this feature throughout the site, not just for a particular group.
It simply enforces this criteria for thread titles, or not, based on user group:
admincp -> options -> options -> Threads, Discussions and Conversations -> Automatically Adjust Case of Discussion Titles
 

ineedhelp

Well-known member
What's the point of this mod? You can already do this within xenforo.... Only The First Title Letter Is Capital
 

Dean

Well-known member
What's the point of this mod? You can already do this within xenforo.... Only The First Title Letter Is Capital
99% of my members don't abuse the caps lock for titles, 1% do abuse it. So 99% of my members are exempt from the "Automatically Adjust Case of Discussion Titles".

Because we have several terms unique to us that needs to have 2 or 3 consecutive capital letters to make it look correct...
 
Top