Reusing / Repurposing "Campus" Event Type

Hello!

Based on a suggestion I swear I read in the documentation (but can no longer find), I’ve repurposed the “Campus” event type as “University Event Level.” (Administration wants three tiers/types of events for different audiences.) Everything is working correctly except one thing: I can’t figure out how to rename the text “Campus” on the back end — people editing an event will still see “Campus” instead of “University Event Level.”

Is there someplace obvious I’m not looking for this? Because I’d swear I’ve looked all the obvious places.

Thank you,
Brian Byrne
Web Content Administrator
Office of Information Technology
University of Central Oklahoma
bbyrne@uco.edu

I would probably just write some backend JS to change the text in that header.

Hi Bryan!

We have done this a few times — most recently the day before yesterday! — and we’ve got some code for it.

This is just a cosmetic change of “Campus” to “Area of Interest” in several spots where it appears on the back end. You’ll still see campus in the URL — to change that would be deeper and more complex — but this seems to do the trick for most folks.

If you save this to the non-public /livewhale/ directory as /livewhale/client/modules/rename_campuses, then log out and then back in, this ought to work for your needs. (You may of course change “Area of Interest” to something else.)

<?php

$_LW->REGISTERED_APPS['rename_campuses'] = array( // configure this application module
  'title' => 'Rename Campuses',
  'handlers' => ['onOutput']
);

class LiveWhaleApplicationRenameCampuses {

/* The onOutput() hander allows you to add the custom form element to the editor. */

public function onOutput($buffer) {
  global $_LW;
  $buffer=str_replace('Event Types: Campus','Event Types: Area of Interest', $buffer);
  $buffer=str_replace('Add a new Campus','Add Area of Interest', $buffer);
  $buffer=str_replace('Merge Campuses...','Merge Types...', $buffer);
  $buffer=str_replace('Campuses','Areas of interest', $buffer);
  $buffer=str_replace('in these campuses','in these areas', $buffer);
  $buffer=str_replace('<span>Campus:</span>','<span>Area of Interest:</span>', $buffer);
  $buffer=str_replace('<legend>Campus</legend>','<legend>Area(s) of Interest</legend>',	$buffer);

  
  return $buffer;
  }
}

?>
1 Like

OK! I’ve updated the code as follows:

<?php

$_LW->REGISTERED_APPS['rename_campuses'] = array( // configure this application module
  'title' => 'Rename Campuses',
  'handlers' => ['onOutput']
);

class LiveWhaleApplicationRenameCampuses {

/* The onOutput() hander allows you to add the custom form element to the editor. */

public function onOutput($buffer) {
  global $_LW;
  $buffer=str_replace('Event Types: Campus','Event Types: University Event Level', $buffer);
  $buffer=str_replace('Add a new Campus','Add University Event Level', $buffer);
  $buffer=str_replace('Merge Campuses...','Merge University Event Levels...', $buffer);
  $buffer=str_replace('Campuses','University Event Levels', $buffer);
  $buffer=str_replace('in these campuses','in these University Event Levels', $buffer);
  $buffer=str_replace('<span>Campus:</span>','<span>University Event Level:</span>', $buffer);
  $buffer=str_replace('<legend>Campus</legend>','<legend>University Event Level</legend>',	$buffer);

  
  return $buffer;
  }
}
 
?>

… and I’ve saved it here: livewhale/client/modules/rename_campuses.php

Logged out and logged back in. Unfortunately still not seeing it. Tried an incognito window but still nothing.

I’m still extremely optimistic though. Let me know what to do next!

Thanks,
Brian

It should be saved as livewhale/client/modules/rename_campuses/private.application.rename_campuses.php

1 Like

Oops, correct! Thanks Jon!

If that version doesn’t work, let us know,

1 Like

Eyyy! That did it! Thanks a ton, Jason and Jon! I really appreciate your help on this.

2 Likes

Great! This kind of thing is useful but also powerful and dangerous — that onOutput handler just transforms HTML, so you don’t want to be too broad in what you transform.

There’s more about handlers in addition to onOutput here:
https://support.livewhale.com/docs/handlers/

1 Like