• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Add-on Conversation after user upgrade

Aayush

Well-known member
#2
I haven't seen something like this before but it is pretty easy to implement. I once did some custom work for a client and implementing this requires only 10-20 lines of code.
 

Aayush

Well-known member
#13
Hi @Aayush :)

Html enable in message ?
I'll add support for HTML, but will not be able to add support for BBCode.

@Aayush Will it support replacables used for most other places (warning PMs, notices, etc)? ie; {name}, {user_id}, etc.
Not sure about this, had thought about this initially, but I am not sure if I'll be able to parse this sort of stuff. Maybe I'll add a list of variables that can be used in the message and title, for which I'll have to create a custom parser.
If you have any idea how I could parse this kind of stuff using XF built in parser or something, please let me know.
 

Xon

Well-known member
#14
I'll add support for HTML, but will not be able to add support for BBCode.
I would have thought it would have to be bbcode in conversations?

Not sure about this, had thought about this initially, but I am not sure if I'll be able to parse this sort of stuff. Maybe I'll add a list of variables that can be used in the message and title, for which I'll have to create a custom parser.
If you have any idea how I could parse this kind of stuff using XF built in parser or something, please let me know.
XF just does straight string replacements, nothing that fancy.

For example, XenForo_ViewRenderer_HtmlPublic has the following code:
Code:
				$noticeTokens = array(
					'{name}' => $user['username'] !== '' ? $user['username'] : new XenForo_Phrase('guest'),
					'{user_id}' => $user['user_id'],
				);

				XenForo_CodeEvent::fire('notices_prepare', array(&$noticeList, &$noticeTokens, $template, $containerData));

				foreach ($noticeList AS $noticeId => $notice)
				{
					$notices[$noticeId] = array(
...
						'message' => str_replace(array_keys($noticeTokens), $noticeTokens, $notice['message']),
...
					);
				}
 

Aayush

Well-known member
#15
I would have thought it would have to be bbcode in conversations?


XF just does straight string replacements, nothing that fancy.

For example, XenForo_ViewRenderer_HtmlPublic has the following code:
Code:
                $noticeTokens = array(
                    '{name}' => $user['username'] !== '' ? $user['username'] : new XenForo_Phrase('guest'),
                    '{user_id}' => $user['user_id'],
                );

                XenForo_CodeEvent::fire('notices_prepare', array(&$noticeList, &$noticeTokens, $template, $containerData));

                foreach ($noticeList AS $noticeId => $notice)
                {
                    $notices[$noticeId] = array(
...
                        'message' => str_replace(array_keys($noticeTokens), $noticeTokens, $notice['message']),
...
                    );
                }
Probably BBCode, IDK, it wouldn't be possible to add support for both, I'll still have to look into that part later.

Thats how I originally imagined I would be parsing stuff. I was looking for a function which I could invoke from the model directly.