Hi all, thank you for the best cms and for a great support community.
This is my first post and I would like to ask if anyone has succeeded in passing the web user username from modx to yshout.
Running modx evo 1.0.14
This should be easy but I can't seem to find a way. I'm looking for the right place to put the username placeholder.
Two places where it could be are:
1) yshout.class.php
function post($nickname, $message) {
global $prefs;
if ($this->banned(ip()) /* && !$this->admin*/) return false;
if (!$this->validate($message, $prefs['messageLength'])) return false;
if (!$this->validate($nickname, $prefs['nicknameLength'])) return false;
$message = trim(clean($message));
$nickname = trim(clean($nickname));
if ($message == '') return false;
if ($nickname == '') return false;
$timestamp = ts();
$message = $this->censor($message);
$nickname = $this->censor($nickname);
$post = array(
'nickname' => $nickname,
'message' => $message,
'timestamp' => $timestamp,
'admin' => $this->admin,
'uid' => md5($timestamp . ' ' . $nickname),
'adminInfo' => array(
'ip' => ip()
)
);
$s = $this->storage->open(true);
$s['posts'][] = $post;
if (sizeof($s['posts']) > $prefs['history'])
$this->truncate($s['posts']);
$s['info']['latestTimestamp'] = $post['timestamp'];
$this->storage->close($s);
$this->postProcess($post);
return $post;
}
2) preferences.php
<?
// If you want to change the nickname, the line below is the one to modify.
// Simply set $overrideNickname to whatever variable you want to appear as the nickname,
// or leave it null to use the set nicknames.
$overrideNickname = null;
$storage = 'FileStorage';
function loadPrefs() {
global $prefs, $storage, $null;
$s = new $storage('yshout.prefs');
$s->open();
$prefs = $s->load();
$s->close($null);
}
function savePrefs($newPrefs) {
global $prefs, $storage;
$s = new $storage('yshout.prefs');
$s->open(true);
$s->close($newPrefs);
$prefs = $newPrefs;
}
function resetPrefs() {
$defaultPrefs = array(
'password' => '123', // The password for the CP
'refresh' => 6000, // Refresh rate
'logs' => 5, // Amount of different log files to allow
'history' => 200, // Shouts to keep in history
'inverse' => false, // Inverse shoutbox / form on top
'truncate' => 15, // Truncate messages client-side
'doTruncate' => true, // Truncate messages?
'timestamp' => 12, // Timestamp format 12- or 24-hour
'defaultNickname' => 'Nickname',
'defaultMessage' => 'Message Text',
'defaultSubmit' => 'Shout!',
'showSubmit' => true,
'nicknameLength' => 25,
'messageLength' => 175,
'nicknameSeparator' => ':',
'flood' => true,
'floodTimeout' => 5000,
'floodMessages' => 4,
'floodDisable' => 8000,
'floodDelete' => false,
'autobanFlood' => 0, // Autoban people for flooding after X messages
'censorWords' => 'fuck shit bitch ass',
'postFormLink' => 'history',
'info' => 'inline'
);
savePrefs($defaultPrefs);
}
// resetPrefs();
loadPrefs();
?>
Thanks in advance!
[ed. note: didobb last edited this post 9 years, 5 months ago.]