Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
rgf100 Posted October 20, 2017 Posted October 20, 2017 I've knocked up a hook which effectively creates an easy way to discuss posts / topics in the admin forum. There's a theme hook which sticks an 'admin discuss' link on each post, and a code hook which creates a new topic in the admin forum, title being "Discuss: Post in TOPIC by POSTER, started by MOD", content being the original contents of the post and a url. The mod then gets redirected to the edit page for that topic so they can add comments to the first post, or just leave it as is. It works as it is, but I have two improvements I'd like to make. 1) I'm adding the <blockquote> code around the contents of the original content. Is there any way I can use IPS\Text\Parser or something else to conjure up the proper quote code? I'm currently doing something like $content = "<blockquote>".$post->post."</blockquote>"; What would be much more elegant is something like $content = IPS\Text\Parser::quote (1234); I've looked at documentation and poked around in system\text\parser.php, but it's beyond me. 2) Actually this one doesn't matter much. Never mind. If anyone likes this idea I'm happy to share the code I'm using - but as you can tell, I'm above my pay-grade here (well, above my pay-grade as a coder, at least).
Nathan Explosion Posted October 20, 2017 Posted October 20, 2017 Not tried it at all but maybe.. $content = "[quote]".$post->post."[/quote]"; And then put it through the bbcode parser somehow?
rgf100 Posted October 20, 2017 Author Posted October 20, 2017 Just now, Nathan Explosion said: And then put it through the bbcode parser somehow? Yeah, it's the somehow bit I'm stuck on... or does that happen when I create the topic? Can try tomorrow... Actually no, as it won't know where to link the citation stuff to...
Martin A. Posted October 20, 2017 Posted October 20, 2017 The building of the quote box is done in javascript (ips.core.comment.js, function _prepareQuote). $content = "<blockquote class='ipsQuote' data-ipsQuote><div class='ipsQuote_citation'><div class='ipsQuote_citation ipsQuote_open'><a href='#' data-action='toggleQuote'> </a><a class='ipsPos_right' href='{$post->url()}'><i class='fa fa-share'></i></a></div></div><div class='ipsQuote_contents ipsClearfix'>{$post->post|raw}</div></blockquote>"; Untested, but should work.
rgf100 Posted October 24, 2017 Author Posted October 24, 2017 Unfortunately not - I'm not quite sure what's happening, but if you look at a 'normal' quote in the database, there aren't actually any urls in there. It's building those from the data-ipsquote-contentcommentid, etc, information. So what I've ended up doing is recreating that, and it seems to be working. Not tested, and there's some hardcoded stuff in there which means it wouldn't work for, eg, blogs, but it suits my purposes for now. Note some of the variables are mine, not IPS ones. Here's what worked: $content = " <blockquote class='ipsQuote' data-ipsquote='' data-ipsquote-contentapp='forums' data-ipsquote-contentclass='forums_Topic' data-ipsquote-contentcommentid='{$post->pid}' data-ipsquote-contentid='{$reportedtopic->tid}' data-ipsquote-contenttype='forums' data-ipsquote-timestamp='{$post->post_date}' data-ipsquote-userid='{$post->author_id}' data-ipsquote-username='{$post->author_name}'> <div class='ipsQuote_citation'> {$post->author_name} said: </div> <div class='ipsQuote_contents'> <p> {$post->post} </p> </div> </blockquote>"; Thanks for the help with this...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.